|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
bmmlst310 How do I cheat? Reputation: 0
Joined: 22 Sep 2023 Posts: 8
|
Posted: Fri Mar 08, 2024 11:03 am Post subject: Confusion about Teleport Hack |
|
|
Hello. I made a TP Hack and it worked. But I've two questions about memory alloc.
Here's the original code:
Code: |
[ENABLE]
aobscanmodule(INJECT,Eldritch.exe,F3 0F 10 70 10 F3 0F 10)
alloc(newmem,$1000,INJECT)
alloc(coord,$40)
label(code)
label(return)
label(xPos)
label(yPos)
label(zPos)
label(eSave)
label(eLoad)
label(save)
label(load)
label(xAxis)
coord:
xPos:
dd 0
zPos:
dd 0
yPos:
dd 0
eSave:
dd 0
eLoad:
dd 0
xAxis:
dd 0
newmem:
mov [xAxis],rax
cmp [eSave],1
je save
cmp [eLoad],1
je load
jmp code
save:
mov [eSave],0
push rbx
mov rbx,[rax+10]
mov [xPos],rbx
mov rbx,[rax+14]
mov [zPos],rbx
mov rbx,[rax+18]
mov [yPos],rbx
pop rbx
jmp code
load:
mov [eLoad],0
push rbx
mov rbx,[xPos]
mov [rax+10],rbx
mov rbx,[zPos]
mov [rax+14],rbx
mov rbx,[yPos]
mov [rax+18],rbx
pop rbx
jmp code
code:
movss xmm6,[rax+10]
jmp return
INJECT:
jmp newmem
return:
registersymbol(INJECT)
registersymbol(eSave)
registersymbol(eLoad)
registersymbol(xPos)
registersymbol(yPos)
registersymbol(zPos)
registersymbol(xAxis)
[DISABLE]
INJECT:
db F3 0F 10 70 10
unregistersymbol(INJECT)
unregistersymbol(eSave)
unregistersymbol(eLoad)
unregistersymbol(xPos)
unregistersymbol(yPos)
unregistersymbol(zPos)
unregistersymbol(xAxis)
dealloc(newmem)
dealloc(coord)
|
Q1: When I save the x,y,z position, the eSave value always goes from 1 to a huge number. The eLoad value never works like that(just 0 or 1). Why is that?
Q2: When I change my alloc coord memory blocks's order(xPos-zPos-yPos → xPos-yPos-zPos), the zPos value will be recorded wrong and always a small float(-2.5~2.5).
Please forgive me for my lack of proficiency in English and CE skills. And thanks for answering.
Description: |
x/yPos memories record the values correctly, but the zPos is wrong. |
|
Filesize: |
17.74 KB |
Viewed: |
601 Time(s) |
|
Description: |
Here you can see the x/z/yPos memories record the values correctly. |
|
Filesize: |
17.25 KB |
Viewed: |
601 Time(s) |
|
|
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Fri Mar 08, 2024 12:54 pm Post subject: |
|
|
You must consider value types and sizes, especially when working with 64bit.
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4307
|
Posted: Fri Mar 08, 2024 1:50 pm Post subject: |
|
|
dd = declare doubleword (4 byte data)
dq = declare quadword (8 byte data)
rax, rbx, etc. are 8 byte data
`mov [eSave],0` - the data size here is ambiguous. I think CE defaults to 4-byte data, but you should use `mov dword ptr [eSave],0` for documentation purposes anyway.
It looks like you want xPos, yPos, zPos to be floats. Floats are 4 bytes in size. Use eax, ebx, etc. instead of rax, rbx, etc.
If you use ebx, keep `push rbx` / `pop rbx`. It's important to back up and restore the entire register even if you only use part of it.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
bmmlst310 How do I cheat? Reputation: 0
Joined: 22 Sep 2023 Posts: 8
|
Posted: Sat Mar 09, 2024 2:12 am Post subject: |
|
|
ParkourPenguin wrote: | dd = declare doubleword (4 byte data)
dq = declare quadword (8 byte data)
rax, rbx, etc. are 8 byte data
`mov [eSave],0` - the data size here is ambiguous. I think CE defaults to 4-byte data, but you should use `mov dword ptr [eSave],0` for documentation purposes anyway.
It looks like you want xPos, yPos, zPos to be floats. Floats are 4 bytes in size. Use eax, ebx, etc. instead of rax, rbx, etc.
If you use ebx, keep `push rbx` / `pop rbx`. It's important to back up and restore the entire register even if you only use part of it. |
I revised the code according to your advice and then the above two questions were addressed. Thanks!
|
|
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
|
|