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 


Issue with comparing doubles

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Kronogenics
Advanced Cheater
Reputation: 0

Joined: 01 Dec 2016
Posts: 82

PostPosted: Fri Dec 16, 2016 8:07 am    Post subject: Issue with comparing doubles Reply with quote

I have looked around at some other topics that have answers and put them to use, they do seem to be what I am looking for but it's not working the way I intended.
Code:

label(code)
label(velocityCheck)
label(newVelocity)
label(lockVelocity)
label(return)
registersymbol(INJECT)

newmem:

code:
   addsd xmm0,xmm1
    movsd [velocityCheck],xmm0
    push rcx
    mov rcx,[newVelocity]
    cmp [velocityCheck],rcx
    pop rcx
    jge lockVelocity
   movsd [ecx],xmm0
   jmp return

lockVelocity:
    movsd xmm0,[newVelocity]
   movsd [ecx],xmm0
   jmp return

velocityCheck:
    dq 0

newVelocity:
    dq (double)4.0

INJECT:
   jmp code
   db 90 90 90

return:


[DISABLE]

INJECT:
   addsd xmm0,xmm1
   movsd [ecx],xmm0

unregistersymbol(INJECT)
dealloc(newmem)


This is what I have done and it always jumps to lockVelocity even when the velocity is lower than 4.0.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Fri Dec 16, 2016 8:54 am    Post subject: Reply with quote

Code:
code:
  addsd xmm0,xmm1
  movsd xmm1,[newVelocity]
  comisd xmm0,xmm1
  jnb lockVelocity
  movsd [ecx],xmm0
lockVelocity:
  movsd [ecx],xmm1
Back to top
View user's profile Send private message
Kronogenics
Advanced Cheater
Reputation: 0

Joined: 01 Dec 2016
Posts: 82

PostPosted: Sat Dec 17, 2016 2:49 pm    Post subject: Reply with quote

Thank you, worked like a charm.
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