2008-09-18 03:15:49 +00:00
|
|
|
#include "..\\N64 Types.h"
|
|
|
|
|
|
|
|
class CC_Core;
|
|
|
|
|
2012-09-28 20:07:45 +00:00
|
|
|
class CSystemTimer :
|
|
|
|
protected CGameSettings
|
2010-05-22 04:47:15 +00:00
|
|
|
{
|
2010-05-23 10:05:41 +00:00
|
|
|
public:
|
|
|
|
enum TimerType {
|
|
|
|
UnknownTimer,
|
|
|
|
CompareTimer,
|
|
|
|
SoftResetTimer,
|
|
|
|
ViTimer,
|
|
|
|
AiTimer,
|
|
|
|
AiTimerDMA,
|
|
|
|
SiTimer,
|
|
|
|
PiTimer,
|
|
|
|
RspTimer,
|
|
|
|
RSPTimerDlist,
|
|
|
|
MaxTimer
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
bool Active;
|
|
|
|
__int64 CyclesToTimer;
|
|
|
|
} TIMER_DETAILS;
|
2008-09-18 03:15:49 +00:00
|
|
|
|
|
|
|
public:
|
2010-05-23 10:05:41 +00:00
|
|
|
CSystemTimer ( int & NextTimer );
|
|
|
|
void SetTimer ( TimerType Type, DWORD Cycles, bool bRelative );
|
2010-06-14 21:14:58 +00:00
|
|
|
DWORD GetTimer ( TimerType Type );
|
2010-05-23 10:05:41 +00:00
|
|
|
void StopTimer ( TimerType Type );
|
|
|
|
void UpdateTimers ( void );
|
|
|
|
void TimerDone ( void );
|
|
|
|
void Reset ( void );
|
|
|
|
void UpdateCompareTimer ( void );
|
2010-06-14 21:14:58 +00:00
|
|
|
bool SaveAllowed ( void );
|
2010-05-23 10:05:41 +00:00
|
|
|
|
2010-10-23 18:53:01 +00:00
|
|
|
void SaveData ( void * file ) const;
|
|
|
|
void LoadData ( void * file );
|
|
|
|
|
2012-09-23 22:18:44 +00:00
|
|
|
void RecordDifference( CLog &LogFile, const CSystemTimer& rSystemTimer);
|
|
|
|
|
2010-05-23 10:05:41 +00:00
|
|
|
inline TimerType CurrentType ( void ) const { return m_Current; }
|
|
|
|
|
2012-09-23 22:18:44 +00:00
|
|
|
bool operator == (const CSystemTimer& rSystemTimer) const;
|
|
|
|
bool operator != (const CSystemTimer& rSystemTimer) const;
|
|
|
|
|
2010-05-23 10:05:41 +00:00
|
|
|
private:
|
|
|
|
TIMER_DETAILS m_TimerDetatils[MaxTimer];
|
2010-07-05 11:29:46 +00:00
|
|
|
int m_LastUpdate; //Timer at last update
|
2010-05-23 10:05:41 +00:00
|
|
|
int & m_NextTimer;
|
|
|
|
TimerType m_Current;
|
2010-07-05 11:29:46 +00:00
|
|
|
bool m_inFixTimer;
|
2010-05-23 10:05:41 +00:00
|
|
|
|
2010-07-05 11:29:46 +00:00
|
|
|
void SetCompareTimer ( void );
|
|
|
|
void FixTimers ( void );
|
2008-09-18 03:15:49 +00:00
|
|
|
};
|