Skip to content

Commit

Permalink
Merge pull request #220 from matanki-saito/develop
Browse files Browse the repository at this point in the history
[skip ci] [ci skip]
  • Loading branch information
matanki-saito authored Nov 20, 2021
2 parents 7b71e92 + 5697d75 commit 58cfe09
Show file tree
Hide file tree
Showing 24 changed files with 456 additions and 25 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

- name: generate artifact zip
run: |
compress-archive -Path artifact/* -DestinationPath steam_EU4_1.31_fixdll_build_${{ github.run_number }}.zip
compress-archive -Path artifact/* -DestinationPath steam_EU4_1.32_fixdll_build_${{ github.run_number }}.zip
shell: powershell

- name: Create Release
Expand All @@ -73,6 +73,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./steam_EU4_1.31_fixdll_build_${{ github.run_number }}.zip
asset_name: steam_EU4_1.31_fixdll_build_${{ github.run_number }}.zip
asset_path: ./steam_EU4_1.32_fixdll_build_${{ github.run_number }}.zip
asset_name: steam_EU4_1.32_fixdll_build_${{ github.run_number }}.zip
asset_content_type: application/json
2 changes: 1 addition & 1 deletion Plugin64/Plugin64.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<EnableUAC>false</EnableUAC>
</Link>
<PostBuildEvent>
<Command>copy "$(TargetPath)" "C:\Program Files (x86)\Steam\steamapps\common\Europa Universalis IV\plugins"</Command>
<Command>copy "$(TargetPath)" "C:\Program Files\Epic Games\EuropaUniversalis4\plugins"</Command>
</PostBuildEvent>
<MASM>
<MakeAllSymbolsPublic>
Expand Down
2 changes: 2 additions & 0 deletions Plugin64/date.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ namespace Date {
case v1_31_3_0:
case v1_31_4_0:
case v1_31_5_0:
case v1_31_6_0:
case v1_32_0_1:
// d w mw w y
BytePattern::temp_instance().find_pattern("64 20 77 20 6D");
if (BytePattern::temp_instance().has_size(1, u8"右上の表記を変更")) {
Expand Down
59 changes: 59 additions & 0 deletions Plugin64/event_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
namespace EventDialog {
extern "C" {
void eventDialogProc1();
void eventDialogProc1V132();
void eventDialogProc2();
void eventDialogProc3();
void eventDialogProc3V130();
void eventDialogProc3V132();
uintptr_t eventDialogProc1ReturnAddress;
uintptr_t eventDialogProc2ReturnAddress1;
uintptr_t eventDialogProc2ReturnAddress2;
Expand All @@ -31,6 +33,7 @@ namespace EventDialog {
case v1_31_3_0:
case v1_31_4_0:
case v1_31_5_0:
case v1_31_6_0:
// movzx eax, byte ptr [rcx+rax]
BytePattern::temp_instance().find_pattern("0F B6 04 01 49 8B 34 C2 F3 41 0F 10 8A 48 08 00 00");
if (BytePattern::temp_instance().has_size(1, u8"文字取得処理")) {
Expand All @@ -45,6 +48,21 @@ namespace EventDialog {
e.unmatch.eventDialog1Injector = true;
}
break;
case v1_32_0_1:
// movzx eax, byte ptr [rdx+rax]
BytePattern::temp_instance().find_pattern("0F B6 04 02 49 8B 34 C2 F3 41 0F 10 8A 48 08 00 00");
if (BytePattern::temp_instance().has_size(1, u8"文字取得処理")) {
uintptr_t address = BytePattern::temp_instance().get_first().address();

// jz loc_xxxxx
eventDialogProc1ReturnAddress = address + 0x14;

Injector::MakeJMP(address, eventDialogProc1V132, true);
}
else {
e.unmatch.eventDialog1Injector = true;
}
break;
default:
e.version.eventDialog1Injector = true;
}
Expand All @@ -70,6 +88,7 @@ namespace EventDialog {
case v1_31_3_0:
case v1_31_4_0:
case v1_31_5_0:
case v1_31_6_0:
// mov rax, [rsp+378h+arg_20]
BytePattern::temp_instance().find_pattern("48 8B 84 24 A0 03 00 00 8B 00 03 C0");
if (BytePattern::temp_instance().has_size(1, u8"分岐処理修正戻り先アドレス2")) {
Expand All @@ -93,6 +112,30 @@ namespace EventDialog {
e.unmatch.eventDialog2Injector = true;
}
break;
case v1_32_0_1:
// mov rax, [rsp+1158h+arg_20]
BytePattern::temp_instance().find_pattern("48 8B 84 24 80 11 00 00 8B 00 03 C0");
if (BytePattern::temp_instance().has_size(1, u8"分岐処理修正戻り先アドレス2")) {
eventDialogProc2ReturnAddress2 = BytePattern::temp_instance().get_first().address();
}
else {
e.unmatch.eventDialog1Injector = true;
}

// cvtdq2ps xmm0, xmm0
BytePattern::temp_instance().find_pattern("0F 5B C0 F3 0F 59 C1 41 0F 2E C0 7A 4D");
if (BytePattern::temp_instance().has_size(1, u8"分岐処理修正")) {
uintptr_t address = BytePattern::temp_instance().get_first().address();

// movd xmm0, [rsp+11158h+arg_8]
eventDialogProc2ReturnAddress1 = address + 0x0F;

Injector::MakeJMP(address, eventDialogProc2, true);
}
else {
e.unmatch.eventDialog2Injector = true;
}
break;
default:
e.version.eventDialog2Injector = true;
}
Expand Down Expand Up @@ -131,6 +174,7 @@ namespace EventDialog {
case v1_31_3_0:
case v1_31_4_0:
case v1_31_5_0:
case v1_31_6_0:
// inc edi
BytePattern::temp_instance().find_pattern("FF C7 3B 7B 10 8B 94 24 90 03 00 00 4C 8D");
if (BytePattern::temp_instance().has_size(1, u8"カウントアップ")) {
Expand All @@ -145,6 +189,21 @@ namespace EventDialog {
e.unmatch.eventDialog2Injector = true;
}
break;
case v1_32_0_1:
// inc edi
BytePattern::temp_instance().find_pattern("FF C7 3B 7B 10 44 8B 84 24 70 11 00 00");
if (BytePattern::temp_instance().has_size(1, u8"カウントアップ")) {
uintptr_t address = BytePattern::temp_instance().get_first().address();

// mov r11, 0BFFFFFF43FFFFFFh
eventDialogProc3ReturnAddress = address + 0x14;

Injector::MakeJMP(address, eventDialogProc3V132, true);
}
else {
e.unmatch.eventDialog2Injector = true;
}
break;
default:
e.version.eventDialog2Injector = true;
}
Expand Down
69 changes: 68 additions & 1 deletion Plugin64/event_dialog_asm.asm
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,57 @@ eventDialogProc1 ENDP

;-------------------------------------------;

eventDialogProc1V132 PROC
cmp byte ptr [rdx + rax], ESCAPE_SEQ_1;
jz JMP_A;
cmp byte ptr [rdx + rax], ESCAPE_SEQ_2;
jz JMP_B;
cmp byte ptr [rdx + rax], ESCAPE_SEQ_3;
jz JMP_C;
cmp byte ptr [rdx + rax], ESCAPE_SEQ_4;
jz JMP_D;

mov eventDialogProc1Flag, 0h;
movzx eax, byte ptr [rdx + rax];
jmp JMP_E;

JMP_A:
movzx eax, word ptr [rdx + rax + 1];
jmp JMP_G;

JMP_B:
movzx eax, word ptr [rdx + rax + 1];
sub eax, SHIFT_2;
jmp JMP_G;

JMP_C:
movzx eax, word ptr [rdx + rax + 1];
add eax, SHIFT_3;
jmp JMP_G;

JMP_D:
movzx eax, word ptr [rdx + rax + 1];
add eax, SHIFT_4;

JMP_G:
movzx eax, ax;
cmp eax, NO_FONT;
ja JMP_F;
mov eax, NOT_DEF;

JMP_F:
mov eventDialogProc1Flag, 1h;

JMP_E:
mov rsi, qword ptr [r10 + rax * 8];
movss xmm1, dword ptr [r10 + 848h];
test rsi, rsi;
push eventDialogProc1ReturnAddress;
ret;
eventDialogProc1V132 ENDP

;-------------------------------------------;

eventDialogProc2 PROC
cvtdq2ps xmm0, xmm0;
mulss xmm0, xmm1;
Expand Down Expand Up @@ -118,10 +169,26 @@ JMP_A:
inc edi;
cmp edi, dword ptr [rbx+10h];
mov edx, dword ptr [rsp+378h+18h];
lea r10, qword ptr [rsi+120h];
lea r10, qword ptr [rsi+100h];
push eventDialogProc3ReturnAddress;
ret;
eventDialogProc3V130 ENDP

;-------------------------------------------;

eventDialogProc3V132 PROC
cmp eventDialogProc1Flag, 1;
jnz JMP_A;
add edi,2;

JMP_A:
inc edi;
cmp edi, dword ptr [rbx+10h];
mov r8d, dword ptr [rsp+1158h+18h];
lea r10, [rsi + 120h];
push eventDialogProc3ReturnAddress;
ret;
eventDialogProc3V132 ENDP

END
Loading

0 comments on commit 58cfe09

Please sign in to comment.