diff --git a/Plugin/ButtonAndTooltip.cpp b/Plugin/ButtonAndTooltip.cpp index 06514ed..6748bf7 100644 --- a/Plugin/ButtonAndTooltip.cpp +++ b/Plugin/ButtonAndTooltip.cpp @@ -12,6 +12,7 @@ namespace ButtonAndTooltip case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // sub esp,370h byte_pattern::temp_instance().find_pattern("81 EC 70 03 00 00 8B"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -237,6 +238,7 @@ namespace ButtonAndTooltip return NOERROR; case v3_0_X: + case v3_1_0: // mov al,[eax+esi] byte_pattern::temp_instance().find_pattern("8A 04 30 88 85 78 FF FF FF"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -394,6 +396,7 @@ namespace ButtonAndTooltip return NOERROR; case v3_0_X: + case v3_1_0: // cmovnb eax, edi byte_pattern::temp_instance().find_pattern("0F 43 C7 0F B6 04 30 8B 8C 81"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -456,6 +459,7 @@ namespace ButtonAndTooltip return NOERROR; case v3_0_X: + case v3_1_0: // cmp [ebp+var_5C],0 byte_pattern::temp_instance().find_pattern("83 7D A4 00 0F 85 ? ? ? ? 83"); if (byte_pattern::temp_instance().has_size(1, desc + " start")) { @@ -609,6 +613,7 @@ namespace ButtonAndTooltip return NOERROR; case v3_0_X: + case v3_1_0: // cmovnb eax,edi byte_pattern::temp_instance().find_pattern("0F 43 C7 0F B6 04 18 8B"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -631,6 +636,7 @@ namespace ButtonAndTooltip case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // lea esp,[ebp - 388h] byte_pattern::temp_instance().find_pattern("8D A5 78 FC FF FF"); if (byte_pattern::temp_instance().has_size(1, desc)) { diff --git a/Plugin/DateFormat.cpp b/Plugin/DateFormat.cpp index f679b9b..423a5e8 100644 --- a/Plugin/DateFormat.cpp +++ b/Plugin/DateFormat.cpp @@ -18,6 +18,7 @@ namespace DateFormat { case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // issue33と同じもの // sub esp,20h byte_pattern::temp_instance().find_pattern("83 EC 20 56 FF 75 0C 8D 45 D8"); @@ -104,6 +105,7 @@ namespace DateFormat { case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("8D 4D D4 C6 45 FC 08 51 8D 8D 58"); if (byte_pattern::temp_instance().has_size(1, desc)) { // lea ecx,[ebp+var_2C] @@ -126,6 +128,7 @@ namespace DateFormat { case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("64 20 77 20 6D 77 20 2C"); if (byte_pattern::temp_instance().has_size(1, desc)) { injector::WriteMemory(byte_pattern::temp_instance().get_first().address(0), 0x79, true); diff --git a/Plugin/DecorativeLetterDialog.cpp b/Plugin/DecorativeLetterDialog.cpp index a1ecf02..65ad377 100644 --- a/Plugin/DecorativeLetterDialog.cpp +++ b/Plugin/DecorativeLetterDialog.cpp @@ -106,6 +106,7 @@ namespace DecorativeLetterDialog case v3_0_0: case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("6A 01 6A 00 8D 85 88 F4 FF FF"); if (byte_pattern::temp_instance().has_size(1, desc)) { injector::MakeJMP(byte_pattern::temp_instance().get_first().address(0), y_8_v30); @@ -222,6 +223,7 @@ namespace DecorativeLetterDialog case v3_0_0: case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("8D 8D 80 FE FF FF 6A 01 8D"); if (byte_pattern::temp_instance().has_size(1, desc)) { injector::MakeJMP(byte_pattern::temp_instance().get_first().address(0), z_8_v30); diff --git a/Plugin/DecorativeLetterEndDialog.cpp b/Plugin/DecorativeLetterEndDialog.cpp index c67ae59..8cfc99f 100644 --- a/Plugin/DecorativeLetterEndDialog.cpp +++ b/Plugin/DecorativeLetterEndDialog.cpp @@ -45,6 +45,46 @@ namespace DecorativeLetterEndDialog } } + uintptr_t aa_5_v310; + __declspec(naked) void aa_1_v310() + { + __asm { + mov esi, eax; + lea ecx, [ebp - 0xD0]; + mov eax, ecx; + cmp dword ptr[eax + 0x14], 0x10; + jb aa_2; + mov eax, [eax]; + + aa_2: + mov al, [eax]; + cmp al, ESCAPE_SEQ_1; + jz aa_3; + + cmp al, ESCAPE_SEQ_2; + jz aa_3; + + cmp al, ESCAPE_SEQ_3; + jz aa_3; + + cmp al, ESCAPE_SEQ_4; + jz aa_3; + + jmp aa_4; + + aa_3: + push 3; + jmp aa_6; + + aa_4: + push 1; + + aa_6: + push aa_5_v310; + ret; + } + } + /*-----------------------------------------------*/ errno_t func1A_hook(RunOptions *options) { @@ -54,13 +94,25 @@ namespace DecorativeLetterEndDialog case v2_8_X: case v3_0_0: case v3_0_X: + // push 1 byte_pattern::temp_instance().find_pattern("6A 01 8B F0 8D 8D 2C"); if (byte_pattern::temp_instance().has_size(1, desc)) { injector::MakeJMP(byte_pattern::temp_instance().get_first().address(0), aa_1); + // push 0 aa_5 = byte_pattern::temp_instance().get_first().address(10); } else return CK2ERROR1; return NOERROR; + case v3_1_0: + // push 1 + byte_pattern::temp_instance().find_pattern("6A 01 8B F0 8D 8D 30"); + if (byte_pattern::temp_instance().has_size(1, desc)) { + // push 0 + injector::MakeJMP(byte_pattern::temp_instance().get_first().address(0), aa_1_v310); + aa_5_v310 = byte_pattern::temp_instance().get_first().address(10); + } + else return CK2ERROR1; + return NOERROR; } return CK2ERROR1; } @@ -109,6 +161,48 @@ namespace DecorativeLetterEndDialog } } + uintptr_t bb_6_v310; + __declspec(naked) void bb_1_v310() + { + __asm { + lea ecx, [ebp - 0xD0]; + cmp dword ptr[ecx + 0x14], 0x10; + jb bb_2; + mov ecx, [ecx]; + + bb_2: + mov cl, [ecx]; + + cmp cl, ESCAPE_SEQ_1; + jz bb_3; + + cmp cl, ESCAPE_SEQ_2; + jz bb_3; + + cmp cl, ESCAPE_SEQ_3; + jz bb_3; + + cmp cl, ESCAPE_SEQ_4; + jz bb_3; + + jmp bb_4; + + bb_3: + push 3; + jmp bb_5; + + bb_4: + push 1; + + bb_5: + push eax; + lea ecx, [ebp - 0xD0]; + + push bb_6_v310; + ret; + } + } + /*-----------------------------------------------*/ errno_t func1B_hook(RunOptions *options) { @@ -118,13 +212,27 @@ namespace DecorativeLetterEndDialog case v2_8_X: case v3_0_0: case v3_0_X: + // call xxxxx byte_pattern::temp_instance().find_pattern("E8 ? ? ? ? FF B5 3C FF FF FF 8D 45"); if (byte_pattern::temp_instance().has_size(1, desc)) { + // push 1 injector::MakeJMP(byte_pattern::temp_instance().get_first().address(0xE), bb_1); + // call xxxxx bb_6 = byte_pattern::temp_instance().get_first().address(0x17); } else return CK2ERROR1; return NOERROR; + case v3_1_0: + // call xxxxx + byte_pattern::temp_instance().find_pattern("E8 ? ? ? ? FF B5 40 FF FF FF 8D 45"); + if (byte_pattern::temp_instance().has_size(1, desc)) { + // push 1 + injector::MakeJMP(byte_pattern::temp_instance().get_first().address(0xE), bb_1_v310); + // call xxxxx + bb_6_v310 = byte_pattern::temp_instance().get_first().address(0x17); + } + else return CK2ERROR1; + return NOERROR; } return CK2ERROR1; } @@ -229,6 +337,7 @@ namespace DecorativeLetterEndDialog case v3_0_0: case v3_0_X: + case v3_1_0: // push 1 byte_pattern::temp_instance().find_pattern("6A 01 6A 00 8D 85 94 FE FF FF"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -338,6 +447,7 @@ namespace DecorativeLetterEndDialog case v3_0_0: case v3_0_X: + case v3_1_0: //lea ecx, [ebp+var_200] byte_pattern::temp_instance().find_pattern("8D 85 00 FE FF FF 6A 01 50 8D 8D 74 FF FF FF"); if (byte_pattern::temp_instance().has_size(1, desc)) { diff --git a/Plugin/DecorativeLetterInheritDialog.cpp b/Plugin/DecorativeLetterInheritDialog.cpp index 41ccd7e..4c16c2a 100644 --- a/Plugin/DecorativeLetterInheritDialog.cpp +++ b/Plugin/DecorativeLetterInheritDialog.cpp @@ -52,6 +52,7 @@ namespace DecorativeLetterInheritDialog case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("6A 01 8B F8 8D 4D CC"); if (byte_pattern::temp_instance().has_size(1,desc)) { injector::MakeJMP(byte_pattern::temp_instance().get_first().address(0), ff_1); @@ -112,6 +113,7 @@ namespace DecorativeLetterInheritDialog case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // push [ebp+var_24] byte_pattern::temp_instance().find_pattern("FF 75 DC 8D 45 B4 6A 01 50 8D 4D CC"); if (byte_pattern::temp_instance().has_size(1,desc)) { @@ -174,6 +176,7 @@ namespace DecorativeLetterInheritDialog case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("6A 01 8B F8 8D 4D 90 6A"); if (byte_pattern::temp_instance().has_size(1, desc)) { injector::MakeJMP(byte_pattern::temp_instance().get_first().address(0), hh_1); @@ -234,6 +237,7 @@ namespace DecorativeLetterInheritDialog case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("6A 01 50 8D 4D 90 E8"); if (byte_pattern::temp_instance().has_size(1, desc)) { injector::MakeJMP(byte_pattern::temp_instance().get_first().address(0), ii_1); diff --git a/Plugin/FileSave.cpp b/Plugin/FileSave.cpp index 495c643..bc3917a 100644 --- a/Plugin/FileSave.cpp +++ b/Plugin/FileSave.cpp @@ -11,6 +11,7 @@ namespace FileSave { switch (options->version) { case v3_0_0: case v3_0_X: + case v3_1_0: // xor edx,edx (33 D2) byte_pattern::temp_instance().find_pattern("33 D2 85 FF 0F 8E EE 00 00 00"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -37,6 +38,7 @@ namespace FileSave { switch (options->version) { case v3_0_0: case v3_0_X: + case v3_1_0: // push ebx byte_pattern::temp_instance().find_pattern("53 8B 59 10 56 33 F6 85 DB"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -64,6 +66,7 @@ namespace FileSave { switch (options->version) { case v3_0_0: case v3_0_X: + case v3_1_0: // 0: latin1 // 1: ucs2 // 2: ucs4 @@ -82,6 +85,7 @@ namespace FileSave { /*-----------------------------------------------*/ uintptr_t filenameEncode_v300_end; + uintptr_t filenameEncode_v310_end; wchar_t fnamew[200] = {}; char fnameutf8[200] = {}; uintptr_t buff; @@ -173,6 +177,90 @@ namespace FileSave { } } + __declspec(naked) void filenameEncode_v310_start() { + __asm { + push eax; + + call rstTmpMem; + + lea ecx, dword ptr[ebp - 0x74]; + cmp dword ptr[ecx + 0x14], 0x10; + jb A; + mov ecx, [ecx]; + A: + mov buff, ecx; + + push edx; + push ebx; + push esi; + xor esi, esi; + + issue_7_1_loop_start: + cmp byte ptr[ecx], ESCAPE_SEQ_1; + jz issue_7_1_10; + cmp byte ptr[ecx], ESCAPE_SEQ_2; + jz issue_7_1_11; + cmp byte ptr[ecx], ESCAPE_SEQ_3; + jz issue_7_1_12; + cmp byte ptr[ecx], ESCAPE_SEQ_4; + jz issue_7_1_13; + cmp byte ptr[ecx], NULL; + jz issue_7_1_loop_end; + + movzx eax, byte ptr[ecx]; + jmp issue_7_1_yy; + + issue_7_1_10: + movzx eax, word ptr[ecx + 1]; + jmp issue_7_1_xx; + + issue_7_1_11: + movzx eax, word ptr[ecx + 1]; + sub eax, SHIFT_2; + jmp issue_7_1_xx; + + issue_7_1_12: + movzx eax, word ptr[ecx + 1]; + add eax, SHIFT_3; + jmp issue_7_1_xx; + + issue_7_1_13: + movzx eax, word ptr[ecx + 1]; + add eax, SHIFT_4; + + issue_7_1_xx: + add ecx, 2; + + issue_7_1_yy: + mov word ptr[fnamew + esi], ax; + inc ecx; + add esi, 2; + jmp issue_7_1_loop_start; + + issue_7_1_loop_end: + push 0; // ? + push 200; // dst-buf-len + push buff; // dst + lea eax, fnamew; // src + push eax; + call PHYSFS_utf8FromUcs2; + add esp, 0x10; + + lea ecx, dword ptr[ebp - 0x74]; + //mov dword ptr[ecx + 0x10], esi; + //mov dword ptr[ecx + 0x14], 0x10; + + pop esi; + pop ebx; + pop edx; + + mov dword ptr[ebp - 0x30], 0; + + push filenameEncode_v310_end; + ret; + } + } + /*-----------------------------------------------*/ errno_t filenameEncode_hook(RunOptions *options) { @@ -186,10 +274,21 @@ namespace FileSave { byte_pattern::temp_instance().find_pattern("50 8D 8D 78 FF FF FF C7 45 D0 00 00 00 00"); if (byte_pattern::temp_instance().has_size(1, desc)) { injector::MakeJMP(byte_pattern::temp_instance().get_first().address(), filenameEncode_v300_start); + // mov [ebp+var_30],0 filenameEncode_v300_end = byte_pattern::temp_instance().get_first().address(0x7); } else return CK2ERROR1; return NOERROR; + case v3_1_0: + // push eax + byte_pattern::temp_instance().find_pattern("50 8D 4D 8C C7 45 D0 00 00 00 00"); + if (byte_pattern::temp_instance().has_size(1, desc)) { + injector::MakeJMP(byte_pattern::temp_instance().get_first().address(), filenameEncode_v310_start); + // mov byte ptr [ebp+var_40],0 + filenameEncode_v310_end = byte_pattern::temp_instance().get_first().address(0xB); + } + else return CK2ERROR1; + return NOERROR; case v2_8_X: return NOERROR; } @@ -468,6 +567,49 @@ namespace FileSave { } } + uintptr_t issue_15_loadgame_end_v310_1; + __declspec(naked) void issue_15_loadgame_start_v310_1() { + __asm { + mov byte ptr[ebp - 0x4], 5; + lea eax, [ebp - 0x44]; + + // ここから処理 + push eax; + call utf8ToEscapedStr; + add esp, 4; + + push 0; + push eax; + + mov ecx, [edi + 0x20]; + lea edx, [ebp - 0x2C]; + + push issue_15_loadgame_end_v310_1; + ret; + } + } + + uintptr_t issue_15_loadgame_end_v310_2; + __declspec(naked) void issue_15_loadgame_start_v310_2() { + __asm { + mov byte ptr[ebp - 0x4], 6; + + // ここから処理 + push esi; + call utf8ToEscapedStr; + add esp, 4; + + push 0; + push esi; + + lea edx, [ebp - 0x44]; + mov ecx, [edi + 0x20]; + + push issue_15_loadgame_end_v310_2; + ret; + } + } + /*-----------------------------------------------*/ errno_t loadgame_showTitle_hook(RunOptions *options) { @@ -480,13 +622,34 @@ namespace FileSave { // push 1 byte_pattern::temp_instance().find_pattern("6A 01 40 50 FF 75 D4 EB 3A"); if (byte_pattern::temp_instance().has_size(1, desc)) { - // cmovnb lea eax, [ebp+var_2C] + // lea eax, [ebp+var_2C] injector::MakeJMP(byte_pattern::temp_instance().get_first().address(-0x2E), issue_15_loadgame_start_v300); // call xxxxx issue_15_loadgame_end_v300 = byte_pattern::temp_instance().get_first().address(-0x2E + 6); } else return CK2ERROR1; return NOERROR; + case v3_1_0: + // byte ptr [ebp+var_4],5 + byte_pattern::temp_instance().find_pattern("C6 45 FC 05 8D 45 BC 8B 4F 20 8D 55 D4"); + if (byte_pattern::temp_instance().has_size(1, desc)) { + injector::MakeJMP(byte_pattern::temp_instance().get_first().address(), issue_15_loadgame_start_v310_1); + // push edx + issue_15_loadgame_end_v310_1 = byte_pattern::temp_instance().get_first().address(0x10); + } + else return CK2ERROR1; + return NOERROR; + + // これは上と同じだと思うので修正した + // byte ptr [ebp+var_4],6 + byte_pattern::temp_instance().find_pattern("C6 45 FC 05 8D 45 BC 8B 4F 20 8D 55 D4"); + if (byte_pattern::temp_instance().has_size(1, desc)) { + injector::MakeJMP(byte_pattern::temp_instance().get_first().address(), issue_15_loadgame_start_v310_2); + // push edx + issue_15_loadgame_end_v310_2 = byte_pattern::temp_instance().get_first().address(0xD); + } + else return CK2ERROR1; + return NOERROR; case v2_8_X: return NOERROR; } @@ -502,6 +665,7 @@ namespace FileSave { switch (options->version) { case v3_0_0: case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("74 0E 78 0A 8A 41 01 41"); if (byte_pattern::temp_instance().has_size(2, desc)) { // jz short loc_XXXXX -> jmp XXXXX diff --git a/Plugin/Font.cpp b/Plugin/Font.cpp index eef5a92..bafb2f3 100644 --- a/Plugin/Font.cpp +++ b/Plugin/Font.cpp @@ -12,6 +12,7 @@ namespace Font case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("8B EC 56 8B 75 08 83 FE E0 77 30"); if (byte_pattern::temp_instance().has_size(1, desc)) { // mov ebp, esp @@ -42,6 +43,7 @@ namespace Font case v3_0_0: case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("68 A8 26 00 00"); if (byte_pattern::temp_instance().has_size(3, desc)) { injector::WriteMemory(byte_pattern::temp_instance().get(0).address(3), 0x04, true); @@ -71,6 +73,7 @@ namespace Font return NOERROR; case v3_0_0: case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("68 9C 26 00 00"); if (byte_pattern::temp_instance().has_size(3, desc)) { injector::WriteMemory(byte_pattern::temp_instance().get(0).address(3), 0x04, true); @@ -92,6 +95,7 @@ namespace Font case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: /* File容量の制限解除 */ byte_pattern::temp_instance().find_pattern("81 FE 00 00 00 02"); if (byte_pattern::temp_instance().has_size(2,desc)) { diff --git a/Plugin/IME.cpp b/Plugin/IME.cpp index 9c96379..1639943 100644 --- a/Plugin/IME.cpp +++ b/Plugin/IME.cpp @@ -12,6 +12,7 @@ namespace IME case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // skip //IME_Init(videodata, hwnd); //IME_Enable(videodata, hwnd); @@ -39,6 +40,7 @@ namespace IME case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // skip //IME_Init(videodata, hwnd); //IME_Enable(videodata, hwnd); @@ -68,6 +70,7 @@ namespace IME case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // skip // if (!videodata->ime_initialized || !videodata->ime_available || !videodata->ime_enabled) // return SDL_FALSE; @@ -174,6 +177,7 @@ namespace IME case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("0F 84 FD 00 00 00 83 E8 01"); if (byte_pattern::temp_instance().has_size(1, desc + " insert code start")) { injector::MakeJMP(byte_pattern::temp_instance().get_first().address(), settingInputRect_v28_start); @@ -206,6 +210,7 @@ namespace IME case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // SDL_keyborad.c // skip // issue-9 @@ -254,6 +259,7 @@ namespace IME case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("83 C4 14 85 C0 74 07 33"); if (byte_pattern::temp_instance().has_size(1, desc + " start")) { injector::MakeJMP(byte_pattern::temp_instance().get_first().address(), SDL_windowevent_v28_start); @@ -304,6 +310,7 @@ namespace IME case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // 少し手前に引っ掛ける byte_pattern::temp_instance().find_pattern("8B 45 10 59 59 50 6A 00"); if (byte_pattern::temp_instance().has_size(1, desc + " start")) { diff --git a/Plugin/Input.cpp b/Plugin/Input.cpp index f1d9f2a..a49925f 100644 --- a/Plugin/Input.cpp +++ b/Plugin/Input.cpp @@ -317,6 +317,7 @@ namespace Input { case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("55 8B EC 83 EC 70 53 56 57 8B F9 8B DA"); if (byte_pattern::temp_instance().has_size(1, desc)) { injector::WriteMemory(byte_pattern::temp_instance().get_first().address(5), 0x78, true); @@ -330,11 +331,22 @@ namespace Input { } else return CK2ERROR1; - byte_pattern::temp_instance().find_pattern("FF 75 A0 E8 ? ? ? ? 83 C4 04 25"); - if (byte_pattern::temp_instance().has_size(1, desc)) { - xx_end2 = byte_pattern::temp_instance().get_first().address(); + switch (options->version) { + case v3_1_0: + byte_pattern::temp_instance().find_pattern("FF 75 A0 E8 ? ? ? ? 8B D0 83 C4 04"); + if (byte_pattern::temp_instance().has_size(1, desc)) { + xx_end2 = byte_pattern::temp_instance().get_first().address(); + } + else return CK2ERROR1; + break; + default: + byte_pattern::temp_instance().find_pattern("FF 75 A0 E8 ? ? ? ? 83 C4 04 25"); + if (byte_pattern::temp_instance().has_size(1, desc)) { + xx_end2 = byte_pattern::temp_instance().get_first().address(); + } + else return CK2ERROR1; + break; } - else return CK2ERROR1; // same as sub_16FEEFB byte_pattern::temp_instance().find_pattern("8B FF 55 8B EC 56 8B 75 08 83 FE E0"); @@ -446,6 +458,7 @@ namespace Input { case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("8B 07 84 DB 5B 8B CF"); if (byte_pattern::temp_instance().has_size(1,desc + " start" )) { injector::MakeJMP(byte_pattern::temp_instance().get_first().address(), yy_1); diff --git a/Plugin/MainText.cpp b/Plugin/MainText.cpp index 708f3e5..d13f17a 100644 --- a/Plugin/MainText.cpp +++ b/Plugin/MainText.cpp @@ -12,8 +12,9 @@ namespace MainText case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // sub esp,428h - byte_pattern::temp_instance().find_pattern("81 EC 28 04 00 00 56 57 8B F9"); + byte_pattern::temp_instance().find_pattern("81 EC 28 04 00 00 56 57 8B F9 8B"); if (byte_pattern::temp_instance().has_size(1, desc)) { injector::WriteMemory(byte_pattern::temp_instance().get_first().address(2), 0x30, true); } @@ -36,6 +37,7 @@ namespace MainText case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // mov al, byte_XXXXXX[esi] byte_pattern::temp_instance().find_pattern("8A 86 ? ? ? ? 88 81 ? ? ? ? 41"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -168,6 +170,7 @@ namespace MainText case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // inc ecx byte_pattern::temp_instance().find_pattern("41 89 4D CC 84 E4 0F"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -189,6 +192,7 @@ namespace MainText case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // mov eax,[edi+eax*4+OFFSET] byte_pattern::temp_instance().find_pattern("8B 84 87 ? 00 00 00 89"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -232,6 +236,7 @@ namespace MainText case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // cmp dword ptr [ebp-2Ch],0 byte_pattern::temp_instance().find_pattern("83 7D D4 00 0F 85 ? ? ? ? 8B 43"); if (byte_pattern::temp_instance().has_size(1, desc + "start")) { @@ -241,7 +246,7 @@ namespace MainText else return CK2ERROR1; // cmp byte_XXXXX, 0 - byte_pattern::temp_instance().find_pattern("80 3D ? ? ? ? 00 0F 84 47"); + byte_pattern::temp_instance().find_pattern("80 3D ? ? ? ? 00 0F 84 ? ? ? ? 8B 43 28 03 C0"); if (byte_pattern::temp_instance().has_size(1, desc + " end2")) { c_2_end2_v28 = byte_pattern::temp_instance().get_first().address(); } @@ -402,8 +407,9 @@ namespace MainText return NOERROR; case v3_0_X: + case v3_1_0: // mov al, byte_XXXXXX[edx] - byte_pattern::temp_instance().find_pattern("8A 82 ? ? ? ? 88 45 AB 0F B6"); + byte_pattern::temp_instance().find_pattern("8A 82 ? ? ? ? 88 45 AB 0F B6 C0"); if (byte_pattern::temp_instance().has_size(1, desc)) { // movをleaにしている injector::WriteMemory(byte_pattern::temp_instance().get_first().address(0), 0x8D, true); @@ -434,6 +440,7 @@ namespace MainText fontOffset = 0x8C; break; case v3_0_X: + case v3_1_0: fontOffset = 0xA4; break; } diff --git a/Plugin/MainTextLineBreak.cpp b/Plugin/MainTextLineBreak.cpp index 9c0b01e..b7a8155 100644 --- a/Plugin/MainTextLineBreak.cpp +++ b/Plugin/MainTextLineBreak.cpp @@ -32,6 +32,7 @@ namespace MainTextLineBreak { else return CK2ERROR1; return NOERROR; case v3_0_X: + case v3_1_0: // push esi byte_pattern::temp_instance().find_pattern("56 8B F1 8B 46 14 83 F8 10 72 0E"); if (byte_pattern::temp_instance().has_size(5, desc)) { @@ -230,6 +231,7 @@ namespace MainTextLineBreak { return NOERROR; case v3_0_X: + case v3_1_0: // cmp cl,20h byte_pattern::temp_instance().find_pattern("80 F9 20 0F 44 C6 89 45"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -351,6 +353,7 @@ namespace MainTextLineBreak { case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: //スタック修正 // sub esp,7Ch byte_pattern::temp_instance().find_pattern("83 EC 7C 53 8B 5D 0C 56 57 8B F1"); @@ -368,7 +371,9 @@ namespace MainTextLineBreak { } else return CK2ERROR1; - if (options->version == v3_0_X) { + switch (options->version) { + case v3_0_X: + case v3_1_0: // mov eax,[ebp+arg_10] byte_pattern::temp_instance().find_pattern("8B 45 18 03 45 DC 8A 55 20"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -377,8 +382,9 @@ namespace MainTextLineBreak { w_2_end_v28 = byte_pattern::temp_instance().get_first().address(6); } else return CK2ERROR1; + break; - }else{ + default: // mov eax,[ebp+arg_10] byte_pattern::temp_instance().find_pattern("8B 45 18 03 45 DC 89 55"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -387,6 +393,7 @@ namespace MainTextLineBreak { w_2_end_v28 = byte_pattern::temp_instance().get_first().address(6); } else return CK2ERROR1; + break; } // 結合するブロックの飛び先 @@ -544,6 +551,7 @@ namespace MainTextLineBreak { return NOERROR; case v3_0_X: + case v3_1_0: // cmp ebx,[ebp+var_1C] byte_pattern::temp_instance().find_pattern("8B 5D E4 3B 5D E8 0F 8E A6 00 00 00"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -553,7 +561,7 @@ namespace MainTextLineBreak { //左側のブロックの開始位置 // push offset asc_XXXXXX - byte_pattern::temp_instance().find_pattern("68 ? ? ? ? 8D ? ? ? ? 24 07 00"); + byte_pattern::temp_instance().find_pattern("68 ? ? ? ? 8D 4D C0 E8 ? ? ? ? 53"); if (byte_pattern::temp_instance().has_size(1, desc)) { ee_2_v301 = byte_pattern::temp_instance().get_first().address(); } @@ -561,8 +569,8 @@ namespace MainTextLineBreak { //右側のブロックの開始位置 // push offset asc_XXXXXX - byte_pattern::temp_instance().find_pattern("68 ? ? ? ? 8D ? ? ? ? 23 07 00"); - if (byte_pattern::temp_instance().has_size(1, desc)) { + byte_pattern::temp_instance().find_pattern("68 ? ? ? ? 8D 4D C0 E8 ? ? ? ? 56"); + if (byte_pattern::temp_instance().has_size(2, desc)) { ee_3_v301 = byte_pattern::temp_instance().get_first().address(); } else return CK2ERROR1; @@ -667,6 +675,7 @@ namespace MainTextLineBreak { return NOERROR; case v3_0_X: + case v3_1_0: // mov eax, [ebp+arg_10] byte_pattern::temp_instance().find_pattern("8B 45 18 8B CE 8A 55 20 89 4D E4"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -748,6 +757,7 @@ namespace MainTextLineBreak { return NOERROR; case v3_0_X: + case v3_1_0: // ブロックの終端先を変更する // mov [ebp+arg_14],0 byte_pattern::temp_instance().find_pattern("C7 45 EC 00 00 00 00 EB 06 8B 5D 0C"); diff --git a/Plugin/MapAdj.cpp b/Plugin/MapAdj.cpp index aa16416..b36bb09 100644 --- a/Plugin/MapAdj.cpp +++ b/Plugin/MapAdj.cpp @@ -11,6 +11,7 @@ namespace MapAdj { case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // sub esp,178h byte_pattern::temp_instance().find_pattern("81 EC 78 01 00 00 8B 43 18"); if (byte_pattern::temp_instance().has_size(1,desc)) { @@ -107,6 +108,7 @@ namespace MapAdj { case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // movzx eax,byte ptr [eax+edx] byte_pattern::temp_instance().find_pattern("0F B6 04 10 8B 34 86"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -152,6 +154,7 @@ namespace MapAdj { case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: //dec eax byte_pattern::temp_instance().find_pattern("48 F3 0F 51 C9 66 0F 6E"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -190,6 +193,7 @@ namespace MapAdj { case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // mov eax, [ebp-0B4h] byte_pattern::temp_instance().find_pattern("8B 85 4C FF FF FF 8B 73"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -215,6 +219,7 @@ namespace MapAdj { case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // lea esp,[ebp-180h] byte_pattern::temp_instance().find_pattern("8D A5 80 FE FF FF 5F"); if (byte_pattern::temp_instance().has_size(1,desc)) { diff --git a/Plugin/MapAdj2.cpp b/Plugin/MapAdj2.cpp index 387f95b..370cba2 100644 --- a/Plugin/MapAdj2.cpp +++ b/Plugin/MapAdj2.cpp @@ -128,6 +128,7 @@ namespace MapAdj2 return NOERROR; case v3_0_X: // この場所で良いのか自信がない + case v3_1_0: // mov ebx,[ebp+var_10] byte_pattern::temp_instance().find_pattern("8B 5D F0 0F B6 04 30 8B 84 83 A4 00 00 00"); if (byte_pattern::temp_instance().has_size(1, desc)) { diff --git a/Plugin/MapAdj3.cpp b/Plugin/MapAdj3.cpp index 5060665..93dcddd 100644 --- a/Plugin/MapAdj3.cpp +++ b/Plugin/MapAdj3.cpp @@ -45,6 +45,7 @@ namespace MapAdj3 { case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // cmp ebx,1 byte_pattern::temp_instance().find_pattern("83 FB 01 72 34 56 33 F6"); if (byte_pattern::temp_instance().has_size(1, desc + " start")) { @@ -108,6 +109,7 @@ namespace MapAdj3 { case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: // xor esi,esi byte_pattern::temp_instance().find_pattern("33 F6 80 3F 00 74 28 83 FE 01"); if (byte_pattern::temp_instance().has_size(1,desc +" start")) { diff --git a/Plugin/MapJustify.cpp b/Plugin/MapJustify.cpp index 5c7b622..37bc51f 100644 --- a/Plugin/MapJustify.cpp +++ b/Plugin/MapJustify.cpp @@ -109,6 +109,7 @@ namespace MapJustify { return NOERROR; case v3_0_0: case v3_0_X: + case v3_1_0: // lea ecx,[ebp+var_10] byte_pattern::temp_instance().find_pattern("8D 4D F0 8D 51 01 8A 01 41"); if (byte_pattern::temp_instance().has_size(1, desc + "start")) { @@ -205,6 +206,7 @@ namespace MapJustify { return NOERROR; case v3_0_0: case v3_0_X: + case v3_1_0: // push 0xFFFFFFFF byte_pattern::temp_instance().find_pattern("6A FF 6A 00 8D 85 94 FE FF FF 50"); if (byte_pattern::temp_instance().has_size(1, desc + " start")) { @@ -357,6 +359,7 @@ namespace MapJustify { return NOERROR; case v3_0_0: case v3_0_X: + case v3_1_0: // movzx eax,byte ptr [ecx+eax] byte_pattern::temp_instance().find_pattern("0F B6 04 01 8B 04 86 85 C0"); if (byte_pattern::temp_instance().has_size(1, desc)) { diff --git a/Plugin/NickNameFix.cpp b/Plugin/NickNameFix.cpp index 1f07f28..41b6e16 100644 --- a/Plugin/NickNameFix.cpp +++ b/Plugin/NickNameFix.cpp @@ -18,6 +18,7 @@ namespace NickNameFix /* 使わない */ return NOERROR; case v3_0_X: + case v3_1_0: // push [ebp+arg_4] byte_pattern::temp_instance().find_pattern("FF 75 0C 8D 45 D8 C7 45 F0 00 00 00 00"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -204,6 +205,7 @@ namespace NickNameFix return NOERROR; case v3_0_0: case v3_0_X: + case v3_1_0: return NOERROR; } return CK2ERROR1; @@ -348,6 +350,9 @@ namespace NickNameFix } else return CK2ERROR1; return NOERROR; + case v3_1_0: + /* この処理自体が要らなくなった */ + return NOERROR; } return CK2ERROR1; } @@ -469,6 +474,7 @@ namespace NickNameFix case v2_8_X: return NOERROR; case v3_0_X: + case v3_1_0: // lea eax,[ebp+var_30] byte_pattern::temp_instance().find_pattern("8D 45 D0 C6 45 FC 11 8B 4F 7C 50 8D 85"); if (byte_pattern::temp_instance().has_size(1, desc)) { diff --git a/Plugin/NoDynastyId.cpp b/Plugin/NoDynastyId.cpp index f41a387..abbef13 100644 --- a/Plugin/NoDynastyId.cpp +++ b/Plugin/NoDynastyId.cpp @@ -50,6 +50,7 @@ namespace NoDynastyId case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("8B 55 E8 8B 75 D4 83 F9"); if (byte_pattern::temp_instance().has_size(1, desc + " start")) { injector::MakeJMP(byte_pattern::temp_instance().get_first().address(), issue_suffix_id); diff --git a/Plugin/TextOverflow.cpp b/Plugin/TextOverflow.cpp index e8961c0..a8dfcf8 100644 --- a/Plugin/TextOverflow.cpp +++ b/Plugin/TextOverflow.cpp @@ -128,6 +128,7 @@ namespace TextOerflow else return CK2ERROR1; return NOERROR; case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("0F B6 04 30 8B 4C 24"); if (byte_pattern::temp_instance().has_size(1, desc)) { // movzx eax,byte ptr [eax+esi] @@ -193,6 +194,7 @@ namespace TextOerflow switch (options->version) { case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("8B 4F 10 46 89 4C 24 20"); if (byte_pattern::temp_instance().has_size(1, desc)) { // mov ecx, [edi+10h] diff --git a/Plugin/Unk3.cpp b/Plugin/Unk3.cpp index 621ba88..a0a3944 100644 --- a/Plugin/Unk3.cpp +++ b/Plugin/Unk3.cpp @@ -80,6 +80,7 @@ namespace Unk3 { case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("8A 04 16 8B 4D F0 88"); if (byte_pattern::temp_instance().has_size(1, desc + " start")) { // mov al, [esi+edx] diff --git a/Plugin/Unk5.cpp b/Plugin/Unk5.cpp index 475b822..037f380 100644 --- a/Plugin/Unk5.cpp +++ b/Plugin/Unk5.cpp @@ -67,6 +67,7 @@ namespace Unk5 { switch (options->version) { case v3_0_X: + case v3_1_0: byte_pattern::temp_instance().find_pattern("0F B6 04 08 8B 84 87 A4 00 00 00"); if (byte_pattern::temp_instance().has_size(1, desc + " start")) { // movzx eax, byte ptr [eax+ecx] diff --git a/Plugin/dllmain.cpp b/Plugin/dllmain.cpp index aedcb4a..51be955 100644 --- a/Plugin/dllmain.cpp +++ b/Plugin/dllmain.cpp @@ -126,7 +126,7 @@ BOOL WINAPI DllMain(HMODULE module, DWORD reason, void *reserved) L"当我发布新的时,它会自动更新。\n" L"\n" L"DLL宣布页面:\n" - L"https://github.com/matanki-saito/EU4dll"; + L"https://github.com/matanki-saito/CK2dll"; break; @@ -137,7 +137,7 @@ BOOL WINAPI DllMain(HMODULE module, DWORD reason, void *reserved) L"當我發布新的時,它會自動更新。\n" L"\n" L"DLL宣布頁面:\n" - L"https://github.com/matanki-saito/EU4dll"; + L"https://github.com/matanki-saito/CK2dll"; break; case MAKELANGID(LANG_KOREAN, SUBLANG_KOREAN): @@ -147,7 +147,7 @@ BOOL WINAPI DllMain(HMODULE module, DWORD reason, void *reserved) L"새 게시물을 게시하면 자동으로 업데이트됩니다.\n" L"\n" L"DLL 공지 페이지:\n" - L"https://github.com/matanki-saito/EU4dll"; + L"https://github.com/matanki-saito/CK2dll"; break; case MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US): @@ -158,7 +158,7 @@ BOOL WINAPI DllMain(HMODULE module, DWORD reason, void *reserved) L"It will be updated automatically, when I publish new one.\n" L"\n" L"DLL announce page:\n" - L"https://github.com/matanki-saito/EU4dll"; + L"https://github.com/matanki-saito/CK2dll"; } MessageBoxW(NULL, message, caption, MB_OK); diff --git a/Plugin/issue32.cpp b/Plugin/issue32.cpp index df3642d..663b533 100644 --- a/Plugin/issue32.cpp +++ b/Plugin/issue32.cpp @@ -24,6 +24,7 @@ namespace Issue32 { case v3_0_0: case v3_0_X: + case v3_1_0: // sub esp,38h byte_pattern::temp_instance().find_pattern("83 EC 38 53 56 57 8B F9 C7 45 E8"); if (byte_pattern::temp_instance().has_size(2, desc)) { @@ -84,6 +85,28 @@ namespace Issue32 { } } + uintptr_t issue_32_fix1_v310_end; + __declspec(naked) void issue_32_fix1_v310_start() { + __asm { + mov esi, eax; + + mov edx, HOUSE; + //mov byte ptr[ebp - 0x4], 4; + lea ecx, [ebp - 0x8C]; + call issue_32_copyBufFunc_v30; + push eax; + + lea ecx, [ebp - 0xC4]; + mov byte ptr[ebp - 0x4], 0x5; + push ecx; + + mov eax, esi; + + push issue_32_fix1_v310_end; + ret; + } + } + /*-----------------------------------------------*/ errno_t fix1_hook(RunOptions *options) { @@ -123,6 +146,22 @@ namespace Issue32 { } else return CK2ERROR1; return NOERROR; + case v3_1_0: + // sub esp,148h + byte_pattern::temp_instance().find_pattern("81 EC 48 01 00 00 53 56 57 8B F9 C7 45 E8 0F 00"); + if (byte_pattern::temp_instance().has_size(1, desc)) { + // mov esi,eax -> callの後ろまでjmpさせる + // mod edx, offset aHouse ; + injector::WriteMemory(byte_pattern::temp_instance().get_first().address(0x66), 0xEB, true); + injector::WriteMemory(byte_pattern::temp_instance().get_first().address(0x67), 0x14, true); + + // push esi + injector::MakeJMP(byte_pattern::temp_instance().get_first().address(0xAA), issue_32_fix1_v310_start); + // mov ecx, eax + issue_32_fix1_v310_end = byte_pattern::temp_instance().get_first().address(0xAA + 0xC); + } + else return CK2ERROR1; + return NOERROR; } return CK2ERROR1; } @@ -196,6 +235,7 @@ namespace Issue32 { case v3_0_0: case v3_0_X: + case v3_1_0: // push esi byte_pattern::temp_instance().find_pattern("56 8D 4D A8 C6 45 FC 08 51"); if (byte_pattern::temp_instance().has_size(1, desc)) { diff --git a/Plugin/issue33.cpp b/Plugin/issue33.cpp index c3b4e68..74b473e 100644 --- a/Plugin/issue33.cpp +++ b/Plugin/issue33.cpp @@ -17,6 +17,7 @@ namespace Issue33 { case v2_8_X: case v3_0_0: case v3_0_X: + case v3_1_0: /* コピー関数 */ byte_pattern::temp_instance().find_pattern("83 EC 20 56 FF 75 0C 8D 45 D8"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -117,6 +118,7 @@ namespace Issue33 { case v3_0_0: case v3_0_X: + case v3_1_0: /* issue-33 「に忠誠を誓っている 王 ロスラン」を「王 ロスランに忠誠を誓っているにする」 */ byte_pattern::temp_instance().find_pattern("8D 8D 2C FF FF FF C6 45 FC 43"); if (byte_pattern::temp_instance().has_size(1, desc)) { diff --git a/Plugin/mapView.cpp b/Plugin/mapView.cpp index 1d8cc3d..49a4ca3 100644 --- a/Plugin/mapView.cpp +++ b/Plugin/mapView.cpp @@ -212,6 +212,7 @@ namespace MapView return NOERROR; case v3_0_X: + case v3_1_0: // mov al,[eax+ebx] byte_pattern::temp_instance().find_pattern("8A 04 18 8D 8D 00 FF FF FF"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -367,6 +368,7 @@ namespace MapView return NOERROR; case v3_0_X: + case v3_1_0: // movzx eax, byte ptr [eax+ebx] byte_pattern::temp_instance().find_pattern("0F B6 04 18 8B 55 E8 8B 84 82 A4 00 00 00"); if (byte_pattern::temp_instance().has_size(1, desc)) { @@ -586,6 +588,7 @@ namespace MapView return NOERROR; case v3_0_X: + case v3_1_0: // movzx eax, byte ptr [eax+ecx] byte_pattern::temp_instance().find_pattern("0F B6 04 08 8B B4 86 A4 00 00 00"); if (byte_pattern::temp_instance().has_size(1, desc)) { diff --git a/Plugin/stdinc.h b/Plugin/stdinc.h index bbf9af8..3bd62d7 100644 --- a/Plugin/stdinc.h +++ b/Plugin/stdinc.h @@ -59,7 +59,8 @@ enum CK2Version { v2_7_X = 270, v2_8_X = 280, v3_0_0 = 300, - v3_0_X = 301 + v3_0_X = 301, + v3_1_0 = 310 }; enum NickNameOrder { diff --git a/Plugin/version.cpp b/Plugin/version.cpp index 1ce499b..954c953 100644 --- a/Plugin/version.cpp +++ b/Plugin/version.cpp @@ -96,6 +96,13 @@ namespace Misc { goto A; } + // _ _ 3.1.0 + byte_pattern::temp_instance().find_pattern("00 00 33 2E 31"); + if (byte_pattern::temp_instance().count() > 1) { + version = v3_1_0; + goto A; + } + A: byte_pattern::debug_output2(Misc::versionString(version)); return version; @@ -111,6 +118,8 @@ namespace Misc { return "v3_0_0"; case v3_0_X: return "v3_0_X"; + case v3_1_0: + return "v3_1_0"; default: return "UNKNOWN"; }