Assembly code injection not running as intended, cmp does not evaluate as expected

106 Views Asked by At

I am attempting to write a small script with cheat engine to avoid the damage registration while keeping it for enemies, but I'm running into trouble. The code that avoids updating health after taking damage works properly, but if I include the cmp and jne lines it always jumps to the original code:

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem: //this is allocated memory, you have read,write,execute access
//place your code here

cmp [edi+B08],1 // this is not passing
jne originalcode

add [esi+48],500
jmp exit

originalcode:

movsd [esi+48],xmm1


exit:
jmp returnhere

"noita.exe"+589231:
jmp newmem
returnhere:


 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"noita.exe"+589231:
db F2 0F 11 4E 48
//movsd [esi+48],xmm1

I got the value of [edi+B08] from this scan which I may be using improperly:

The initial scan to find memory address and value

I scanned the different addresses to find an offset that I could use and [EDI+B08] seems like it would work (could compare it against 1 to isolate my health from enemies health). However, it is not passing the cmp [edi+B08],1 \

If anyone has any idea why this isn't working I would be very appreciative.

0

There are 0 best solutions below