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 


Moving Value into xmm Register

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
realrbn
Expert Cheater
Reputation: 3

Joined: 22 Jan 2016
Posts: 112

PostPosted: Mon Feb 01, 2016 2:40 pm    Post subject: Moving Value into xmm Register Reply with quote

Hey, just a quick question.

I want to move a "Double" Value into a xmm Register.

How would I do that?

The Original Code is:
code:
movsd [esi+00000088],xmm0
jmp return

How can I change it to where it will set a Value of let's say 100 to "[esi+00000088]"?
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Mon Feb 01, 2016 3:33 pm    Post subject: Reply with quote

Code:
label(myvar)

newmem:

code:
  movsd xmm0,[myvar]
  movsd [esi+00000088],xmm0
  jmp return

myvar:
  dq (double)100
Back to top
View user's profile Send private message
Daijobu
Master Cheater
Reputation: 13

Joined: 05 Feb 2013
Posts: 301
Location: the Netherlands

PostPosted: Mon Feb 01, 2016 3:34 pm    Post subject: Reply with quote

MOVSD - Move scalar double-precision floating-point value.

Therefore it moves a 32 bits float value from xmm0 into esi+88.

You can directly move a (float) value into esi+88 in Cheat Engine using for example:

Code:
mov [esi+88],(float)100.0


If you want to modify an SSE register like xmm0 you have to use an intermediary register.

Edit: Zanzer posted as I was typing this. That and I need better glasses. Derp.
Edit 2: My bad, I need glasses and classes.

_________________
Scripts/tables from scratch. Relation to other scripts is coincidental. Use of posted code is credited properly.
Euro Truck Simulator 2 Backwards Compatible Cheat
American Truck Simulator Backwards Compatible Cheat


Last edited by Daijobu on Wed Feb 03, 2016 2:57 am; edited 1 time in total
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Tue Feb 02, 2016 4:24 am    Post subject: Reply with quote

If that value "double" doesn't have fractional part you can use this:
Code:
push eax
mov eax,100
cvtsi2sd xmm0,eax
pop eax



or this (converts single to double):
Code:
push eax
mov eax,(float)123.456
movd xmm0,eax
cvtss2sd xmm0,xmm0
pop eax






mov [esi+88],(double)100.0 - this won't work

_________________
Back to top
View user's profile Send private message MSN Messenger
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Tue Feb 02, 2016 4:53 am    Post subject: Reply with quote

mgr.inz.Player wrote:
mov [esi+88],(double)100.0 - this won't work

Small addition:
This will only work on a 64bit process ...
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Tue Feb 02, 2016 5:47 am    Post subject: Reply with quote

Not in 64-bit either. Most instructions in 64-bit can still only encode 32-bit values.

what does work:
Code:

mov rax,(double)100.0
mov [esi+88],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
realrbn
Expert Cheater
Reputation: 3

Joined: 22 Jan 2016
Posts: 112

PostPosted: Tue Feb 02, 2016 6:20 am    Post subject: Reply with quote

Zanzer wrote:
Code:
label(myvar)

newmem:

code:
  movsd xmm0,[myvar]
  movsd [esi+00000088],xmm0
  jmp return

myvar:
  dq (double)100


Thanks Man, works!
Back to top
View user's profile Send private message
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Tue Feb 02, 2016 8:23 am    Post subject: Reply with quote

Dark Byte wrote:
Not in 64-bit either. Most instructions in 64-bit can still only encode 32-bit values.

Hm, I've already seen something like
Code:
mov qword ptr [register+offset],1234567890

so I thought that can be said for 64bit in general ... Obviously wrong Wink
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