project64/Source/Project64/Settings/GuiSettings.cpp

33 lines
890 B
C++
Raw Normal View History

2016-01-27 09:11:59 +00:00
#include "stdafx.h"
int CGuiSettings::m_RefCount = 0;
bool CGuiSettings::m_bCPURunning;
bool CGuiSettings::m_bAutoSleep;
2016-01-27 09:11:59 +00:00
CGuiSettings::CGuiSettings()
{
m_RefCount += 1;
if (m_RefCount == 1)
{
2021-04-12 11:35:39 +00:00
g_Settings->RegisterChangeCB(GameRunning_CPU_Running,nullptr,RefreshSettings);
g_Settings->RegisterChangeCB((SettingID)Setting_AutoSleep,nullptr,RefreshSettings);
RefreshSettings(nullptr);
}
2016-01-27 09:11:59 +00:00
}
CGuiSettings::~CGuiSettings()
{
m_RefCount -= 1;
if (m_RefCount == 0)
{
2021-04-12 11:35:39 +00:00
g_Settings->UnregisterChangeCB(GameRunning_CPU_Running,nullptr,RefreshSettings);
g_Settings->UnregisterChangeCB((SettingID)Setting_AutoSleep,nullptr,RefreshSettings);
}
2016-01-27 09:11:59 +00:00
}
void CGuiSettings::RefreshSettings(void *)
{
2021-03-18 00:32:37 +00:00
m_bCPURunning = g_Settings->LoadBool(GameRunning_CPU_Running);
m_bAutoSleep = g_Settings->LoadBool((SettingID)Setting_AutoSleep);
2016-01-27 09:11:59 +00:00
}