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 


Any way to block the Elapsed Milliseconds function?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
ipivb
Master Cheater
Reputation: 5

Joined: 29 May 2010
Posts: 256

PostPosted: Fri Jan 07, 2011 9:27 am    Post subject: Any way to block the Elapsed Milliseconds function? Reply with quote

I'm trying to hack a certain, time-based PC game that has a timer which counts down.

I'm sure it depends on Milliseconds() in some way to calculate time. Is there any way to block/freeze this with cheat engine? It's displayed in MM:SS format on screen.

The timer is listed in a DLL file but I already peeked through its functions list and couldn't find anything related to a timer. I even tried writing a few bytes over some function definitions that I thought might be related to the timer but it didn't affect anything.

I know that it must depend on elapsed milliseconds because if I completely freeze the code execution, the timer is "still counting" as if it wasn't really frozen at all.

Also, this is a single player game, so it's not connected to a server or anything.

If I wrote a program to do it, is there a way to hook into the game and detect when it calls the milliseconds function and return a false value to it? Or something similar?
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Fri Jan 07, 2011 9:54 am    Post subject: Reply with quote

I'm not sure how timers are implemented internally by Windows. You could try logging calls to GetTickCount and QueryPerformanceCounter to see if it's using those. If so, all you have to do to freeze a timer is to check the initial return of those functions and continuing returning that value each time it's called. However I suspect that there is some interrupt which is doing the work at a lower level. My suggestion is to find the code which writes to the text that is being displayed on the screen and trace back from there because most likely the time is updated logically then the UI notified to change.
Back to top
View user's profile Send private message
ipivb
Master Cheater
Reputation: 5

Joined: 29 May 2010
Posts: 256

PostPosted: Fri Jan 07, 2011 10:09 am    Post subject: Reply with quote

Thank you so much, that's exactly what I did pretty much!

I underestimated the power of CheatEngine! Without really knowing what I was doing, I kept playing around until I was able to freeze the pointer which changes the timer!

Now I just have to wait a few minutes to find out if the timer is still going in the background, or if I really changed it for good :]
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Fri Jan 07, 2011 5:00 pm    Post subject: Reply with quote

Slugsnack wrote:
I'm not sure how timers are implemented internally by Windows. You could try logging calls to GetTickCount and QueryPerformanceCounter to see if it's using those. If so, all you have to do to freeze a timer is to check the initial return of those functions and continuing returning that value each time it's called. However I suspect that there is some interrupt which is doing the work at a lower level. My suggestion is to find the code which writes to the text that is being displayed on the screen and trace back from there because most likely the time is updated logically then the UI notified to change.


GetTickCount() and maybe TimeGetTime() just read a value out of memory afaik. QueryPerformanceCounter() will go and query whatever hardware timer it feels like, I think there's a couple it may possibly use depending on your OS version and hardware I guess.
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 programming 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