15 Commits

Author SHA1 Message Date
5d5d2117ec 3.0.4 2023-08-12 02:32:20 +03:00
ca65bbd70c Reformat invalid checksum messagebox 2023-08-12 02:29:27 +03:00
c17cf00409 Move LoadLibrary call into core 2023-08-12 02:16:19 +03:00
c80635fc71 Adapted utils_create_dir_recursively to general project style 2023-08-10 01:15:53 +03:00
e9d2130105 Minor game detect refactoring 2023-08-10 01:00:24 +03:00
0bfab4f682 v3.0.3 2023-08-06 22:09:57 +03:00
e0fcca3701 Fix block_analytics.sh 2023-08-06 22:09:44 +03:00
3b7cda6c5f Mention 'chmod +x' in the readme 2023-08-06 19:32:29 +03:00
e066466339 v3.0.2 2023-08-06 19:27:47 +03:00
612c2e74e6 Added block_analytics.sh script 2023-08-06 19:26:02 +03:00
4060fb5d4e Added handling for more error conditions 2023-08-06 19:01:44 +03:00
54978e367c Fixed multiple error messageboxes showing invalid characters 2023-08-06 18:55:40 +03:00
e0d89875a0 Updated core.md 2023-08-05 18:37:19 +03:00
89c6347315 v3.0.1 2023-08-05 18:32:56 +03:00
de15c00f2a Fix 3rd crash 2023-08-05 18:32:29 +03:00
13 changed files with 79 additions and 49 deletions

View File

@ -22,9 +22,9 @@ The anticheat the games use is fundamentally incompatible with Wine in multiple
Manual usage instructions: Manual usage instructions:
- Download the game you want to run - Download the game you want to run
- Download a release from this repository - Download the latest release from this repository
- Extract the archive (**NOT INTO THE GAME DIRECTORY! THIS IS IMPORTANT!**) - Extract the archive (**NOT INTO THE GAME DIRECTORY! THIS IS IMPORTANT!**)
- Block analytics servers in your `hosts` file. You can find the list in SERVERS.txt - Run `./block_analytics.sh` from the archive to block the games from accessing analytics servers (you might have to do a `chmod +x block_analytics.sh` first). This will require superuser privileges
- Run `wine jadeite.exe 'Z:\wine\path\to\game.exe'` - Run `wine jadeite.exe 'Z:\wine\path\to\game.exe'`
This tool is capable of starting the games from a different process. This may be useful for spoofing the parent process (SR is known to report it). Use `wine jadeite.exe 'Z:\wine\path\to\game.exe' 'Z:\wine\path\to\launcher.exe'`. `explorer.exe` is used as the default. This tool is capable of starting the games from a different process. This may be useful for spoofing the parent process (SR is known to report it). Use `wine jadeite.exe 'Z:\wine\path\to\game.exe' 'Z:\wine\path\to\launcher.exe'`. `explorer.exe` is used as the default.

View File

@ -1,18 +0,0 @@
# Honkai Impact 3rd logging servers (glb/sea/tw/kr/jp):
0.0.0.0 log-upload-os.hoyoverse.com
0.0.0.0 sg-public-data-api.hoyoverse.com
0.0.0.0 dump.gamesafe.qq.com
# Honkai Impact 3rd logging servers (cn):
0.0.0.0 log-upload.mihoyo.com
0.0.0.0 public-data-api.mihoyo.com
0.0.0.0 dump.gamesafe.qq.com
# Honkai Star Rail logging servers (oversea)
0.0.0.0 log-upload-os.hoyoverse.com
0.0.0.0 sg-public-data-api.hoyoverse.com
# Honkai Star Rail logging servers (China)
0.0.0.0 log-upload.mihoyo.com
0.0.0.0 public-data-api.mihoyo.com

36
block_analytics.sh Normal file
View File

@ -0,0 +1,36 @@
#!/usr/bin/env bash
analytics_servers=$(cat <<EOF
# Honkai Impact 3rd analytics servers (glb/sea/tw/kr/jp):
0.0.0.0 log-upload-os.hoyoverse.com
0.0.0.0 sg-public-data-api.hoyoverse.com
0.0.0.0 dump.gamesafe.qq.com
# Honkai Impact 3rd analytics servers (cn):
0.0.0.0 log-upload.mihoyo.com
0.0.0.0 public-data-api.mihoyo.com
0.0.0.0 dump.gamesafe.qq.com
# Honkai Star Rail analytics servers (os)
0.0.0.0 log-upload-os.hoyoverse.com
0.0.0.0 sg-public-data-api.hoyoverse.com
# Honkai Star Rail analytics servers (cn)
0.0.0.0 log-upload.mihoyo.com
0.0.0.0 public-data-api.mihoyo.com
EOF
)
if [[ ! `cat /etc/hosts` == *"$analytics_servers"* ]]; then
echo "Blocking analytics servers. This will require superuser privileges"
echo "$analytics_servers" | pkexec tee -a /etc/hosts 2>&1 >> /dev/null
if test $? -ne 0; then
echo "Could not block analytics servers. Please add the following lines to your /etc/hosts manually:"
echo "$analytics_servers"
fi
else
echo "Analytics servers are already blocked"
fi

View File

@ -14,6 +14,7 @@ mkdir out
cp ./build/injector/jadeite.exe ./out cp ./build/injector/jadeite.exe ./out
cp ./build/injector/launcher_payload.dll ./out cp ./build/injector/launcher_payload.dll ./out
cp ./build/game_payload/game_payload.dll ./out cp ./build/game_payload/game_payload.dll ./out
cp ./block_analytics.sh ./out
cp ./LICENSE.txt ./out cp ./LICENSE.txt ./out
$strip ./out/*.{exe,dll} $strip ./out/*.{exe,dll}

Binary file not shown.

View File

@ -2,10 +2,12 @@
#include <stdint.h> #include <stdint.h>
#define UTILS_COUNT(arr) (sizeof(arr) / sizeof(*arr))
int utils_path_exists(const wchar_t *filePath); int utils_path_exists(const wchar_t *filePath);
uint32_t utils_file_crc32c(const wchar_t *filePath); uint32_t utils_file_crc32c(const wchar_t *filePath);
void utils_create_dir_recursively(const wchar_t *path); void utils_create_parent_dirs(const wchar_t *path);
void utils_save_to_file(const wchar_t *filePath, const void *buf, size_t length); void utils_save_to_file(const wchar_t *filePath, const void *buf, size_t length);

View File

@ -16,3 +16,13 @@
### 2.0.0 ### 2.0.0
- Almost a full rewrite, functionality unchanged - Almost a full rewrite, functionality unchanged
- Added support for HI3 sea/cn/tw/jp/kr - Added support for HI3 sea/cn/tw/jp/kr
### 3.0.0
- Integrated table extractor
### 3.0.1
- Fixed a bug that caused HI3 to crash
### branch/master
- Fixed multiple error messageboxes showing invalid characters
- Added handling for more error conditions

View File

@ -1,32 +1,39 @@
#include <msg.h> #include <msg.h>
#include <utils.h>
#include <game.h> #include <game.h>
typedef void (*fill_fn)(struct game_data *buf); typedef void (*fill_fn)(struct game_data *buf);
struct name_fn_pair { struct name_fn_pair {
const char *name; const wchar_t *name;
fill_fn fill; fill_fn fill;
}; };
const struct name_fn_pair GAMES[] = { const struct name_fn_pair GAMES[] = {
{ "bh3.exe", &hi3_fill_data }, { L"BH3", &hi3_fill_data },
{ "starrail.exe", &hsr_fill_data } { L"StarRail", &hsr_fill_data }
}; };
void game_detect(struct game_data *buf) { void game_detect(struct game_data *buf) {
char exePath[MAX_PATH]; wchar_t exePath[MAX_PATH];
GetModuleFileNameA(NULL, exePath, MAX_PATH); GetModuleFileNameW(NULL, exePath, MAX_PATH);
char *exeName = strrchr(exePath, '\\') + 1; // Leave only the basename
strlwr(exeName); wchar_t *exeName = wcsrchr(exePath, L'\\') + 1;
for (size_t i = 0; i < sizeof(GAMES) / sizeof(struct name_fn_pair); i++) { // Cut off extension (.exe)
if (strcmp(exeName, GAMES[i].name) == 0) { wchar_t *extensionDot = wcsrchr(exeName, L'.');
if (extensionDot != NULL) {
*extensionDot = L'\0';
}
for (size_t i = 0; i < UTILS_COUNT(GAMES); i++) {
if (wcsicmp(exeName, GAMES[i].name) == 0) {
GAMES[i].fill(buf); GAMES[i].fill(buf);
return; return;
} }
} }
msg_err_a("Unknown game: %s", exeName); msg_err_w(L"Unknown game: %ls", exeName);
} }

View File

@ -78,14 +78,15 @@ void hsr_fill_data(struct game_data *buf) {
uint32_t crc = utils_file_crc32c(L"UnityPlayer.dll"); uint32_t crc = utils_file_crc32c(L"UnityPlayer.dll");
enum hsr_region id = HSR_INVALID; enum hsr_region id = HSR_INVALID;
for (size_t i = 0; i < sizeof(HSR_REGIONS) / sizeof(struct crc_region_pair); i++) { for (size_t i = 0; i < UTILS_COUNT(HSR_REGIONS); i++) {
if (HSR_REGIONS[i].crc == crc) { if (HSR_REGIONS[i].crc == crc) {
id = HSR_REGIONS[i].id; id = HSR_REGIONS[i].id;
break;
} }
} }
if (id == HSR_INVALID) { if (id == HSR_INVALID) {
msg_err_a("Invalid UnityPlayer.dll checksum: %x", crc); msg_err_a("Invalid UnityPlayer.dll checksum: 0x%08x. This usually happens when the patch is outdated", crc);
} }
buf->base_module_name = HSR_BASE_MODULE_NAME; buf->base_module_name = HSR_BASE_MODULE_NAME;

View File

@ -51,18 +51,12 @@ static void _run_game(struct game_data *game, wchar_t *txFile) {
} }
static void _run_tx(struct game_data *game, wchar_t *txFile) { static void _run_tx(struct game_data *game, wchar_t *txFile) {
// Load unpatched base module
HMODULE baseModule = LoadLibraryA(game->base_module_name);
if (!baseModule) {
msg_err_a("Failed to load base module: %s", game->base_module_name);
}
// ...more magic // ...more magic
size_t tableSize; size_t tableSize;
void *table = core_perform_tx(game, &tableSize); void *table = core_perform_tx(game, &tableSize);
// Save to file // Save to file
utils_create_dir_recursively(txFile); utils_create_parent_dirs(txFile);
utils_save_to_file(txFile, table, tableSize); utils_save_to_file(txFile, table, tableSize);
// Cleanup // Cleanup

View File

@ -34,21 +34,18 @@ uint32_t utils_file_crc32c(const wchar_t *filePath) {
} }
// https://stackoverflow.com/a/16719260 // https://stackoverflow.com/a/16719260
void utils_create_dir_recursively(const wchar_t *path) { void utils_create_parent_dirs(const wchar_t *path) {
wchar_t dir[MAX_PATH]; wchar_t dir[MAX_PATH];
ZeroMemory(dir, MAX_PATH * sizeof(wchar_t)); ZeroMemory(dir, sizeof(dir));
wchar_t *end = wcschr(path, L'\\'); const wchar_t *end = path - 1;
while(end != NULL) while((end = wcschr(++end, L'\\')) != NULL) {
{
wcsncpy(dir, path, end - path + 1); wcsncpy(dir, path, end - path + 1);
if (!utils_path_exists(dir) && !CreateDirectoryW(dir, NULL)) { if (!utils_path_exists(dir) && !CreateDirectoryW(dir, NULL)) {
msg_err_w(L"Failed to create directory: %ls", dir); msg_err_w(L"Failed to create directory: %ls", dir);
} }
end = wcschr(++end, L'\\');
} }
} }

View File

@ -1,4 +1,4 @@
project('jadeite', 'c', version: '3.0.0') project('jadeite', 'c', version: '3.0.4')
nasm = find_program('nasm') nasm = find_program('nasm')
gen_res = find_program('gen_resources.sh') gen_res = find_program('gen_resources.sh')

View File

@ -1,6 +1,6 @@
{ {
"jadeite": { "jadeite": {
"version": "3.0.0" "version": "3.0.4"
}, },
"games": { "games": {
"hi3rd": { "hi3rd": {