tigerite How do I cheat?
Reputation: 0
Joined: 16 May 2007 Posts: 9
|
Posted: Thu May 17, 2007 3:06 am Post subject: Please help with floating point comparison/multiplication |
|
|
I'm really struggling to get a hack to work based on a flash game, via Opera. Because of the ever-changing address problem I have to work with NPSWF32.dll, and it's no problem with normal 4-byte values, but with doubles I'm having a nightmare. No matter what I seem to do it seems to crash! Here's my latest script:
| Code: |
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048) //2kb should be enough
alloc(currvalue,4)
alloc(multifact,4)
label(returnhere)
label(storeregs)
label(compvalue)
label(domultiply)
label(restoreregs)
label(originalcode)
label(exit)
currvalue:
db 0
multifact:
db 0A
NPSWF32.dll+42EC0:
jmp newmem
returnhere:
newmem: //this is allocated memory, you have read,write,execute access
storeregs:
push esi
push edi
compvalue:
fist dword ptr [currvalue]
cmp [currvalue],01AE
jne restoreregs
domultiply:
fild dword ptr [multifact]
fmulp
restoreregs:
pop edi
pop esi
originalcode:
fstp [esi+08]
mov eax,[edi]
exit:
jmp returnhere
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem) //free memory
dealloc(currvalue)
dealloc(multifact)
NPSWF32.dll+42EC0:
fstp [esi+08]
mov eax,[edi]
|
Basically my idea is to store esi and edi, just in case they're changed, take what's in ST(0) and make it into an integer, compare that integer with 430 (1AEh), if it's not equal return the esi and edi and then back to execution, otherwise multiply the value by 10 (so it becomes 4300) and then return. Can anyone see anything obviously wrong with my approach? I'm flummoxed at the moment, but then again I've only just started with assembler, so it's probably something really obvious..
EDIT: I'd forgotten to dealloc the currvalue and multifact values, so I've added those too - still crashes though :(
I've also tried using fcom/fcomp but couldn't get that to work for the life of me either without crashing. Is there any way to debug an AA script?
EDIT2: Sorry for putting it in the wrong place originally. I wasn't sure whether to put it here or in the tutorials section for AA specifically.
|
|