| View previous topic :: View next topic |
| Author |
Message |
Winsane Newbie cheater
Reputation: 0
Joined: 12 Mar 2016 Posts: 12
|
Posted: Wed Mar 16, 2016 2:54 pm Post subject: Increasing 64 bit value in script |
|
|
Hello again!
I'm making a script that moves the enemies in a game to the player, and with some help I have a script that works very well. What I want to do now is to add some distance between the player and where the enemies end up.
I thought that just increasing the X value a bit before adding it to xmm0 would be easy, but I'm running into all kinds of problems.
This is the script:
| Code: | [ENABLE]
label(_xaxis)
[[[[["THREADSTACK0"-00000864]+618]+4]+5C0]+58C]+78:
_xaxis:
aobscan(HorizontalVac,8C DD 5D 80 F3 0F 7E 4D 80) // should be unique
alloc(newmem,$1000)
label(code)
label(return)
newmem:
code:
movq xmm0,[_xaxis]
jmp return
HorizontalVac+04:
jmp code
return:
registersymbol(HorizontalVac)
[DISABLE]
HorizontalVac+04:
db F3 0F 7E 4D 80
unregistersymbol(HorizontalVac)
dealloc(newmem) |
[_xaxis] holds a 64 bit value, and in "double" the value is in the 0-3000 range.
I thought I could move it to eax, do "add eax, 80" and then move it to xmm0, but that doesn't seem to work at all, maybe because of the 64 bit part?
I'm going to continue tinkering with it, but hopefully someone can tell me what I'm doing wrong before I go mad, haha..
|
|
| Back to top |
|
 |
hhhuut Grandmaster Cheater
Reputation: 6
Joined: 08 Feb 2015 Posts: 607
|
Posted: Wed Mar 16, 2016 3:08 pm Post subject: |
|
|
If I understand that correctly the value is a double, so adding a integer 80 (resp. 0x80) will only add a pretty tiny bit to it
Try something like that instead (not tested of course):
| Code: | fld qword ptr [_xaxis]
mov qword ptr [_xaxis],(double)80
fadd qword ptr [_xaxis]
fstp qword ptr [_xaxis] |
|
|
| Back to top |
|
 |
Winsane Newbie cheater
Reputation: 0
Joined: 12 Mar 2016 Posts: 12
|
Posted: Wed Mar 16, 2016 3:28 pm Post subject: |
|
|
| hhhuut wrote: | If I understand that correctly the value is a double, so adding a integer 80 (resp. 0x80) will only add a pretty tiny bit to it
Try something like that instead (not tested of course):
| Code: | fld qword ptr [_xaxis]
mov qword ptr [_xaxis],(double)80
fadd qword ptr [_xaxis]
fstp qword ptr [_xaxis] |
|
It says "mov qword ptr [_xaxis],(double)80" can't be compiled
|
|
| Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4717
|
Posted: Wed Mar 16, 2016 4:03 pm Post subject: |
|
|
Integers aren't floating point numbers.
| Code: | label(xDist)
newmem:
code:
movq xmm0,[_xaxis]
addsd xmm0,[xDist]
jmp return
xDist:
dq (double)80
|
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
| Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 959
|
Posted: Wed Mar 16, 2016 4:10 pm Post subject: |
|
|
Try
| Code: |
fld qword ptr [_xaxis]
mov dword ptr [_xaxis],(float)80
fadd dword ptr [_xaxis]
fstp qword ptr [_xaxis]
// or
int80:
dd #80
float80:
dd (float)80
fld qword ptr [_xaxis]
fadd dword ptr [float80] // load 4 bytes float
fstp qword ptr [_xaxis]
// or
fild dword ptr [int80] // load 4 bytes integer
fadd qword ptr [_xaxis]
fstp qword ptr [_xaxis]
|
The fpu internally use 10 byte extended double format (tword ptr) anyway , loading a constant of qword or dword has negligible or no difference (small whole number will be exact).
_________________
- Retarded.
Last edited by panraven on Wed Mar 16, 2016 4:38 pm; edited 1 time in total |
|
| Back to top |
|
 |
Winsane Newbie cheater
Reputation: 0
Joined: 12 Mar 2016 Posts: 12
|
Posted: Wed Mar 16, 2016 4:28 pm Post subject: |
|
|
| ParkourPenguin wrote: | Integers aren't floating point numbers.
| Code: | label(xDist)
newmem:
code:
movq xmm0,[_xaxis]
addsd xmm0,[xDist]
jmp return
xDist:
dq (double)80
|
|
Thanks a lot!
|
|
| Back to top |
|
 |
|