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 access second xmm register value in Assembly

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

Joined: 15 Mar 2021
Posts: 3

PostPosted: Mon Mar 15, 2021 9:59 pm    Post subject: How to access second xmm register value in Assembly Reply with quote

Hey, guys!

I'm creating a hack in assembly that gets the position of the mob the player is aiming at. I'm using inline assembly to call the game function that returns the coordinates (X, Y) of the mobs.

The issue is that i'm stuck with the XMM0 register, which apparently stores both X and Y coordinates. So I'm able to get the X coordinate, but not the Y coordinate.

When I set a breakpoint at the game function, this is what CE shows in the XMM0 register:

Code:
XMM0: 69109.00     82200.00     0.00     0.00
XMM1: 0.00         0.00         0.00     0.00
XMM2: 0.00         0.00         0.00     0.00
XMM3: ...


And this is the assembly code i'm using:

Code:
mov esi, [chrPointer]
mov ecx,[esi]
push mobID
add ecx,04
mov eax,[ecx]
call dword ptr [eax+08]
mov ecx,eax
call GetNameByVIDCall
movss x, xmm0


How can I get the second XMM0 value (82200 in the screenshot) and pass it to a Y variable (like movss y, xmm0)?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Mon Mar 15, 2021 10:54 pm    Post subject: Reply with quote

shufps would work. e.g. if xmm5 isn't in use:
Code:
movaps xmm5,xmm0
movss [x],xmm0
shufps xmm5,xmm5,85
movss [y],xmm5
If xmm0 isn't read from again, it's fine to disregard xmm5 and clobber xmm0.

You could just store the entire register.
Code:
alloc(newmem,2048)
label(coords)
label(x)
label(y)

newmem:
  ...
  movaps [coords],xmm0
  ...

align 10 CC
coords:
x:
  dd (float)0.0
y:
  dd (float)0.0
// padding:
  dd 0 0

_________________
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
theashmaster
How do I cheat?
Reputation: 0

Joined: 15 Mar 2021
Posts: 3

PostPosted: Mon Mar 15, 2021 11:56 pm    Post subject: Reply with quote

ParkourPenguin wrote:
shufps would work. e.g. if xmm5 isn't in use:
Code:
movaps xmm5,xmm0
movss [x],xmm0
shufps xmm5,xmm5,85
movss [y],xmm5
If xmm0 isn't read from again, it's fine to disregard xmm5 and clobber xmm0.


This worked perfectly! Thank you, man!
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