 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Zhuma How do I cheat?
Reputation: 0
Joined: 11 Feb 2023 Posts: 5
|
Posted: Tue Jun 27, 2023 1:10 pm Post subject: Multilevel pointers in Assembly |
|
|
I'm trying to create a script for Europa Universalis 4, to multiply Institutions gain by X amount, I have code, and I want to compare value from [rsp+8+B0] with [iPlayerID] (Both of these variables are valid, and they're not null), [rsp+8+B0] contains variable which is equal to hex value of [iPlayerID] (I got it from other guy's script). How can do this comparison?
If it's not clear what I want to do, code which represents what I mean:
| Code: | newmem:
push ebx
mov ebx,[rsp+8+B0]
cmp ebx,[iPlayerID]
pop ebx
jne originalcode
// Other code which I'll add later
|
This is not the first time I had this problem, so I would be really appreciate if someone will help me. Thank you.
Original code:
| Code: | [ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048,"eu4.exe"+97CFFB)
label(returnhere)
label(originalcode)
label(exit)
newmem:
originalcode:
add [r8+rdx*4],ecx
sets al
exit:
jmp returnhere
"eu4.exe"+97CFFB:
jmp newmem
nop 2
returnhere:
[DISABLE]
dealloc(newmem)
"eu4.exe"+97CFFB:
db 41 01 0C 90 0F 98 C0
//add [r8+rdx*4],ecx
//sets al
|
I've also tried doing this, but it only crashes the game:
| Code: | newmem:
push ebx
mov ebx,[rsp+8]
add ebx,B0
cmp ebx,[iPlayerID]
pop ebx
jne originalcode
// ...
|
Last edited by Zhuma on Wed Jun 28, 2023 1:40 pm; edited 1 time in total |
|
| Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Tue Jun 27, 2023 1:18 pm Post subject: |
|
|
| Post your whole script. Including any surrounding instructions at your point of injection.
|
|
| Back to top |
|
 |
Zhuma How do I cheat?
Reputation: 0
Joined: 11 Feb 2023 Posts: 5
|
Posted: Tue Jun 27, 2023 2:57 pm Post subject: |
|
|
Whole script:
| Code: |
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
aobscanmodule(INJECT,eu4.exe,41 01 0C 90 0F 98 C0) // should be unique
alloc(newmem,$1000,INJECT)
label(code)
label(return)
newmem:
code:
add [r8+rdx*4],ecx
sets al
jmp return
INJECT:
jmp newmem
nop 2
return:
registersymbol(INJECT)
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
INJECT:
db 41 01 0C 90 0F 98 C0
unregistersymbol(INJECT)
dealloc(newmem)
{
// ORIGINAL CODE - INJECTION POINT: eu4.exe+97CFFB
eu4.exe+97CFD7: 49 8B C7 - mov rax,r15
eu4.exe+97CFDA: 49 F7 E8 - imul r8
eu4.exe+97CFDD: 49 03 D0 - add rdx,r8
eu4.exe+97CFE0: 48 C1 FA 0D - sar rdx,0D
eu4.exe+97CFE4: 48 8B C2 - mov rax,rdx
eu4.exe+97CFE7: 48 C1 E8 3F - shr rax,3F
eu4.exe+97CFEB: 48 03 D0 - add rdx,rax
eu4.exe+97CFEE: 48 63 CA - movsxd rcx,edx
eu4.exe+97CFF1: 8B 53 10 - mov edx,[rbx+10]
eu4.exe+97CFF4: 4D 8B 85 D0 00 00 00 - mov r8,[r13+000000D0]
// ---------- INJECTING HERE ----------
eu4.exe+97CFFB: 41 01 0C 90 - add [r8+rdx*4],ecx
// ---------- DONE INJECTING ----------
eu4.exe+97CFFF: 0F 98 C0 - sets al
eu4.exe+97D002: 84 C0 - test al,al
eu4.exe+97D004: 74 06 - je eu4.exe+97D00C
eu4.exe+97D006: 45 89 24 90 - mov [r8+rdx*4],r12d
eu4.exe+97D00A: EB 12 - jmp eu4.exe+97D01E
eu4.exe+97D00C: 41 81 3C 90 A0 86 01 00 - cmp [r8+rdx*4],000186A0
eu4.exe+97D014: 7E 08 - jle eu4.exe+97D01E
eu4.exe+97D016: 41 C7 04 90 A0 86 01 00 - mov [r8+rdx*4],000186A0
eu4.exe+97D01E: 41 B0 01 - mov r8b,01
eu4.exe+97D021: 48 8B D3 - mov rdx,rbx
}
|
Surrounding instructions:
| Quote: | eu4.exe+97CFD7: 49 8B C7 - mov rax,r15
eu4.exe+97CFDA: 49 F7 E8 - imul r8
eu4.exe+97CFDD: 49 03 D0 - add rdx,r8
eu4.exe+97CFE0: 48 C1 FA 0D - sar rdx,0D
eu4.exe+97CFE4: 48 8B C2 - mov rax,rdx
eu4.exe+97CFE7: 48 C1 E8 3F - shr rax,3F
eu4.exe+97CFEB: 48 03 D0 - add rdx,rax
eu4.exe+97CFEE: 48 63 CA - movsxd rcx,edx
eu4.exe+97CFF1: 8B 53 10 - mov edx,[rbx+10]
eu4.exe+97CFF4: 4D 8B 85 D0 00 00 00 - mov r8,[r13+000000D0]
// ---------- INJECTING HERE ----------
eu4.exe+97CFFB: 41 01 0C 90 - add [r8+rdx*4],ecx
// ---------- DONE INJECTING ----------
eu4.exe+97CFFF: 0F 98 C0 - sets al
eu4.exe+97D002: 84 C0 - test al,al
eu4.exe+97D004: 74 06 - je eu4.exe+97D00C
eu4.exe+97D006: 45 89 24 90 - mov [r8+rdx*4],r12d
eu4.exe+97D00A: EB 12 - jmp eu4.exe+97D01E
eu4.exe+97D00C: 41 81 3C 90 A0 86 01 00 - cmp [r8+rdx*4],000186A0
eu4.exe+97D014: 7E 08 - jle eu4.exe+97D01E
eu4.exe+97D016: 41 C7 04 90 A0 86 01 00 - mov [r8+rdx*4],000186A0
eu4.exe+97D01E: 41 B0 01 - mov r8b,01
eu4.exe+97D021: 48 8B D3 - mov rdx,rbx
|
Hope you mean this
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|