DWORD Accelerator::HOOK_GetTickCount( void ) { float rate = Accelerator::GetInstance()->GetRate(); if (rate - 1.0f > 0.0000001 || rate - 1.0f < -0.000001){ DWORD result = Real_GetTickCount(); return result * rate; }else return Real_GetTickCount(); }
bool Accelerator::SetRate( float fRate ){ if (Real_GetTickCount == NULL){ return false; } ::EnterCriticalSection(&s_cs); m_dwStartTickCount = Real_GetTickCount(); m_fRate = fRate; ::LeaveCriticalSection(&s_cs); return true; }
static DWORD WINAPI Mine_GetTickCount(VOID) { DWORD dwTickCount = Real_GetTickCount(); EnterCriticalSection(&g_csGetTickCount); static DWORD dwLastCount = 0; static DWORD dwLastResult = 0; if (dwLastCount == 0) { dwLastCount = dwTickCount; dwLastResult = dwTickCount; } else { dwLastResult += (DWORD)((dwTickCount - dwLastCount) * g_fSpeed + 0.5); dwLastCount = dwTickCount; dwTickCount = dwLastResult; } LeaveCriticalSection(&g_csGetTickCount); return dwTickCount; }