 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
kagato1980 Cheater
Reputation: 0
Joined: 30 Oct 2020 Posts: 30 Location: The netherlands
|
Posted: Tue Nov 03, 2020 3:41 pm Post subject: Compare value in assembly |
|
|
I have the following script:
| Code: |
[ENABLE]
aobscan(INJECT,89 87 A0 00 00 00 8B 47 64) // should be unique
alloc(newmem,$1000)
label(code)
label(return)
newmem:
code:
push ebx
mov ebx,[edi+000000A4]
sub ebx, 50
mov [edi+000000A0],ebx
pop ebx
jmp return
oldcode:
db 89 87 A0 00 00 00
INJECT:
jmp newmem
nop
return:
registersymbol(INJECT)
[DISABLE]
INJECT:
db 89 87 A0 00 00 00
unregistersymbol(INJECT)
dealloc(newmem)
|
This script finds a max value, then replaces the input value to the max value minus 50 (hex).
But for each input, I want to check if our current value is 50 hex away from the end value, and if it is, skip the replacement. Otherwise, the input will always be set to max-50, and the max will never be reached.
So, I think something like this needs to be added at the top inside code:
| Code: |
cmp [edi+000000A0], [edi+000000A4]-50
jle oldcode
|
I suppose that comparison needs to happen through some temp values in registers, can anyone help? |
|
| Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Wed Nov 04, 2020 3:39 am Post subject: |
|
|
| Code: | [ENABLE]
aobscan(INJECT,89 87 A0 00 00 00 8B 47 64) // should be unique
registersymbol(INJECT)
alloc(newmem,$1000)
label(originalcode)
label(return)
newmem:
push ebx
mov ebx,[edi+a4]
sub ebx,50
cmp [edi+a0],ebx
jle originalcode
mov eax,ebx
originalcode:
pop ebx // clean up
mov [edi+A0],eax
jmp return
INJECT:
jmp newmem
nop
return:
[DISABLE]
INJECT:
db 89 87 A0 00 00 00
unregistersymbol(INJECT)
dealloc(newmem) |
_________________
I'm rusty and getting older, help me re-learn lua. |
|
| Back to top |
|
 |
kagato1980 Cheater
Reputation: 0
Joined: 30 Oct 2020 Posts: 30 Location: The netherlands
|
Posted: Thu Nov 05, 2020 3:45 am Post subject: |
|
|
Thanks, I managed to get it to work with a little change:
| Code: |
code:
push ebx
mov ebx,[edi+A4]
sub ebx, 50
cmp eax,ebx
jge originalcode
mov eax,ebx
originalcode:
pop ebx
mov [edi+A0],eax
jmp return
|
|
|
| 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
|
|