 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
grasmanek94 Master Cheater
Reputation: 0
Joined: 03 Jun 2008 Posts: 283 Location: The Netherlands
|
Posted: Sun Sep 22, 2013 9:22 am Post subject: Code injection crashes [float operations] |
|
|
I'm trying to inject some code which will make the "health"of all my weapons "100.0" (max).
So, I have found out what writes to the addresses:
| Code: | "Shock2.exe"+54A43:
fstp dword ptr [ecx+04]
mov ecx,[esp] |
so, It's a little confusing what's going on here but it seems the mov instruction set's the weapon durability, right? So I tried the following things:
| Code: | newmem: //this is allocated memory, you have read,write,execute access
fstp dword ptr [ecx+04]
mov esp,42C80000 ; (float)100.0 in hex
mov ecx,[esp]
jmp exit |
and
| Code: | newmem: //this is allocated memory, you have read,write,execute access
fstp dword ptr [ecx+04]
mov ecx,42C80000
jmp exit |
Which gives the resulting script:
| Code: | [ENABLE]
alloc(newmem,2048)
label(returnhere)
newmem: //this is allocated memory, you have read,write,execute access
fstp dword ptr [ecx+04]
mov esp,42C80000
mov ecx,[esp]
jmp returnhere
"Shock2.exe"+54A43:
jmp newmem
nop
returnhere:
[DISABLE]
dealloc(newmem)
"Shock2.exe"+54A43:
fstp dword ptr [ecx+04]
mov ecx,[esp] |
but it crashes as soon as the weapon health decreases, what's wrong here?
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25858 Location: The netherlands
|
Posted: Sun Sep 22, 2013 9:55 am Post subject: |
|
|
this code:
| Code: |
mov esp,42C80000
mov ecx,[esp]
|
will try to read the value at address 42c80000 and store that value into ECX
Try this instead:
| Code: |
fstp dword ptr [ecx+04]
mov [ecx+4],(float)100
mov ecx,[esp]
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
grasmanek94 Master Cheater
Reputation: 0
Joined: 03 Jun 2008 Posts: 283 Location: The Netherlands
|
Posted: Mon Sep 23, 2013 6:32 am Post subject: |
|
|
Yep, totally works
|
|
| 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
|
|