 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Yo4 How do I cheat?
Reputation: 0
Joined: 24 Jun 2019 Posts: 1
|
Posted: Mon Jun 24, 2019 10:29 pm Post subject: How to deal with floating-point variable? |
|
|
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 |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Tue Jun 25, 2019 12:26 pm Post subject: |
|
|
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 |
_________________
I'm rusty and getting older, help me re-learn lua. |
|
Back to top |
|
 |
Roogue Newbie cheater
Reputation: 0
Joined: 31 May 2019 Posts: 14
|
Posted: Wed Jun 26, 2019 12:08 pm Post subject: Re: How to deal with floating-point variable? |
|
|
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 |
|
 |
jgoemat Master Cheater
Reputation: 22
Joined: 25 Sep 2011 Posts: 260
|
Posted: Fri Jan 31, 2020 8:10 pm Post subject: |
|
|
There's no instruction to add a constant value:
https://c9x.me/x86/html/file_module_x86_id_81.html
In CE you can specify a constant float with `(float)4.5`. So you need to put that somewhere one of the instructions can access it. One option is to put it on the stack:
Code: | fld dword ptr [ecx] // load value to add 4.5 to
sub esp,4 // make room on the stack
mov [esp],(float)4.5 // move the floating point value 4.5 into the new space
fadd dword ptr [esp] // add value at [esp] to st(0) and leave in st(0)
add esp,4 // get rid of temp space on the stack
fstp dword ptr [mem] |
Note the P on fstP also. You loaded a value into the FPU so that will pop your value off when it stores it. If you don't do that, you're messing with what's in the FPU and could mess up the program.
I agree with DaSpammer that xmm would be better. I'd save the values though:
Code: | push ecx
sub esp,8
movss [esp+4],xmm1
mov [esp],(float)4.5
mov ecx,[ac_client.exe+10F4F4]
movss xmm1,[ecx+3C]
addss xmm1,[esp]
movss [ac_client.exe+10A408],xmm1
movss xmm1,[esp+4]
add esp,8
pop ecx |
pop ecx
|
|
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
|
|