[Project64] Cleanup Debug Settings.cpp

This commit is contained in:
zilmar 2015-11-15 08:32:57 +11:00
parent d9e13d4385
commit 68513c1101
2 changed files with 43 additions and 43 deletions

View File

@ -10,7 +10,7 @@
****************************************************************************/
#include "stdafx.h"
int CDebugSettings::m_RefCount = 0;
int CDebugSettings::m_RefCount = 0;
bool CDebugSettings::m_bHaveDebugger = false;
bool CDebugSettings::m_bLogX86Code = false;
@ -20,35 +20,35 @@ bool CDebugSettings::m_Registered = false;
CDebugSettings::CDebugSettings()
{
m_RefCount += 1;
if (!m_Registered && g_Settings)
{
m_Registered = true;
g_Settings->RegisterChangeCB(Debugger_Enabled,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->RegisterChangeCB(Debugger_GenerateLogFiles,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->RegisterChangeCB(Debugger_ShowTLBMisses,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->RegisterChangeCB(Debugger_ShowDivByZero,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
RefreshSettings();
}
m_RefCount += 1;
if (!m_Registered && g_Settings)
{
m_Registered = true;
g_Settings->RegisterChangeCB(Debugger_Enabled, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->RegisterChangeCB(Debugger_GenerateLogFiles, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->RegisterChangeCB(Debugger_ShowTLBMisses, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->RegisterChangeCB(Debugger_ShowDivByZero, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
RefreshSettings();
}
}
CDebugSettings::~CDebugSettings()
{
m_RefCount -= 1;
if (m_RefCount == 0 && g_Settings)
{
g_Settings->UnregisterChangeCB(Debugger_Enabled,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->UnregisterChangeCB(Debugger_GenerateLogFiles,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->UnregisterChangeCB(Debugger_ShowTLBMisses,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->UnregisterChangeCB(Debugger_ShowDivByZero,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
}
m_RefCount -= 1;
if (m_RefCount == 0 && g_Settings)
{
g_Settings->UnregisterChangeCB(Debugger_Enabled, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->UnregisterChangeCB(Debugger_GenerateLogFiles, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->UnregisterChangeCB(Debugger_ShowTLBMisses, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->UnregisterChangeCB(Debugger_ShowDivByZero, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
}
}
void CDebugSettings::RefreshSettings()
{
m_bHaveDebugger = g_Settings->LoadBool(Debugger_Enabled);
m_bLogX86Code = m_bHaveDebugger && g_Settings->LoadBool(Debugger_GenerateLogFiles);
m_bShowTLBMisses = m_bHaveDebugger && g_Settings->LoadBool(Debugger_ShowTLBMisses);
m_bShowDivByZero = m_bHaveDebugger && g_Settings->LoadBool(Debugger_ShowDivByZero);
}
m_bHaveDebugger = g_Settings->LoadBool(Debugger_Enabled);
m_bLogX86Code = m_bHaveDebugger && g_Settings->LoadBool(Debugger_GenerateLogFiles);
m_bShowTLBMisses = m_bHaveDebugger && g_Settings->LoadBool(Debugger_ShowTLBMisses);
m_bShowDivByZero = m_bHaveDebugger && g_Settings->LoadBool(Debugger_ShowDivByZero);
}

View File

@ -15,28 +15,28 @@
class CDebugSettings
{
public:
CDebugSettings();
virtual ~CDebugSettings();
CDebugSettings();
virtual ~CDebugSettings();
static inline bool bHaveDebugger ( void ) { return m_bHaveDebugger; }
static inline bool bLogX86Code ( void ) { return m_bLogX86Code; }
static inline bool bShowTLBMisses ( void ) { return m_bShowTLBMisses; }
static inline bool bShowDivByZero ( void ) { return m_bShowDivByZero; }
static inline bool bHaveDebugger(void) { return m_bHaveDebugger; }
static inline bool bLogX86Code(void) { return m_bLogX86Code; }
static inline bool bShowTLBMisses(void) { return m_bShowTLBMisses; }
static inline bool bShowDivByZero(void) { return m_bShowDivByZero; }
private:
static void StaticRefreshSettings (CDebugSettings * _this)
{
_this->RefreshSettings();
}
static void StaticRefreshSettings(CDebugSettings * _this)
{
_this->RefreshSettings();
}
void RefreshSettings ( void );
void RefreshSettings(void);
//Settings that can be changed on the fly
static bool m_bHaveDebugger;
static bool m_bLogX86Code;
static bool m_bShowTLBMisses;
static bool m_bShowDivByZero;
//Settings that can be changed on the fly
static bool m_bHaveDebugger;
static bool m_bLogX86Code;
static bool m_bShowTLBMisses;
static bool m_bShowDivByZero;
static int m_RefCount;
static bool m_Registered;
static int m_RefCount;
static bool m_Registered;
};