14 Commits

Author SHA1 Message Date
8bf5aac0ec v3.0.6 2023-08-17 22:57:32 +03:00
4c7dd302d5 Merged workaround for 3rd 2023-08-17 22:55:26 +03:00
63eed9d796 Handle missing txs section 2023-08-17 22:53:12 +03:00
671f9ba246 Add temporary workaround for 3rd 6.9.0 2023-08-17 22:51:43 +03:00
868b4e27be Reference 6.9.0 issue in readme 2023-08-17 18:23:54 +00:00
56eefd83d7 Mark 3rd cn 6.9.0 as broken 2023-08-17 19:10:52 +03:00
3b2d33ad24 v3.0.5 2023-08-12 17:22:34 +03:00
ba6a054ec3 Show executable path in failed to start game process messagebox 2023-08-12 17:20:58 +03:00
7693e63619 Update core.md 2023-08-12 17:16:05 +03:00
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
13 changed files with 56 additions and 36 deletions

View File

@ -1,8 +1,8 @@
### Games and regions
- **3rd**: glb/sea/cn/tw/kr/jp **v6.8.0+**
- **3rd**: glb/sea/tw/kr/jp **v6.8.0**, **cn v6.9.0 broken**
- **SR**: os/cn **v1.2.0** (potentially unsafe, but no bans were reported since v1.1.0)
**You can expect newer versions of 3rd to work immediately after release with the same jadeite binary.** However, that is not the case for SR: you will have to update your jadeite binary to run newer versions.
~~You can expect newer versions of 3rd to work immediately after release with the same jadeite binary. However, that is not the case for SR: you will have to update your jadeite binary to run newer versions.~~ 6.9.0 investigation is in progress, please wait. #25
### Information
The anticheat the games use is fundamentally incompatible with Wine in multiple ways. This tool launches the game without it (`injector`) and imitates it's behaviour (`game_payload`).

Binary file not shown.

View File

@ -2,10 +2,12 @@
#include <stdint.h>
#define UTILS_COUNT(arr) (sizeof(arr) / sizeof(*arr))
int utils_path_exists(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);

View File

@ -23,6 +23,9 @@
### 3.0.1
- Fixed a bug that caused HI3 to crash
### branch/master
### 3.0.2
- Fixed multiple error messageboxes showing invalid characters
- Added handling for more error conditions
### 3.0.4
- Moved LoadLibrary call into core from main

View File

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

View File

@ -3,16 +3,28 @@
#include <game.h>
const char *HI3_TXS_SECTION_NAME_OLD = ".bh3";
const char *HI3_TXS_SECTION_NAME_NEW = ".ace";
const char *HI3_BASE_MODULE_NAME = "BH3Base.dll";
const char *HI3_ASSEMBLY_PATH = "BH3_Data\\Native\\UserAssembly.dll";
const char *HI3_TXS_SECTION_NAME = ".bh3";
const char *HI3_TVM_SECTION_NAME = ".tvm0";
void hi3_fill_data(struct game_data *buf) {
// !!! TEMPORARY WORKAROUND FOR HI3 6.8.0 -> 6.9.0
const uint32_t NEW_CHECKSUM = 0x885b4c63;
uint32_t crc = utils_file_crc32c(L"UnityPlayer.dll");
if (crc == NEW_CHECKSUM) {
buf->txs_section_name = HI3_TXS_SECTION_NAME_NEW;
} else {
buf->txs_section_name = HI3_TXS_SECTION_NAME_OLD;
}
buf->base_module_name = HI3_BASE_MODULE_NAME;
buf->assembly_path = HI3_ASSEMBLY_PATH;
buf->txs_section_name = HI3_TXS_SECTION_NAME;
buf->tvm_section_name = HI3_TVM_SECTION_NAME;
buf->unityplayer_callback = NULL;

View File

@ -78,14 +78,15 @@ void hsr_fill_data(struct game_data *buf) {
uint32_t crc = utils_file_crc32c(L"UnityPlayer.dll");
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) {
id = HSR_REGIONS[i].id;
break;
}
}
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;

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) {
// 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
size_t tableSize;
void *table = core_perform_tx(game, &tableSize);
// Save to file
utils_create_dir_recursively(txFile);
utils_create_parent_dirs(txFile);
utils_save_to_file(txFile, table, tableSize);
// Cleanup

View File

@ -28,6 +28,10 @@ void tx_table_file(struct game_data *game, wchar_t *buf) {
// Checksum the TXS section
IMAGE_SECTION_HEADER *txsSection = pe_find_section(baseMap, game->txs_section_name);
if (!txsSection) {
msg_err_a("Could not find %s in %s. " ISSUE_SUFFIX, game->txs_section_name, game->base_module_name);
}
uint32_t txsChecksum = crc32c(0, baseMap + txsSection->PointerToRawData, txsSection->SizeOfRawData);
// Format the path

View File

@ -34,21 +34,18 @@ uint32_t utils_file_crc32c(const wchar_t *filePath) {
}
// 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];
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);
if (!utils_path_exists(dir) && !CreateDirectoryW(dir, NULL)) {
msg_err_w(L"Failed to create directory: %ls", dir);
}
end = wcschr(++end, L'\\');
}
}

View File

@ -88,7 +88,7 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) {
&pi
)) {
wchar_t message[1024];
wsprintfW(message, L"Failed to start game process: %ld", GetLastError());
wsprintfW(message, L"Failed to start game process: %ld\nGame executable path: '%ls'", GetLastError(), targetExe);
MessageBoxW(NULL, message, J_MB_TITLE, MB_OK | MB_ICONERROR);
exit(1);

View File

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

View File

@ -1,6 +1,6 @@
{
"jadeite": {
"version": "3.0.3"
"version": "3.0.6"
},
"games": {
"hi3rd": {
@ -14,7 +14,7 @@
},
"china": {
"status": "verified",
"version": "6.8.0"
"version": "6.9.0"
},
"taiwan": {
"status": "verified",