diff options
Diffstat (limited to 'src/core/Timer.cpp')
-rw-r--r-- | src/core/Timer.cpp | 59 |
1 files changed, 19 insertions, 40 deletions
diff --git a/src/core/Timer.cpp b/src/core/Timer.cpp index fda862f1..aca7c1dc 100644 --- a/src/core/Timer.cpp +++ b/src/core/Timer.cpp @@ -1,38 +1,32 @@ -#include <windows.h> +#define WITHWINDOWS #include "common.h" -#include "patcher.h" + #include "DMAudio.h" #include "Record.h" #include "Timer.h" -uint32 &CTimer::m_snTimeInMilliseconds = *(uint32*)0x885B48; -uint32 &CTimer::m_snTimeInMillisecondsPauseMode = *(uint32*)0x5F7614; -uint32 &CTimer::m_snTimeInMillisecondsNonClipped = *(uint32*)0x9412E8; -uint32 &CTimer::m_snPreviousTimeInMilliseconds = *(uint32*)0x8F29E4; -uint32 &CTimer::m_FrameCounter = *(uint32*)0x9412EC; -float &CTimer::ms_fTimeScale = *(float*)0x8F2C20; -float &CTimer::ms_fTimeStep = *(float*)0x8E2CB4; -float &CTimer::ms_fTimeStepNonClipped = *(float*)0x8E2C4C; -bool &CTimer::m_UserPause = *(bool*)0x95CD7C; -bool &CTimer::m_CodePause = *(bool*)0x95CDB1; +uint32 CTimer::m_snTimeInMilliseconds; +uint32 CTimer::m_snTimeInMillisecondsPauseMode = 1; +uint32 CTimer::m_snTimeInMillisecondsNonClipped; +uint32 CTimer::m_snPreviousTimeInMilliseconds; +uint32 CTimer::m_FrameCounter; +float CTimer::ms_fTimeScale; +float CTimer::ms_fTimeStep; +float CTimer::ms_fTimeStepNonClipped; +bool CTimer::m_UserPause; +bool CTimer::m_CodePause; -//UInt32 oldPcTimer; -uint32 &oldPcTimer = *(uint32*)0x9434F4; +uint32 oldPcTimer; -//UInt32 suspendPcTimer; -uint32 &suspendPcTimer = *(uint32*)0x62A308; +uint32 suspendPcTimer; -//UInt32 _nCyclesPerMS = 1; -uint32 &_nCyclesPerMS = *(uint32*)0x5F7610; +uint32 _nCyclesPerMS = 1; -//LARGE_INTEGER _oldPerfCounter; -LARGE_INTEGER &_oldPerfCounter = *(LARGE_INTEGER*)0x62A310; +LARGE_INTEGER _oldPerfCounter; -//LARGE_INTEGER perfSuspendCounter; -LARGE_INTEGER &perfSuspendCounter = *(LARGE_INTEGER*)0x62A318; +LARGE_INTEGER perfSuspendCounter; -//UInt32 suspendDepth; -uint32 &suspendDepth = *(uint32*)0x62A320; +uint32 suspendDepth; #ifdef FIX_BUGS double frameTime; @@ -144,7 +138,7 @@ void CTimer::Update(void) if ( !CRecordDataForGame::IsPlayingBack() ) { - ms_fTimeStep = min(3.0f, ms_fTimeStep); + ms_fTimeStep = Min(3.0f, ms_fTimeStep); if ( (m_snTimeInMilliseconds - m_snPreviousTimeInMilliseconds) > 60 ) m_snTimeInMilliseconds = m_snPreviousTimeInMilliseconds + 60; @@ -231,18 +225,3 @@ uint32 CTimer::GetCyclesPerFrame() return 20; } -#if 1 -STARTPATCHES - InjectHook(0x4ACE60, CTimer::Initialise, PATCH_JUMP); - InjectHook(0x4ACF60, CTimer::Shutdown, PATCH_JUMP); - InjectHook(0x4ACF70, CTimer::Update, PATCH_JUMP); - InjectHook(0x4AD310, CTimer::Suspend, PATCH_JUMP); - InjectHook(0x4AD370, CTimer::Resume, PATCH_JUMP); - InjectHook(0x4AD3F0, CTimer::GetCyclesPerMillisecond, PATCH_JUMP); - InjectHook(0x4AD410, CTimer::GetCurrentTimeInCycles, PATCH_JUMP); - InjectHook(0x4AD450, CTimer::GetIsSlowMotionActive, PATCH_JUMP); - InjectHook(0x4AD480, CTimer::Stop, PATCH_JUMP); - InjectHook(0x4AD490, CTimer::StartUserPause, PATCH_JUMP); - InjectHook(0x4AD4A0, CTimer::EndUserPause, PATCH_JUMP); -ENDPATCHES -#endif |