Skip to content

Commit

Permalink
#230 Test code
Browse files Browse the repository at this point in the history
  • Loading branch information
matanki-saito committed Jun 22, 2022
1 parent 4b03d18 commit f3923af
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 2 deletions.
1 change: 1 addition & 0 deletions Plugin64/injector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ namespace Injector
case 0x8D: // jge
case 0x84: // jz
case 0x8E: // jle
case 0x82: // jb
auto a = ReadRelativeOffset(at + 2, 4, vp);
return a;
}
Expand Down
14 changes: 13 additions & 1 deletion Plugin64/plugin_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,12 @@ struct DllError{
bool versionTooltipAndButtonProc6Injector : 1;
bool unmatchdTooltipAndButtonProc7Injector : 1;
bool versionTooltipAndButtonProc7Injector : 1;
bool unmatchdTooltipAndButtonProc8Injector : 1;
bool versionTooltipAndButtonProc8Injector : 1;
bool unmatchdTooltipAndButtonProc9Injector : 1;
bool versionTooltipAndButtonProc9Injector : 1;
bool unmatchdTooltipAndButtonProc10Injector : 1;
bool versionTooltipAndButtonProc10Injector : 1;
};

std::string print() {
Expand All @@ -441,7 +447,13 @@ struct DllError{
+ PL(unmatchdTooltipAndButtonProc6Injector)
+ PL(versionTooltipAndButtonProc6Injector)
+ PL(unmatchdTooltipAndButtonProc7Injector)
+ PL(versionTooltipAndButtonProc7Injector);
+ PL(versionTooltipAndButtonProc7Injector)
+ PL(unmatchdTooltipAndButtonProc8Injector)
+ PL(versionTooltipAndButtonProc8Injector)
+ PL(unmatchdTooltipAndButtonProc9Injector)
+ PL(versionTooltipAndButtonProc9Injector)
+ PL(unmatchdTooltipAndButtonProc10Injector)
+ PL(versionTooltipAndButtonProc10Injector);
}
} tooltipAndButton;

Expand Down
91 changes: 91 additions & 0 deletions Plugin64/tooltip_and_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ namespace TooltipAndButton {
void tooltipAndButtonProc5V130();
void tooltipAndButtonProc7();
void tooltipAndButtonProc7V133();
void tooltipAndButtonProc8();
void tooltipAndButtonProc9();
void tooltipAndButtonProc10();

uintptr_t tooltipAndButtonProc1ReturnAddress;
uintptr_t tooltipAndButtonProc1CallAddress;
uintptr_t tooltipAndButtonProc2ReturnAddress;
Expand All @@ -24,6 +28,11 @@ namespace TooltipAndButton {
uintptr_t tooltipAndButtonProc5ReturnAddress2;
uintptr_t tooltipAndButtonProc7ReturnAddress1;
uintptr_t tooltipAndButtonProc7ReturnAddress2;
uintptr_t tooltipAndButtonProc8ReturnAddress1;
uintptr_t tooltipAndButtonProc9ReturnAddress1;
uintptr_t tooltipAndButtonProc9ReturnAddress2;
uintptr_t tooltipAndButtonProc10ReturnAddress1;
uintptr_t tooltipAndButtonProc10ReturnAddress2;
}

DllError tooltipAndButtonProc1Injector(RunOptions options) {
Expand Down Expand Up @@ -470,6 +479,85 @@ namespace TooltipAndButton {
return e;
}

DllError tooltipAndButtonProc8Injector(RunOptions options) {
DllError e = {};

switch (options.version) {
case v1_33_3_0:
// mov eax, [rbp+22A0h+var_2294]
BytePattern::temp_instance().find_pattern("8B 44 24 4C 0F 57 C0 F3 48 0F 2A C0 0F 2F C8");
if (BytePattern::temp_instance().has_size(2, u8"改行処理")) {
uintptr_t address = BytePattern::temp_instance().get_first().address();

// jg loc_xxxxx
tooltipAndButtonProc8ReturnAddress1 = Injector::GetBranchDestination(address + 0xF).as_int();

Injector::MakeJMP(address, tooltipAndButtonProc8, true);
}
else {
e.tooltipAndButton.unmatchdTooltipAndButtonProc8Injector = true;
}
break;
default:
e.tooltipAndButton.versionTooltipAndButtonProc8Injector = true;
}

return e;
}

DllError tooltipAndButtonProc9Injector(RunOptions options) {
DllError e = {};

switch (options.version) {
case v1_33_3_0:
//
BytePattern::temp_instance().find_pattern("48 8D 44 24 50 48 83 FF 10 48 0F 43 C6 80 3C 10 0A");
if (BytePattern::temp_instance().has_size(1, u8"文字がないときの改行処理?")) {
uintptr_t address = BytePattern::temp_instance().get_first().address();

tooltipAndButtonProc9ReturnAddress1 = address + 0x2A;
tooltipAndButtonProc9ReturnAddress2 = Injector::GetBranchDestination(address + 0x24).as_int();


Injector::MakeJMP(address, tooltipAndButtonProc9, true);
}
else {
e.tooltipAndButton.unmatchdTooltipAndButtonProc9Injector = true;
}
break;
default:
e.tooltipAndButton.versionTooltipAndButtonProc9Injector = true;
}

return e;
}

DllError tooltipAndButtonProc10Injector(RunOptions options) {
DllError e = {};

switch (options.version) {
case v1_33_3_0:
//
BytePattern::temp_instance().find_pattern("0F 28 B4 24 C0 00 00 00 48 81 C4 F0 00 00 00 41");
if (BytePattern::temp_instance().has_size(1, u8"DEBUG")) {
uintptr_t address = BytePattern::temp_instance().get_first().address();

// retn
tooltipAndButtonProc10ReturnAddress1 = address + 0x11;

Injector::MakeJMP(address, tooltipAndButtonProc10, true);
}
else {
e.tooltipAndButton.unmatchdTooltipAndButtonProc9Injector = true;
}
break;
default:
e.tooltipAndButton.versionTooltipAndButtonProc9Injector = true;
}

return e;
}

DllError Init(RunOptions options) {
DllError result = {};

Expand All @@ -480,6 +568,9 @@ namespace TooltipAndButton {
result |= tooltipAndButtonProc5Injector(options);
result |= tooltipAndButtonProc6Injector(options);
result |= tooltipAndButtonProc7Injector(options);
//result |= tooltipAndButtonProc8Injector(options);
//result |= tooltipAndButtonProc9Injector(options);
//result |= tooltipAndButtonProc10Injector(options);

return result;
}
Expand Down
67 changes: 66 additions & 1 deletion Plugin64/tooltip_and_button_asm.asm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ EXTERN tooltipAndButtonProc5ReturnAddress1 : QWORD
EXTERN tooltipAndButtonProc5ReturnAddress2 : QWORD
EXTERN tooltipAndButtonProc7ReturnAddress1 : QWORD
EXTERN tooltipAndButtonProc7ReturnAddress2 : QWORD
EXTERN tooltipAndButtonProc8ReturnAddress1 : QWORD
EXTERN tooltipAndButtonProc9ReturnAddress1 : QWORD
EXTERN tooltipAndButtonProc9ReturnAddress2 : QWORD
EXTERN tooltipAndButtonProc10ReturnAddress1 : QWORD

ESCAPE_SEQ_1 = 10h
ESCAPE_SEQ_2 = 11h
Expand Down Expand Up @@ -84,6 +88,10 @@ tooltipAndButtonProc1V133 PROC
jmp JMP_B;
JMP_A:
mov tooltipAndButtonProc2TmpFlag, 1h;

; debug
mov r8, qword ptr [rbp + 21D0h - 2220h];

lea r8, qword ptr [rax + rcx];
mov tooltipAndButtonProc2TmpCharacterAddress, r8;
movzx r8d, byte ptr[rax + rcx];
Expand Down Expand Up @@ -292,11 +300,14 @@ tooltipAndButtonProc4V133 PROC
jz JMP_A;

cmp tooltipAndButtonProc2TmpCharacter, 00FFh;
ja JMP_A;
ja JMP_X;

push tooltipAndButtonProc4ReturnAddress1;
ret;

JMP_X:
nop;

JMP_A:
cmp dword ptr [rbp + 21D0h - 2210h], 0;
push tooltipAndButtonProc4ReturnAddress2;
Expand Down Expand Up @@ -408,7 +419,9 @@ JMP_F:
JMP_H:
add rbx, 3;
add edi, 3;
sub rbx, 3;
cmp rbx, r13;
add rbx, 3
ja JMP_J;
dec rbx;
dec edi;
Expand Down Expand Up @@ -461,8 +474,60 @@ JMP_A:
ret;

JMP_B:
; debug
mov rdi, qword ptr [rbp + 21D0h - 2220h];

push tooltipAndButtonProc7ReturnAddress2;
ret;
tooltipAndButtonProc7V133 ENDP


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

tooltipAndButtonProc8 PROC
mov eax, [rbp + 22A0h - 2294h]
xorps xmm0, xmm0
cvtsi2ss xmm0, rax
comiss xmm1, xmm0

push tooltipAndButtonProc8ReturnAddress1;
ret;
tooltipAndButtonProc8 ENDP

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

tooltipAndButtonProc9 PROC
lea rax, [rsp + 22D0h - 2280h]
cmp rdi, 10h
cmovnb rax, rsi
cmp byte ptr [rax+rdx], 0Ah
jz JMP_A;

lea rax, [rsp + 22D0h - 2280h]
cmp rdi, 10h
cmovnb rax, rsi
cmp byte ptr [rax + rdx], 0Dh
jnz JMP_B;

JMP_A:
push tooltipAndButtonProc9ReturnAddress1;
ret;

JMP_B:
push tooltipAndButtonProc9ReturnAddress2;
ret;

tooltipAndButtonProc9 ENDP

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

tooltipAndButtonProc10 PROC
movaps xmm6, [rsp + 0F8h - 38h]
add rsp, 0F0h
pop r15

push tooltipAndButtonProc10ReturnAddress1;
ret;
tooltipAndButtonProc10 ENDP

END

0 comments on commit f3923af

Please sign in to comment.