Double to xmm?

Memory scanning, code injection, debugger internals and other gamemodding related discussion
Post Reply
User avatar
Kalas
Posts: 106
Joined: Fri Mar 03, 2017 9:49 am
Reputation: 2

Double to xmm?

Post by Kalas » Fri Mar 17, 2017 6:27 pm

How do I move double value to this address: movsd [rsi+00000590],xmm0

I would assume I need to dq (double)9999999

And then movq xmm0, value


Code: Select all

alloc(value,4)

value:
  dq (double) 9999999

code:
  movq xmm0,[value]
Is this right?

User avatar
Kalas
Posts: 106
Joined: Fri Mar 03, 2017 9:49 am
Reputation: 2

Re: Double to xmm?

Post by Kalas » Fri Mar 17, 2017 6:37 pm

Ok Tested it it works, sorry for this useless post, I just wanted to make sure :)

FreeER
Posts: 13
Joined: Fri Mar 10, 2017 7:11 pm
Reputation: 0
Contact:

Re: Double to xmm?

Post by FreeER » Fri Mar 17, 2017 7:09 pm

You could also use hook the code and insert movsd xmm0, [value] before the movsd [rsi...] or if you had a pointer path something like

Code: Select all

[ENABLE]
[[["game.exe"+35DF]+4]+12]: // pointer path
  dq (double)999999 // write the double 999999
[DISABLE]
// do nothing
hm, not certain if that works with symbols in place of "game.exe", eg. having a registered symbol to some place in memory that you store the address of the player's base address... probably but I can't remember doing it before.

You could also do it in 2 4 byte portions, eg. Go to http://www.binaryconvert.com/convert_double.html and find the hexadecimal value for 999999 which is 412E847E 00000000 and write code like this:

Code: Select all

mov [rsi+590], 00000000
mov [rsi+594], 412E847E
note that the second byte (usually 0 for whole numbers) goes in the first half, that's because Little Endian format puts the least significant bytes first.

There are, of course, other methods but most are probably variations on these.
Last edited by FreeER on Fri Mar 17, 2017 7:26 pm, edited 3 times in total.

User avatar
Kalas
Posts: 106
Joined: Fri Mar 03, 2017 9:49 am
Reputation: 2

Re: Double to xmm?

Post by Kalas » Fri Mar 17, 2017 7:19 pm

Yea but I rather stick with this right now thank you though for sharing your knowledge :)

User avatar
TheyCallMeTim13
Posts: 34
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 1

Re: Double to xmm?

Post by TheyCallMeTim13 » Fri Mar 17, 2017 9:35 pm

You are allocating 4 bytes and writing 8 bytes, try:

Code: Select all

alloc(value,8)

value:
  dq (double)9999999

code:
  movq xmm0,[value]

User avatar
Kalas
Posts: 106
Joined: Fri Mar 03, 2017 9:49 am
Reputation: 2

Re: Double to xmm?

Post by Kalas » Fri Mar 17, 2017 10:14 pm

hmm works with 4, what do you mean I'm writting 8 byte

Like 00000590 - 8 bytes here?

Matze500
Posts: 4
Joined: Fri Mar 17, 2017 1:42 am
Reputation: 0

Re: Double to xmm?

Post by Matze500 » Fri Mar 17, 2017 10:17 pm

The size of double is 8 byte. For a 4 byte vlaue you can use float instead of double or fix your alloc.

Greets Matze

User avatar
Kalas
Posts: 106
Joined: Fri Mar 03, 2017 9:49 am
Reputation: 2

Re: Double to xmm?

Post by Kalas » Fri Mar 17, 2017 10:21 pm

Oh I understand, ok so using Double is 8 byte, thank you :)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests