|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
gamerp Newbie cheater Reputation: 0
Joined: 20 Mar 2024 Posts: 10
|
Posted: Tue Apr 23, 2024 5:38 am Post subject: Filtering and float compare. |
|
|
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 |
Description: |
|
Filesize: |
75.48 KB |
Viewed: |
393 Time(s) |
|
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 459
Joined: 09 May 2003 Posts: 25311 Location: The netherlands
|
Posted: Tue Apr 23, 2024 7:49 am Post subject: |
|
|
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 |
|
|
gamerp Newbie cheater Reputation: 0
Joined: 20 Mar 2024 Posts: 10
|
Posted: Wed Apr 24, 2024 5:49 am Post subject: |
|
|
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 =/
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
Code: |
cmp [rcx], 0
jg code // not less than 0 so back to original code
|
Description: |
|
Filesize: |
8.09 KB |
Viewed: |
308 Time(s) |
|
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 459
Joined: 09 May 2003 Posts: 25311 Location: The netherlands
|
Posted: Wed Apr 24, 2024 7:39 am Post subject: |
|
|
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 |
|
|
|
|
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
|
|