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 


Increasing 64 bit value in script

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Winsane
Newbie cheater
Reputation: 0

Joined: 12 Mar 2016
Posts: 12

PostPosted: Wed Mar 16, 2016 2:54 pm    Post subject: Increasing 64 bit value in script Reply with quote

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
View user's profile Send private message
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Wed Mar 16, 2016 3:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
Winsane
Newbie cheater
Reputation: 0

Joined: 12 Mar 2016
Posts: 12

PostPosted: Wed Mar 16, 2016 3:28 pm    Post subject: Reply with quote

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 Confused
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4717

PostPosted: Wed Mar 16, 2016 4:03 pm    Post subject: Reply with quote

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
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 959

PostPosted: Wed Mar 16, 2016 4:10 pm    Post subject: Reply with quote

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
View user's profile Send private message
Winsane
Newbie cheater
Reputation: 0

Joined: 12 Mar 2016
Posts: 12

PostPosted: Wed Mar 16, 2016 4:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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