View previous topic :: View next topic |
Author |
Message |
Kahenraz Newbie cheater Reputation: 0
Joined: 29 Jun 2015 Posts: 16
|
Posted: Tue Oct 22, 2019 2:13 am Post subject: How to handle slowing down time with speedhack? |
|
|
I've re-implemented CheatEngine's hook of GetTickCount() and QueryPerformanceCounter() to adjust game speed like this:
Code: | tick=((currentRealTickCount-lastRealTick)*speedFactor+lastFakeTick) |
This allows me to adjust the returned tick count by the change in the actual tick count which I then multiply by an adjustable factor.
This works fine for positive speed adjustments but when I try to slow the game down by adjusting the speed by say "0.5", then the game just freezes as if time isn't moving; until I adjust it back to at least "1" for normal time.
I don't see anything wrong with my approach and I can verify with little test programs that time is adjusting (slowing down) at the appropriate rate. But it doesn't seem to work in-game. In this case, it's FF7.
If I use CheatEngine's built-in speedhack then adjusting the speed by a factor of 0.5 does in fact slow the game down as expected. So it seems like a problem with my implementation.
Why might this be failing for me? Why does the game hang with my approach?
Note that in FF7, game speed seems to be controlled by QueryPerformanceCounter() exclusively, if that helps.
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Tue Oct 22, 2019 3:33 am Post subject: |
|
|
Do you update lastFakeTick at the time that you change speed ? And do you get it before or after you have changed speedfactor? (if after that's why)
Also, what is your QueryPerformanceCounter() hook?
Do you take care that is is a 64-bit value?
You have to use separate variables for gettickcount and QueryPerformanceCounter
_________________
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 |
|
|
Kahenraz Newbie cheater Reputation: 0
Joined: 29 Jun 2015 Posts: 16
|
Posted: Tue Oct 22, 2019 4:13 am Post subject: |
|
|
All of the above; yes.
Dark Byte wrote: | Also, what is your QueryPerformanceCounter() hook |
It hooks Kernel32.dll QueryPerformanceCounter(). I call the original function to get the current tick and adjust my fake tick by an offset at each call.
The logic seems sound. As both currentRealTickCount and lastRealTick are sampled from the original function and (new-old) is always >= 0 then any result added to lastFakeTick will always be positive. The rate of increase is adjusted by speedFactor.
I can imagine that time can "stop" if for some reason speedFactor remains at 0 for the result of QueryPerformanceCounter(). But this isn't the case.
As I mentioned before, I ran some tests and time slows as expected with my little sample programs.
In this case I an hooking ONLY QueryPerformanceCounter() as GetTickCount() doesn't have any noticeable affect in FF7. There is no change in behavior when I hook both functions and hooking only GetTickCount() does nothing.
|
|
Back to top |
|
|
atom0s Moderator Reputation: 199
Joined: 25 Jan 2006 Posts: 8518 Location: 127.0.0.1
|
Posted: Tue Oct 22, 2019 3:45 pm Post subject: |
|
|
Try hooking timeGetTime as well and see if that has any effect.
_________________
- Retired. |
|
Back to top |
|
|
|