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 


Problem with auto assemble float and double

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
CassiOwOpeia
Newbie cheater
Reputation: 0

Joined: 29 Nov 2018
Posts: 18
Location: France

PostPosted: Thu Nov 29, 2018 12:03 pm    Post subject: Problem with auto assemble float and double Reply with quote

Hi all
I have a problem. For training I use auto assemble with Cheat Engine Tutorial.
Code:
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem: //this is allocated memory, you have read,write,execute access
mov [esi+00000494],(float)5000

originalcode:
//fstp dword ptr [esi+00000494]

exit:
jmp returnhere

01610006:
jmp newmem
nop
returnhere:


 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
01610006:
fstp dword ptr [esi+00000494]
//Alt: db D9 9E 94 04 00 00

I don't have problem ^^^^ with float, it work !
But with double I can't do it.
Code:
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem: //this is allocated memory, you have read,write,execute access
mov [ebx+00000498],(double)5000

originalcode:
//fstp qword ptr [ebx+00000498]

exit:
jmp returnhere

"Tutorial-i386.exe"+24963:
jmp newmem
nop
returnhere:


 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"Tutorial-i386.exe"+24963:
fstp qword ptr [ebx+00000498]
//Alt: db DD 9B 98 04 00 00


If you can, please I would like to merge the two scripts
Thanks ^^ Laughing
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Thu Nov 29, 2018 1:38 pm    Post subject: Reply with quote

A double is 8 bytes, you are trying to store it into a 4 byte address. If the game doesn't make use of a double for that type, you can't force it to use one like that.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1586

PostPosted: Thu Nov 29, 2018 5:52 pm    Post subject: Reply with quote

double is 8bytes long, and your process is 32bit so no imm64 operands.

CE will assemble "mov [ebx+00000498],(double)5000" as "00000000" thats why its not working.

double 5000 in hex is 40B3880000000000, and its stored in memory the way little-endian works.

either use FPU x87 instruction set, or use two MOV instructions. (remember to modify the offset and the source operand)

_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote:
i am a sweetheart.
Back to top
View user's profile Send private message Visit poster's website
CassiOwOpeia
Newbie cheater
Reputation: 0

Joined: 29 Nov 2018
Posts: 18
Location: France

PostPosted: Fri Nov 30, 2018 7:38 am    Post subject: Reply with quote

Thanks for the answer and if I write qword it work ?
Back to top
View user's profile Send private message
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1586

PostPosted: Fri Nov 30, 2018 7:32 pm    Post subject: Reply with quote

TheFireAnubis wrote:
Thanks for the answer and if I write qword it work ?

no qword for data movement instructions in 32bit processes, except FPU x87.

here are two examples:
Code:
mov dword ptr [ebx+00000498],00000000
mov dword ptr [ebx+0000049C],40B38800

originalcode:
fstp st(0) // you have to pop fpu register stack '0'

exit:
jmp returnhere


Code:
label(value)

newmem:
fld qword ptr [value] // instead of loading whatever in [ebp-08], load whatever in "value"

originalcode:
// fld qword ptr [ebp-08] // replaced with "value"
// fsubr qword ptr [ebx+00000498]

exit:
jmp returnhere

value:
dq (double)5000.00 // value to be loaded

_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote:
i am a sweetheart.
Back to top
View user's profile Send private message Visit poster's website
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