#include <CATTimeWarp.h>
CATTimeWarp works by intercepting the timing functions that games typically use and scaling them to the desired speed.
To avoid the horrible results of negative diff values, it stores the last value each of the hooked functions returned natively and its internal calculated value. The next time that function is called, the result is the scaled time difference between the last call and the current call.
Currently hooking timeGetTime(), GetTickCount(), and QueryPerformanceCounter().
Usage:
Definition at line 41 of file CATTimeWarp.h.
Public Member Functions | |
CATTimeWarp () | |
virtual | ~CATTimeWarp () |
CATResult | HookFunctions () |
CATResult | SetSpeed (CATFloat32 speed) |
CATFloat32 | GetSpeed () |
Protected Member Functions | |
void | AdjustSaveTime (LARGE_INTEGER *lastPerf, DWORD *lastTick, DWORD *lastTime) |
Static Protected Member Functions | |
static void | OnTimeGetTime (CATHOOK *hookInst) |
Hook function - receives control when timeGetTime is called. | |
static void | OnQueryPerformanceCounter (CATHOOK *hookInst, LARGE_INTEGER *lpCount) |
Hook function - receives control when QueryPerformanceCounter is called. | |
static void | OnGetTickCount (CATHOOK *hookInst) |
Hook function - receives control when GetTickCount is called. | |
static void | FixupQPC (CATHOOK *hookInst, LARGE_INTEGER *lpCount) |
Adjust timer for QueryPerformanceCounter. | |
static void | FixupTime (CATHOOK *hookInst, DWORD *time) |
Adjust timer for timeGetTime(). | |
static void | FixupTick (CATHOOK *hookInst, DWORD *tick) |
Adjust timer for GetTickCount(). | |
Protected Attributes | |
CATCritSec | fLock |
Critical section for timer data. | |
CATFloat32 | fSpeed |
Speed (0.1 - 1.0) to run at. | |
HMODULE | fWinmmDLL |
winmm.dll module handle | |
HMODULE | fKernelDLL |
kernel32.dll module handle | |
LARGE_INTEGER | fLastPerfCounter |
Last calculated result for QueryPerformanceCounter(). | |
DWORD | fLastTimeGetTime |
Last calculated result for timeGetTime(). | |
DWORD | fLastTickCount |
Last calculated result for GetTickCount(). | |
LARGE_INTEGER | fLastRealPerfCounter |
Last real system result for QueryPerformanceCounter(). | |
DWORD | fLastRealTimeGetTime |
Last real system result for timeGetTime(). | |
DWORD | fLastRealTickCount |
Last real system result for GetTickCount(). | |
Static Protected Attributes | |
static CATINTERCEPT_DLL_TABLE_ENTRY | kKernel32Funcs [] |
Kernel32 functions to hook. | |
static CATINTERCEPT_DLL_TABLE_ENTRY | kWinMMFuncs [] |
WinMM functions to hook. |