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 


How to deal with floating-point variable?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> Auto Assembler tutorials
View previous topic :: View next topic  
Author Message
Yo4
How do I cheat?
Reputation: 0

Joined: 24 Jun 2019
Posts: 1

PostPosted: Mon Jun 24, 2019 10:29 pm    Post subject: How to deal with floating-point variable? Reply with quote

Hello everyone. I have a little problem with floating-point value. I want to make aim-like hack in Assault Cube. Here is my code:

Code:
alloc(newmem,1024)

newmem:
 mov ecx, [ac_client.exe+10F4F4]  // move address into ecx
 fld [ecx+3C]                  // push value in address [ecx+3C] onto FPU stack
 fadd 4.5                         // here all (mainly) errors pop out
 fst [ac_client.exe+10A408] //move value from st(0) to sight Z-dim address

"ac_client.exe"+6FFA:
jmp newmem
nop


In that code I send my hero Z-dimension value, add 4.5 to that because my head is situated on 4.5 higher. And the last I move that increased value into sight Z-dimension.
So, my question - what to do with that floating-point liberal "4.5"? Perhaps I can declare it with labels and registersymbol or I can do that without FPU registers or somehow else?
I hope I've explained well. In advance, thank you very, very much for answer.
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 28

Joined: 13 Sep 2011
Posts: 1476

PostPosted: Tue Jun 25, 2019 12:26 pm    Post subject: Reply with quote

use xmm registers instructions
Code:

label(myValue)
registersymbol(myValue)

newmem:
mov ecx,[ac_client.exe+10F4F4]
movss xmm0,[ecx+3c]
movss xmm1,[myValue]
addss xmm0,xmm1
movss [ecx+3c],xmm0

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
Roogue
Newbie cheater
Reputation: 0

Joined: 31 May 2019
Posts: 14

PostPosted: Wed Jun 26, 2019 12:08 pm    Post subject: Re: How to deal with floating-point variable? Reply with quote

Once you have your player Z value + 4.5 and all the things you want to do in the FPU register (in ST(0) ), you can do the following code :

Code:

sub esp,4 
fstp dword [esp] // load ST(0) in top of the stack
mov edx, [esp] // top of the stack -> edx
add esp, 4


Then, you got in the EDX register your modified Z value.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> Auto Assembler tutorials 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