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 


AA write double to address [SOLVED]

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

Joined: 30 Aug 2014
Posts: 5
Location: Johannesburg, South Africa

PostPosted: Sat Dec 28, 2019 4:07 pm    Post subject: AA write double to address [SOLVED] Reply with quote

Hi All,

This is probably a stupid question but I can't find anything through the search.

When I use the following in my script:
mov [rbx+00000820],(int)5000 becomes mov [rbx+00000820],00001388
mov [rbx+00000820],(float)5000 becomes mov [rbx+00000820],459C4000

But (double)5000 becomes 0
mov [rbx+00000820],(double)5000 becomes mov [rbx+00000820],00000000

Am I doing something wrong that (double) won't work this way?

Extra Info:
Using Cheat Engine 7.0, Step 4 of the 64 bit tutorial for Ammo


Last edited by Maniac088 on Sun Dec 29, 2019 2:19 am; edited 1 time in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 380

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

PostPosted: Sat Dec 28, 2019 9:11 pm    Post subject: Reply with quote

you can only use (double) on instructions that can take a direct full 64 bit value
those are:
Code:

dq (double) xxx

and
Code:

mov Rreg,(double)xxx

and that's it, no other instruction supports a direct 64 bit value

what you can do is:
Code:

push rax
mov rax,(double)5000
mov [rbx+00000820],rax
pop rax

_________________
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
ParkourPenguin
I post too much
Reputation: 80

Joined: 06 Jul 2014
Posts: 2701

PostPosted: Sat Dec 28, 2019 9:21 pm    Post subject: Reply with quote

Doubles are 8 bytes in size. There are very few instructions that take 8-byte immediates- that form of the mov instruction is not one of them. Instead of giving an error, CE just truncates the upper half of the value, leaving you with the lower half (i.e. 0).

Do something else:
Code:
// make sure rax is not in use
mov rax,(double)5000
mov [rbx+820],rax

Or:
Code:
// your code
newmem:
  // pick an xmm register not in use
  movsd xmm0,[myValue]
  movsd [rbx+820],xmm0

// allocated somewhere else
newmem+500:
myValue:
  dq (double)5000

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Maniac088
How do I cheat?
Reputation: 0

Joined: 30 Aug 2014
Posts: 5
Location: Johannesburg, South Africa

PostPosted: Sun Dec 29, 2019 2:18 am    Post subject: Reply with quote

Dark Byte wrote:
you can only use (double) on instructions that can take a direct full 64 bit value
those are:
Code:

dq (double) xxx

and
Code:

mov Rreg,(double)xxx

and that's it, no other instruction supports a direct 64 bit value

what you can do is:
Code:

push rax
mov rax,(double)5000
mov [rbx+00000820],rax
pop rax


@Dark Byte, Thank you for the help and explanation. It never crossed my mind that is the problem, just thought I'm working in 64 bits it should work.


ParkourPenguin wrote:
Doubles are 8 bytes in size. There are very few instructions that take 8-byte immediates- that form of the mov instruction is not one of them. Instead of giving an error, CE just truncates the upper half of the value, leaving you with the lower half (i.e. 0).

Do something else:
Code:
// make sure rax is not in use
mov rax,(double)5000
mov [rbx+820],rax

Or:
Code:
// your code
newmem:
  // pick an xmm register not in use
  movsd xmm0,[myValue]
  movsd [rbx+820],xmm0

// allocated somewhere else
newmem+500:
myValue:
  dq (double)5000


@ParkourPenguin Thank you for your help as well and expanding on Dark Byte's post. I will need to keep that truncation in mind.
I actually came pretty close to your memory allocation code but got frustrated.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 380

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

PostPosted: Sun Dec 29, 2019 3:38 am    Post subject: Reply with quote

Also, I see this often:
Code:

// allocated somewhere else
newmem+500:
myValue:
  dq (double)5000


You can also do:
Code:

alloc(myValue,8)
myValue:
dq (double)5000


that way you don't have to make sure your script is less than 1280 bytes and CE will put it in the same block anyhow

_________________
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
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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