[Projec64] Clean up Recompiler Settings.cpp

This commit is contained in:
zilmar 2015-11-15 08:05:48 +11:00
parent 0745cab320
commit 5be42089b0
2 changed files with 33 additions and 34 deletions

View File

@ -10,35 +10,35 @@
****************************************************************************/
#include "stdafx.h"
int CRecompilerSettings::m_RefCount = 0;
int CRecompilerSettings::m_RefCount = 0;
bool CRecompilerSettings::m_bShowRecompMemSize;
bool CRecompilerSettings::m_bProfiling;
bool CRecompilerSettings::m_bProfiling;
CRecompilerSettings::CRecompilerSettings()
{
m_RefCount += 1;
if (m_RefCount == 1)
{
g_Settings->RegisterChangeCB(Debugger_ShowRecompMemSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->RegisterChangeCB(Debugger_ProfileCode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
RefreshSettings();
}
m_RefCount += 1;
if (m_RefCount == 1)
{
g_Settings->RegisterChangeCB(Debugger_ShowRecompMemSize, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->RegisterChangeCB(Debugger_ProfileCode, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
RefreshSettings();
}
}
CRecompilerSettings::~CRecompilerSettings()
{
m_RefCount -= 1;
if (m_RefCount == 0)
{
g_Settings->UnregisterChangeCB(Debugger_ShowRecompMemSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->UnregisterChangeCB(Debugger_ProfileCode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
}
m_RefCount -= 1;
if (m_RefCount == 0)
{
g_Settings->UnregisterChangeCB(Debugger_ShowRecompMemSize, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->UnregisterChangeCB(Debugger_ProfileCode, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
}
}
void CRecompilerSettings::RefreshSettings()
{
m_bShowRecompMemSize = g_Settings->LoadBool(Debugger_ShowRecompMemSize);
m_bProfiling = g_Settings->LoadBool(Debugger_ProfileCode);
}
m_bShowRecompMemSize = g_Settings->LoadBool(Debugger_ShowRecompMemSize);
m_bProfiling = g_Settings->LoadBool(Debugger_ProfileCode);
}

View File

@ -12,28 +12,27 @@
#include <N64 System/N64 Types.h>
class CRecompilerSettings
class CRecompilerSettings
{
public:
CRecompilerSettings();
virtual ~CRecompilerSettings();
CRecompilerSettings();
virtual ~CRecompilerSettings();
static bool bShowRecompMemSize ( void ) { return m_bShowRecompMemSize; }
static bool bShowRecompMemSize(void) { return m_bShowRecompMemSize; }
static bool bProfiling ( void ) { return m_bProfiling; }
static bool bProfiling(void) { return m_bProfiling; }
private:
static void StaticRefreshSettings (CRecompilerSettings * _this)
{
_this->RefreshSettings();
}
static void StaticRefreshSettings(CRecompilerSettings * _this)
{
_this->RefreshSettings();
}
void RefreshSettings ( void );
void RefreshSettings(void);
//Settings that can be changed on the fly
static bool m_bShowRecompMemSize;
static bool m_bProfiling;
//Settings that can be changed on the fly
static bool m_bShowRecompMemSize;
static bool m_bProfiling;
static int m_RefCount;
static int m_RefCount;
};