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-11-13 05:44:13 +00:00
|
|
|
DWORD CGameSettings::m_AiCountPerBytes = 500;
|
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-11-17 01:02:04 +00:00
|
|
|
if (g_Settings && !m_Registered)
|
2012-09-24 01:14:02 +00:00
|
|
|
{
|
2012-10-14 01:05:52 +00:00
|
|
|
m_Registered = true;
|
2012-11-17 01:02:04 +00:00
|
|
|
g_Settings->RegisterChangeCB(Game_UseTlb,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->RegisterChangeCB(Game_ViRefreshRate,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->RegisterChangeCB(Game_AiCountPerBytes,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->RegisterChangeCB(Game_CounterFactor,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->RegisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->RegisterChangeCB(Game_DelaySI,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->RegisterChangeCB(Game_DelayDP,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->RegisterChangeCB(Game_FixedAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->RegisterChangeCB(Game_SyncViaAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->RegisterChangeCB(Game_32Bit,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->RegisterChangeCB(Game_FastSP,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->RegisterChangeCB(Game_RspAudioSignal,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2012-09-24 01:14:02 +00:00
|
|
|
|
|
|
|
RefreshSettings();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CGameSettings::~CGameSettings()
|
|
|
|
{
|
|
|
|
m_RefCount -= 1;
|
2012-11-17 01:02:04 +00:00
|
|
|
if (g_Settings && m_Registered && m_RefCount == 0)
|
2012-09-24 01:14:02 +00:00
|
|
|
{
|
2012-11-17 01:02:04 +00:00
|
|
|
g_Settings->UnregisterChangeCB(Game_UseTlb,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->UnregisterChangeCB(Game_ViRefreshRate,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->UnregisterChangeCB(Game_AiCountPerBytes,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->UnregisterChangeCB(Game_CounterFactor,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->UnregisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->UnregisterChangeCB(Game_DelaySI,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->UnregisterChangeCB(Game_DelayDP,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->UnregisterChangeCB(Game_FixedAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->UnregisterChangeCB(Game_SyncViaAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->UnregisterChangeCB(Game_32Bit,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->UnregisterChangeCB(Game_FastSP,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_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-11-17 01:02:04 +00:00
|
|
|
m_bUseTlb = g_Settings->LoadBool(Game_UseTlb);
|
|
|
|
m_ViRefreshRate = g_Settings->LoadDword(Game_ViRefreshRate);
|
|
|
|
m_AiCountPerBytes = g_Settings->LoadDword(Game_AiCountPerBytes);
|
|
|
|
m_CountPerOp = g_Settings->LoadDword(Game_CounterFactor);
|
|
|
|
m_RdramSize = g_Settings->LoadDword(Game_RDRamSize);
|
|
|
|
m_DelaySI = g_Settings->LoadBool(Game_DelaySI);
|
|
|
|
m_DelayDP = g_Settings->LoadBool(Game_DelayDP);
|
|
|
|
m_bFixedAudio = g_Settings->LoadBool(Game_FixedAudio);
|
|
|
|
m_bSyncToAudio = m_bFixedAudio ? g_Settings->LoadBool(Game_SyncViaAudio) : false;
|
|
|
|
m_b32Bit = g_Settings->LoadBool(Game_32Bit);
|
|
|
|
m_bFastSP = g_Settings->LoadBool(Game_FastSP);
|
|
|
|
m_RspAudioSignal = g_Settings->LoadBool(Game_RspAudioSignal);
|
2012-09-24 01:14:02 +00:00
|
|
|
}
|