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 


Filtering and float compare.

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

Joined: 20 Mar 2024
Posts: 10

PostPosted: Tue Apr 23, 2024 5:38 am    Post subject: Filtering and float compare. Reply with quote

Hello folks,

I'm trying to use a LUA expression to filter a debugger's results but can't seem to get it to work. What am I doing wrong? I tried the hex equivalent of 40 but still doesn't work.

Code:
readFloat(rcx) == 40


Also, how would I go about comparing that float value in assembly? For non-assembly code it would have been the following but I can't seem to find much about handling floats.

I'm basically just trying to store the value stored inside the register rcx if it's equal to float value 40.

Code:
newmem:
  cmp [rcx],42200000
  jne code
  mov [hpptr],rcx // store in symbol
  add [hpptr], 8 // offset the value

code:
  mov [rcx+rdx*4],eax
  mov rcx,[rbp+00000300]
  jmp return



filter1.PNG
 Description:
 Filesize:  75.48 KB
 Viewed:  393 Time(s)

filter1.PNG


Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 459

Joined: 09 May 2003
Posts: 25311
Location: The netherlands

PostPosted: Tue Apr 23, 2024 7:49 am    Post subject: Reply with quote

capital RCX, so readFloat(RCX) == 40

for the exact value of 40 you can do what you did, but also do cmp [rcx],(float)40

if you're looking for less/greater etc... then look into the xmm instructions, or use ccode/luacode

you might want to add a check to see if the address is already in the hpptr list, and add a max/overflow

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
gamerp
Newbie cheater
Reputation: 0

Joined: 20 Mar 2024
Posts: 10

PostPosted: Wed Apr 24, 2024 5:49 am    Post subject: Reply with quote

Thanks, Dark Byte!

Filter works now. Didn't know it was case sensitive.

Maybe a bit off-topic but I'm not sure the ASM code works. For some reason it's storing the address of where the code injection is happening instead of what I'm telling it too.

Code:

aobscanmodule(_hpptr,Fallout4.exe,xxxx)
alloc(newmem,$1000,_hpptr)

label(code)
label(return)

alloc(hpptr,8)

newmem:
  cmp [rcx],(float)60
  jne code // not 60 so back to original code
  cmp [rcx], 0
  jg code // not less than 0 so back to original code
  mov [hpptr],rcx
  add [hpptr],8

code:
  mov [rcx+rdx*4],eax
  mov rcx,[rbp+00000300]
  jmp return

_hpptr:
  jmp newmem
  nop 5
return:
registersymbol(_hpptr)
registersymbol(hpptr)


Something as simple as this does the same with an address that begins 7FF =/

Code:
mov [hppptr], 1


EDIT

Nevermind... I removed the second compare after realising floats use a different compare instruction, then set the entry as a pointer instead of an address and it's working fine now xD

Although it would be nice to know how to use LUA to do the second compare mixed in with the ASM Surprised

Code:

  cmp [rcx], 0
  jg code // not less than 0 so back to original code



filter1.PNG
 Description:
 Filesize:  8.09 KB
 Viewed:  308 Time(s)

filter1.PNG


Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 459

Joined: 09 May 2003
Posts: 25311
Location: The netherlands

PostPosted: Wed Apr 24, 2024 7:39 am    Post subject: Reply with quote

jg stands for "jump if greater"
So, if the value is 0, it's not greater than 0, so it won't jump to code and continue


you may want to use jge "jump if greater or equal" or jae "jump if above or equal" (jae is for unsigned values which is recommended here)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
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