2012-09-24 01:14:02 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
|
2012-10-05 23:53:11 +00:00
|
|
|
int CGameSettings::m_RefCount = 0;
|
2012-10-14 01:05:52 +00:00
|
|
|
bool CGameSettings::m_Registered = false;
|
2012-09-24 01:14:02 +00:00
|
|
|
|
2012-10-14 01:05:52 +00:00
|
|
|
bool CGameSettings::m_bUseTlb;
|
2012-09-28 20:07:45 +00:00
|
|
|
DWORD CGameSettings::m_CountPerOp = 2;
|
|
|
|
DWORD CGameSettings::m_ViRefreshRate = 1500;
|
2012-10-05 23:53:11 +00:00
|
|
|
bool CGameSettings::m_DelayDP = false;
|
|
|
|
bool CGameSettings::m_DelaySI = false;
|
|
|
|
DWORD CGameSettings::m_RdramSize = 0;
|
2012-10-14 01:05:52 +00:00
|
|
|
bool CGameSettings::m_bFixedAudio;
|
|
|
|
bool CGameSettings::m_bSyncToAudio;
|
|
|
|
bool CGameSettings::m_bFastSP;
|
|
|
|
bool CGameSettings::m_b32Bit;
|
2012-10-25 08:34:25 +00:00
|
|
|
bool CGameSettings::m_RspAudioSignal;
|
2012-09-24 01:14:02 +00:00
|
|
|
|
|
|
|
CGameSettings::CGameSettings()
|
|
|
|
{
|
|
|
|
m_RefCount += 1;
|
2012-10-14 01:05:52 +00:00
|
|
|
if (_Settings && !m_Registered)
|
2012-09-24 01:14:02 +00:00
|
|
|
{
|
2012-10-14 01:05:52 +00:00
|
|
|
m_Registered = true;
|
2012-09-24 01:14:02 +00:00
|
|
|
_Settings->RegisterChangeCB(Game_UseTlb,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2012-09-28 20:07:45 +00:00
|
|
|
_Settings->RegisterChangeCB(Game_ViRefreshRate,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
_Settings->RegisterChangeCB(Game_CounterFactor,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2012-10-05 23:53:11 +00:00
|
|
|
_Settings->RegisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
_Settings->RegisterChangeCB(Game_DelaySI,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
_Settings->RegisterChangeCB(Game_DelayDP,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2012-10-14 01:05:52 +00:00
|
|
|
_Settings->RegisterChangeCB(Game_FixedAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
_Settings->RegisterChangeCB(Game_SyncViaAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
_Settings->RegisterChangeCB(Game_32Bit,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
_Settings->RegisterChangeCB(Game_FastSP,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2012-10-25 08:34:25 +00:00
|
|
|
_Settings->RegisterChangeCB(Game_RspAudioSignal,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2012-09-24 01:14:02 +00:00
|
|
|
|
|
|
|
RefreshSettings();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CGameSettings::~CGameSettings()
|
|
|
|
{
|
|
|
|
m_RefCount -= 1;
|
2012-10-15 07:41:30 +00:00
|
|
|
if (_Settings && m_Registered && m_RefCount == 0)
|
2012-09-24 01:14:02 +00:00
|
|
|
{
|
|
|
|
_Settings->UnregisterChangeCB(Game_UseTlb,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2012-09-28 20:07:45 +00:00
|
|
|
_Settings->UnregisterChangeCB(Game_ViRefreshRate,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
_Settings->UnregisterChangeCB(Game_CounterFactor,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2012-10-05 23:53:11 +00:00
|
|
|
_Settings->UnregisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
_Settings->UnregisterChangeCB(Game_DelaySI,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
_Settings->UnregisterChangeCB(Game_DelayDP,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2012-10-14 01:05:52 +00:00
|
|
|
_Settings->UnregisterChangeCB(Game_FixedAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
_Settings->UnregisterChangeCB(Game_SyncViaAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
_Settings->UnregisterChangeCB(Game_32Bit,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
_Settings->UnregisterChangeCB(Game_FastSP,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2012-10-25 08:34:25 +00:00
|
|
|
_Settings->UnregisterChangeCB(Game_RspAudioSignal,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2012-10-14 01:05:52 +00:00
|
|
|
|
|
|
|
m_Registered = false;
|
2012-09-24 01:14:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CGameSettings::RefreshSettings()
|
|
|
|
{
|
2012-10-14 01:05:52 +00:00
|
|
|
m_bUseTlb = _Settings->LoadBool(Game_UseTlb);
|
2012-09-28 20:07:45 +00:00
|
|
|
m_ViRefreshRate = _Settings->LoadDword(Game_ViRefreshRate);
|
2012-10-14 01:05:52 +00:00
|
|
|
m_CountPerOp = _Settings->LoadDword(Game_CounterFactor);
|
|
|
|
m_RdramSize = _Settings->LoadDword(Game_RDRamSize);
|
|
|
|
m_DelaySI = _Settings->LoadBool(Game_DelaySI);
|
|
|
|
m_DelayDP = _Settings->LoadBool(Game_DelayDP);
|
|
|
|
m_bFixedAudio = _Settings->LoadBool(Game_FixedAudio);
|
|
|
|
m_bSyncToAudio = m_bFixedAudio ? _Settings->LoadBool(Game_SyncViaAudio) : false;
|
|
|
|
m_b32Bit = _Settings->LoadBool(Game_32Bit);
|
|
|
|
m_bFastSP = _Settings->LoadBool(Game_FastSP);
|
2012-10-25 08:34:25 +00:00
|
|
|
m_RspAudioSignal= _Settings->LoadBool(Game_RspAudioSignal);
|
2012-09-24 01:14:02 +00:00
|
|
|
}
|