Game Accessibility Library logo SourceForge.net Logo
Game Accessibility Suite: CATTimeWarp Class Reference

CATTimeWarp Class Reference
[Common Accessibility Technology [CAT] library]

#include <CATTimeWarp.h>

Inheritance diagram for CATTimeWarp:

CATIntercept

List of all members.


Detailed Description

Time function interception, made for slowing down video games.

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:

  1. First call HookFunctions() to start it. It will hook all of the functions and set the speed to 1.0 (normal).
  2. Call SetSpeed() with the percentage of normal speed that you wish to run the process at (recommended 0.1f - 1.0f).

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.

The documentation for this class was generated from the following files:
Generated on Mon Feb 11 04:11:08 2008 for Game Accessibility Suite by doxygen 1.5.4