2016-01-27 09:11:59 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Project64-core/Settings/GameSettings.h>
|
2016-09-17 18:10:22 +00:00
|
|
|
|
2016-09-16 21:37:27 +00:00
|
|
|
#include <Common/HighResTimeStamp.h>
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
class CSpeedLimiter :
|
|
|
|
private CGameSettings
|
|
|
|
{
|
|
|
|
public:
|
2016-09-17 18:10:22 +00:00
|
|
|
enum ESpeedChange { INCREASE_SPEED, DECREASE_SPEED };
|
|
|
|
|
2016-01-27 09:11:59 +00:00
|
|
|
CSpeedLimiter();
|
|
|
|
~CSpeedLimiter();
|
|
|
|
|
|
|
|
void SetHertz(const uint32_t Hertz);
|
|
|
|
bool Timer_Process(uint32_t* const FrameRate);
|
2016-09-17 18:10:22 +00:00
|
|
|
|
|
|
|
void AlterSpeed(const ESpeedChange SpeedChange);
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2016-11-21 07:17:15 +00:00
|
|
|
void SetSpeed(int Speed);
|
|
|
|
int GetSpeed(void) const;
|
|
|
|
int GetBaseSpeed(void) const;
|
|
|
|
|
2016-01-27 09:11:59 +00:00
|
|
|
private:
|
2021-04-13 00:07:11 +00:00
|
|
|
CSpeedLimiter(const CSpeedLimiter&);
|
|
|
|
CSpeedLimiter& operator=(const CSpeedLimiter&);
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
void FixSpeedRatio();
|
|
|
|
|
2016-09-17 18:10:22 +00:00
|
|
|
HighResTimeStamp m_LastTime;
|
|
|
|
|
|
|
|
uint32_t m_Speed, m_BaseSpeed, m_Frames, m_MicroSecondsPerFrame;
|
|
|
|
|
2016-09-17 18:22:53 +00:00
|
|
|
static const uint32_t m_DefaultSpeed;
|
2016-01-27 09:11:59 +00:00
|
|
|
};
|