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 


Help with modify both lower and higher part of xmm register

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

Joined: 23 Feb 2021
Posts: 3

PostPosted: Wed Feb 24, 2021 12:31 am    Post subject: Help with modify both lower and higher part of xmm register Reply with quote

Hello, I was trying to modify a character's stats in a game, and I found the game pass the value in xmm0 register.

Example: xmm0:01BF _ 016E _ 013E _ 0158 _ 001F _ 0013 _ 0055 _ 0005

The original code is:
Code:

  movups [ebx+10],xmm0
  jmp return


So, I would like to know is there any method to modify every value of xmm0?
I had tried with:
Code:

  push eax
  mov eax,270F270F
  movd xmm0,eax
  movlhps xmm0,xmm0
  pop eax


Yet, this only change the first two value of lower and higher part of xmm0 register. The result of code above is:
xmm0:270F _ 270F _ 0000 _ 0000 _ 270F _ 270F _ 0000 _ 0000
Any way to change the third and forth value in xmm register? Now there are 4 values in my character stats become 0. Neutral

Thank you for any advice.

Edit: Add the result of xmm0 after my code injected.
Back to top
View user's profile Send private message
sbryzl
Master Cheater
Reputation: 6

Joined: 25 Jul 2016
Posts: 252

PostPosted: Wed Feb 24, 2021 9:26 am    Post subject: Reply with quote

push eax
mov eax,270F270F
movd xmm0,eax
pshufd xmm0,xmm0,0
pop eax
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4290

PostPosted: Wed Feb 24, 2021 12:13 pm    Post subject: Reply with quote

There's a pinsr* set of instructions.
Code:
mov     eax,1234
pinsrw  xmm0,eax,1
mov     eax,CDEF
pinsrw  xmm0,eax,2

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

Joined: 23 Feb 2021
Posts: 3

PostPosted: Wed Feb 24, 2021 9:37 pm    Post subject: Reply with quote

Thank you, sbryzl and Penguin, for replying me.

I able to inject the code suggested by sbryzl and it does what I want, I successfully max all my character's attribute now.

I would like to use the pinsr* instruction set suggested by Penguin too since it is more flexible and allow me to choose the stat that I want to max.
However, I tried pinsrq, pinsrd, pinsrw and pinsrb instructions like the example given by Penguin, but only pinsrb instruction able to be compiled.

Anyway, thanks again for the reply and suggestion.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4290

PostPosted: Thu Feb 25, 2021 12:01 am    Post subject: Reply with quote

From what I see on git, pinsrw has been around for 10 years, and the others were added 3 years ago. It should work fine (can't test it myself)

What is the exact script you're trying to assemble?

_________________
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
MMM-304
Expert Cheater
Reputation: 0

Joined: 17 Aug 2020
Posts: 166
Location: Milkey Way

PostPosted: Thu Feb 25, 2021 12:23 am    Post subject: Reply with quote

pinsr* set is currently incompatilbe with CE assembler, you can use insertps, but it allows dword (float), not a word or byte
Code:

  push 270F270F
  insertps xmm0,[esp],20 //for 3rd
  insertps xmm0,[esp],30 //for 4rd
  add esp,4
Back to top
View user's profile Send private message
Leondyssey
How do I cheat?
Reputation: 0

Joined: 23 Feb 2021
Posts: 3

PostPosted: Thu Feb 25, 2021 1:23 am    Post subject: Reply with quote

Penguin, here is my code when I tried to use pinsrw/pinsrd/pinsrq:
Code:
mov eax,270F
pinsrw xmm0,eax,3


When I pressed 'OK' button, warning message poped out, said "Not all code is injectable. (Error in line 19 (pinsrw xmm0,eax,3): This instruction can't be compiled)

I am currently using the code below to adjust certain attribute of my character:
Code:
mov eax,0F
pinsrb xmm0,eax,5
mov eax,27
pinsrb xmm0,eax,6


MMM-304, thank you for sharing your code, it is more simple and easy to understand compare to my code. Surprised
But what is the last line used for?
Code:
add esp,4


Edit: Oh, I think I know the usage of add esp,4 now. Thank you everyone, I learned a lot from all of you. Very Happy
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Thu Feb 25, 2021 5:28 am    Post subject: Reply with quote

Nvm, I misread OP's post, my response is not replace part of the xmm0 but whole.

May be ...
Code:

lea    rsp,[rsp-10]
MOVDQU [rsp],XMM0  /// save
  mov  dword ptr[rsp+08],#1000    /// 00 ->1st 4bytes, 04->2nd, 08->3rd, 0c->4th
  mov  dword ptr[rsp+0c],(float)4.5 
MOVDQU XMM0,[rsp]  /// load
lea    rsp,[rsp+10]


---------------
Not tested.
Code:

...
movaps xmm0,[@f]
jmp    short @f+10
align 10  //// need align 16bytes boundary
@@:
dd #1000, (float)4.5   /// the 128bit/16bytes xmm structure
dq (double)0.123
... // continue other asm

Use a named label (make sure it align 16bytes boundary) so not need the jmp and mess with the disassembly display.

With MOVDQU don't care align.

_________________
- Retarded.
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