Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Code injection crashes [float operations]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
grasmanek94
Master Cheater
Reputation: 0

Joined: 03 Jun 2008
Posts: 283
Location: The Netherlands

PostPosted: Sun Sep 22, 2013 9:22 am    Post subject: Code injection crashes [float operations] Reply with quote

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
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25858
Location: The netherlands

PostPosted: Sun Sep 22, 2013 9:55 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
grasmanek94
Master Cheater
Reputation: 0

Joined: 03 Jun 2008
Posts: 283
Location: The Netherlands

PostPosted: Mon Sep 23, 2013 6:32 am    Post subject: Reply with quote

Yep, totally works Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites