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 


Freezing a time value with script

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

Joined: 08 Feb 2021
Posts: 32

PostPosted: Wed Mar 16, 2022 9:16 am    Post subject: Freezing a time value with script Reply with quote

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
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Wed Mar 16, 2022 11:46 am    Post subject: This post has 1 review(s) Reply with quote

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
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Wed Mar 16, 2022 11:46 am    Post subject: Reply with quote

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
View user's profile Send private message
Kajih
Cheater
Reputation: 1

Joined: 08 Feb 2021
Posts: 32

PostPosted: Wed Mar 16, 2022 11:59 am    Post subject: Reply with quote

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 Embarassed

Thanks guys!
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