How to move value into XMM register?

Memory scanning, code injection, debugger internals and other gamemodding related discussion
Post Reply
SantiagoJaxson
What is cheating?
What is cheating?
Posts: 1
Joined: Mon Sep 14, 2020 8:42 am
Reputation: 0

How to move value into XMM register?

Post by SantiagoJaxson »

Hello People!

I have a problem, don't know how to make a working script.

I know that EAX is currently holding value. But I found that the instruction for eax is: movd eax,xmm6. Does it mean that xmm6 which stored value is moving to EAX? If yes, how to write a correct script for moving value into XMM6 register?? I want to put a 4-byte value into XMM6 register.

I am waiting for your advices,

Thanks.[Link]
Last edited by SantiagoJaxson on Tue Sep 15, 2020 5:30 am, edited 1 time in total.

User avatar
Chucky
Expert Cheater
Expert Cheater
Posts: 57
Joined: Thu Mar 08, 2018 4:01 pm
Reputation: 16

Re: How to move value into XMM register?

Post by Chucky »

Code: Select all

aobscanmodule(INJECT, Game.exe, AOB)
alloc(newmem,$1000, "Game.exe"+offset)

alloc(MyMem, 4)

MyMem:
//float
  dd (float)100

MyMem+4:
//double
  dq (double)1

label(code)
label(return)

newmem:
code:
  // move float
  movss xmm6,[MyMem]
  
  // move double
  movsd xmm6,[MyMem+4]
  jmp return

INJECT:
  jmp newmem
return:
registersymbol(INJECT)

[DISABLE]
INJECT:
  db origBites

unregistersymbol(INJECT)
dealloc(newmem)
Converting values:

User avatar
Negan
Cheater
Cheater
Posts: 30
Joined: Fri Jul 24, 2020 5:02 am
Reputation: 8

Re: How to move value into XMM register?

Post by Negan »

I know 2 ways to do this. One is already posted above, but I will still post my own version since its slightly different than Chucky's.

1st way:

Code: Select all

  push eax
  mov eax,(float)200        // for moving a 4 byte value just use #200 instead of (float)200
  movd xmm0,eax
  pop eax
  movss [ecx+00000E9C],xmm0
  jmp return
2nd way:

Code: Select all

alloc(fullHealth,4) 

code:
  movss xmm0,[fullHealth]
  movss [ecx+00000E9C],xmm0
  jmp return

fullHealth:                      // Let’s say we’re moving a float value
  dd (float)200 

dealloc(fullHealth)

Post Reply

Who is online

Users browsing this forum: No registered users