|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Kajih Cheater Reputation: 1
Joined: 08 Feb 2021 Posts: 32
|
Posted: Wed Mar 16, 2022 9:16 am Post subject: Freezing a time value with script |
|
|
Hi, I seem to be having an issue I can't quite figure out. I found the value that manipulates time in a game and I can lock it just fine but I wanted to see if I can do an injection instead to what updates the value. Everything works, however the actual time value that is put in, is not correct. Here's my code:
Code: |
label(originalcode)
label(return)
label(freezeTime)
label(timePTR)
label(bFreezeTime)
newmem:
mov [timePTR],edx // Get current time value
cmp byte ptr [bFreezeTime],1
je freezeTime
originalcode:
mov [edx],eax
mov [edx+04],ecx
jmp return
freezeTime:
mov eax,edx // move current time in eax (here is the problem)
mov [edx],eax
mov [edx+04],ecx
jmp return
timePTR:
dq 0
bFreezeTime:
db 0
timeManip:
jmp newmem
|
I know that edx holds my value but since these are 8-byte values, I think that the mov eax,edx instruction is wrong somehow because when I activate my boolean flag to true, the value freezes but not at the current time but to a completely different value altogether.
Any help will be greatly appreciated. Thanks
|
|
Back to top |
|
|
cooleko Grandmaster Cheater Reputation: 11
Joined: 04 May 2016 Posts: 717
|
Posted: Wed Mar 16, 2022 11:46 am Post subject: |
|
|
Why don't you move edx+4 into ecx as well?
Alternatively, just don't write a new value into the registers at all, delete both moves. In that implementation, freeze time will just return.
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 138
Joined: 06 Jul 2014 Posts: 4275
|
Posted: Wed Mar 16, 2022 11:46 am Post subject: |
|
|
Kajih wrote: | I know that edx holds my value but since these are 8-byte values | edx is a 4-byte register, so it clearly doesn't.
Do you mean the value stored at the address in edx?
You could probably just do this instead:
Code: | newmem:
mov [timePTR],edx // Get current time value
cmp byte ptr [bFreezeTime],1
je freezeTime
originalcode:
mov [edx],eax
mov [edx+04],ecx
freezeTime:
jmp return
// because aligned data is good
align 8 CC
timePTR:
dq 0
bFreezeTime:
db 0
timeManip:
jmp newmem
|
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
Kajih Cheater Reputation: 1
Joined: 08 Feb 2021 Posts: 32
|
Posted: Wed Mar 16, 2022 11:59 am Post subject: |
|
|
Oh geez, yeah I see it now. I don't know why I got it in my head that edx was storing 8-bytes... and I completely ignored the edx+4
Thanks guys!
|
|
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
|
|