[Debugger] Make eeprom alerts to be able to turn on or off
This commit is contained in:
parent
3fb6710bb3
commit
3388a053f3
|
@ -74,22 +74,22 @@ void CEeprom::EepromCommand(uint8_t * Command)
|
|||
case 4: // Read from Eeprom
|
||||
if (Command[0] != 2 && HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError("What am I meant to do with this Eeprom Command");
|
||||
ProcessingError(Command);
|
||||
}
|
||||
if (Command[1] != 8 && HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError("What am I meant to do with this Eeprom Command");
|
||||
ProcessingError(Command);
|
||||
}
|
||||
ReadFrom(&Command[4], Command[3]);
|
||||
break;
|
||||
case 5: //Write to Eeprom
|
||||
if (Command[0] != 10 && HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError("What am I meant to do with this Eeprom Command");
|
||||
ProcessingError(Command);
|
||||
}
|
||||
if (Command[1] != 1 && HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError("What am I meant to do with this Eeprom Command");
|
||||
ProcessingError(Command);
|
||||
}
|
||||
WriteTo(&Command[4], Command[3]);
|
||||
break;
|
||||
|
@ -126,13 +126,13 @@ void CEeprom::EepromCommand(uint8_t * Command)
|
|||
break;
|
||||
case 8:
|
||||
//Write RTC, unimplemented
|
||||
if (g_Settings->LoadDword(Debugger_ShowPifErrors))
|
||||
if (bShowPifRamErrors())
|
||||
{
|
||||
g_Notify->DisplayError("Write RTC, unimplemented");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (g_Settings->LoadDword(Debugger_ShowPifErrors))
|
||||
if (bShowPifRamErrors())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Unknown EepromCommand %d", Command[2]).c_str());
|
||||
}
|
||||
|
@ -200,4 +200,12 @@ void CEeprom::WriteTo(uint8_t * Buffer, int32_t line)
|
|||
m_File.Seek(line * 8, CFile::begin);
|
||||
m_File.Write(Buffer, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CEeprom::ProcessingError(uint8_t * /*Command*/)
|
||||
{
|
||||
if (bShowPifRamErrors())
|
||||
{
|
||||
g_Notify->DisplayError("What am I meant to do with this Eeprom Command");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <Project64-core/Settings/DebugSettings.h>
|
||||
|
||||
class CEeprom :
|
||||
private CDebugSettings
|
||||
protected CDebugSettings
|
||||
{
|
||||
public:
|
||||
CEeprom(bool ReadOnly);
|
||||
|
@ -25,6 +25,7 @@ private:
|
|||
CEeprom(const CEeprom&); // Disable copy constructor
|
||||
CEeprom& operator=(const CEeprom&); // Disable assignment
|
||||
|
||||
void ProcessingError(uint8_t * Command);
|
||||
void LoadEeprom();
|
||||
void ReadFrom(uint8_t * Buffer, int32_t line);
|
||||
void WriteTo(uint8_t * Buffer, int32_t line);
|
||||
|
|
|
@ -22,35 +22,8 @@
|
|||
#include <Project64-core/N64System/Mips/Mempak.h>
|
||||
#include <Project64-core/Logging.h>
|
||||
|
||||
int32_t CPifRamSettings::m_RefCount = 0;
|
||||
bool CPifRamSettings::m_bShowPifRamErrors = false;
|
||||
|
||||
CPifRamSettings::CPifRamSettings()
|
||||
{
|
||||
m_RefCount += 1;
|
||||
if (m_RefCount == 1)
|
||||
{
|
||||
g_Settings->RegisterChangeCB(Debugger_ShowPifErrors, NULL, RefreshSettings);
|
||||
RefreshSettings(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
CPifRamSettings::~CPifRamSettings()
|
||||
{
|
||||
m_RefCount -= 1;
|
||||
if (m_RefCount == 0)
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(Debugger_ShowPifErrors, NULL, RefreshSettings);
|
||||
}
|
||||
}
|
||||
|
||||
void CPifRamSettings::RefreshSettings(void *)
|
||||
{
|
||||
m_bShowPifRamErrors = g_Settings->LoadBool(Debugger_ShowPifErrors);
|
||||
}
|
||||
|
||||
CPifRam::CPifRam(bool SavesReadOnly) :
|
||||
CEeprom(SavesReadOnly)
|
||||
CEeprom(SavesReadOnly)
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
|
|
@ -13,28 +13,8 @@
|
|||
#include <Project64-core/Logging.h>
|
||||
#include <Project64-core/N64System/Mips/Eeprom.h>
|
||||
|
||||
class CPifRamSettings
|
||||
{
|
||||
protected:
|
||||
CPifRamSettings();
|
||||
virtual ~CPifRamSettings();
|
||||
|
||||
bool bShowPifRamErrors() const
|
||||
{
|
||||
return m_bShowPifRamErrors;
|
||||
}
|
||||
|
||||
private:
|
||||
static void RefreshSettings(void*);
|
||||
|
||||
static bool m_bShowPifRamErrors;
|
||||
|
||||
static int32_t m_RefCount;
|
||||
};
|
||||
|
||||
class CPifRam :
|
||||
public CLogging,
|
||||
private CPifRamSettings,
|
||||
private CEeprom
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -27,6 +27,7 @@ bool CDebugSettings::m_RecordExecutionTimes = false;
|
|||
bool CDebugSettings::m_HaveExecutionBP = false;
|
||||
bool CDebugSettings::m_HaveWriteBP = false;
|
||||
bool CDebugSettings::m_HaveReadBP = false;
|
||||
bool CDebugSettings::m_bShowPifRamErrors = false;
|
||||
|
||||
CDebugSettings::CDebugSettings()
|
||||
{
|
||||
|
@ -45,6 +46,7 @@ CDebugSettings::CDebugSettings()
|
|||
g_Settings->RegisterChangeCB(Debugger_WriteBPExists, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
g_Settings->RegisterChangeCB(Debugger_ReadBPExists, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
g_Settings->RegisterChangeCB(Debugger_WaitingForStep, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
g_Settings->RegisterChangeCB(Debugger_ShowPifErrors, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
|
||||
RefreshSettings();
|
||||
}
|
||||
|
@ -65,6 +67,7 @@ CDebugSettings::~CDebugSettings()
|
|||
g_Settings->UnregisterChangeCB(Debugger_HaveExecutionBP, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
g_Settings->UnregisterChangeCB(Debugger_WriteBPExists, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
g_Settings->UnregisterChangeCB(Debugger_WaitingForStep, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
g_Settings->UnregisterChangeCB(Debugger_ShowPifErrors, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,6 +84,7 @@ void CDebugSettings::RefreshSettings()
|
|||
m_HaveExecutionBP = m_HaveDebugger && g_Settings->LoadBool(Debugger_HaveExecutionBP);
|
||||
m_HaveWriteBP = m_HaveDebugger && g_Settings->LoadBool(Debugger_WriteBPExists);
|
||||
m_HaveReadBP = m_HaveDebugger && g_Settings->LoadBool(Debugger_ReadBPExists);
|
||||
m_bShowPifRamErrors = m_HaveDebugger && g_Settings->LoadBool(Debugger_ShowPifErrors);
|
||||
|
||||
m_Debugging = m_HaveDebugger && (m_HaveExecutionBP || m_WaitingForStep || m_HaveWriteBP || m_HaveReadBP);
|
||||
}
|
|
@ -30,7 +30,8 @@ public:
|
|||
static inline bool HaveExecutionBP(void) { return m_HaveExecutionBP; }
|
||||
static inline bool HaveWriteBP(void) { return m_HaveWriteBP; }
|
||||
static inline bool HaveReadBP(void) { return m_HaveReadBP; }
|
||||
|
||||
static inline bool bShowPifRamErrors(void) { return m_bShowPifRamErrors; }
|
||||
|
||||
private:
|
||||
static void StaticRefreshSettings(CDebugSettings * _this)
|
||||
{
|
||||
|
@ -51,7 +52,8 @@ private:
|
|||
static bool m_HaveExecutionBP;
|
||||
static bool m_HaveWriteBP;
|
||||
static bool m_HaveReadBP;
|
||||
|
||||
static bool m_bShowPifRamErrors;
|
||||
|
||||
static int32_t m_RefCount;
|
||||
static bool m_Registered;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue