From adfd600a7280f46f88925656a53e33d45eb7a21b Mon Sep 17 00:00:00 2001 From: yangzhi <@4F!xZpJwly&KbWq> Date: Thu, 17 Oct 2019 13:55:03 +0800 Subject: [PATCH] Add support to Chinese localized version of game. Remove useless handler --- .../callbacks/CheckMapIconVisibilityHandler.h | 49 ------------------- CubeModLoader/main.cpp | 3 +- 2 files changed, 2 insertions(+), 50 deletions(-) delete mode 100644 CubeModLoader/callbacks/CheckMapIconVisibilityHandler.h diff --git a/CubeModLoader/callbacks/CheckMapIconVisibilityHandler.h b/CubeModLoader/callbacks/CheckMapIconVisibilityHandler.h deleted file mode 100644 index c92c0fa..0000000 --- a/CubeModLoader/callbacks/CheckMapIconVisibilityHandler.h +++ /dev/null @@ -1,49 +0,0 @@ -int CheckMapIconVisibilityHandler(void* player, int a2, int a3) { - for (DLL* dll: modDLLs) { - if (dll->HandleCheckMapIconVisibility) { - if ( int result = ((int(*)(void*, int, int))dll->HandleCheckMapIconVisibility)(player, a2, a3) ){ - return result; - } - } - } - return 0; -} -void* CheckMapIconVisibilityHandler_ptr = (void*)&CheckMapIconVisibilityHandler; - -void* ASMCheckMapIconVisibilityHandler_jmpback; -void* ASMCheckMapIconVisibilityHandler_ret0; -void* ASMCheckMapIconVisibilityHandler_ret1; -void no_optimize ASMCheckMapIconVisibilityHandler() { - asm(PUSH_ALL - - PREPARE_STACK - "call [CheckMapIconVisibilityHandler_ptr] \n" - - RESTORE_STACK - - // Did the handler return 1? true - "cmp eax, 1 \n" - "je 1f \n" - - // Otherwise? Do nothing - POP_ALL - - // original code - "mov rdi, [rcx+0x1528] \n" - "mov esi, r8d \n" - "mov ebp, edx \n" - "test rdi, rdi \n" - "jmp [ASMCheckMapIconVisibilityHandler_jmpback] \n" - - - "1: \n" //not - POP_ALL - "jmp [ASMCheckMapIconVisibilityHandler_ret1] \n" - - ); -} -void SetupCheckMapIconVisibilityHandler() { - WriteFarJMP(base+0x5F4DE, (void*)&ASMCheckMapIconVisibilityHandler); - ASMCheckMapIconVisibilityHandler_jmpback = (void*)base+0x5F4ED; - ASMCheckMapIconVisibilityHandler_ret1 = (void*)base+0x5F6B4; -} diff --git a/CubeModLoader/main.cpp b/CubeModLoader/main.cpp index d6f375a..3b3be83 100644 --- a/CubeModLoader/main.cpp +++ b/CubeModLoader/main.cpp @@ -10,6 +10,7 @@ #define CUBE_VERSION "1.0.0-1" #define CUBE_PACKED_CRC 0xC7682619 #define CUBE_UNPACKED_CRC 0xBA092543 +#define CUBE_UNPACKED_CN_CRC 0x937822A8 #define MODLOADER_NAME "CubeModLoader" @@ -234,7 +235,7 @@ extern "C" __declspec(dllexport) BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD GetModuleFileName(NULL, cubePath, _MAX_PATH); uint32_t checksum = crc32_file(cubePath); - if (checksum == CUBE_PACKED_CRC || checksum == CUBE_UNPACKED_CRC) { + if (checksum == CUBE_PACKED_CRC || checksum == CUBE_UNPACKED_CRC || checksum == CUBE_UNPACKED_CN_CRC) { // Patch some code to run StartMods. This method makes it work with AND without SteamStub. InitializationPatch(); } else {