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 


Multiplying a Float Before Storing It

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Artem111
How do I cheat?
Reputation: 0

Joined: 01 Jun 2018
Posts: 2

PostPosted: Fri Jun 01, 2018 8:19 am    Post subject: Multiplying a Float Before Storing It Reply with quote

Let's say I have something like
Code:
  fstp dword ptr [esi+0000019C]
  jmp return

How do I get it to multiply the float value by 5 before it stores it?
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Fri Jun 01, 2018 2:44 pm    Post subject: Reply with quote

iirc this will work
Code:
push (float)5
fmul dword ptr [esp]
add esp, 4 // add rsp, 8? I think x64 always does 8 byte push not 4...
fstp dword ptr [esi+0000019C]
jmp return

You can't just say fmul 5 unfortunately, you have to store the value you want to multiply by somewhere, in the code above you just push it on the stack, read from the stack, and then remove the value from the stack (pop would be easier if x64 does always do 8 byte pushes but it'd require having a register you don't mind overwriting)

_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
Artem111
How do I cheat?
Reputation: 0

Joined: 01 Jun 2018
Posts: 2

PostPosted: Sat Jun 02, 2018 8:05 am    Post subject: Reply with quote

FreeER wrote:
iirc this will work
Code:
push (float)5
fmul dword ptr [esp]
add esp, 4 // add rsp, 8? I think x64 always does 8 byte push not 4...
fstp dword ptr [esi+0000019C]
jmp return

You can't just say fmul 5 unfortunately, you have to store the value you want to multiply by somewhere, in the code above you just push it on the stack, read from the stack, and then remove the value from the stack (pop would be easier if x64 does always do 8 byte pushes but it'd require having a register you don't mind overwriting)


It does work but it doesn't seem to do what I wanted it to do.
Is doing that on the player speed address a bad way to move faster?
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Sat Jun 02, 2018 8:19 am    Post subject: Reply with quote

Would work in some games fine, apparently not in that one /shrug
_________________
https://github.com/FreeER/ has a few CE related repos
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