diff --git a/Source/Project64-core/Settings/DebugSettings.cpp b/Source/Project64-core/Settings/DebugSettings.cpp index 99f127feb..c1f4c5946 100644 --- a/Source/Project64-core/Settings/DebugSettings.cpp +++ b/Source/Project64-core/Settings/DebugSettings.cpp @@ -19,6 +19,7 @@ bool CDebugSettings::m_bShowTLBMisses = false; bool CDebugSettings::m_bShowDivByZero = false; bool CDebugSettings::m_Registered = false; bool CDebugSettings::m_RecordExecutionTimes = false; +bool CDebugSettings::m_HaveExecutionBP = false; CDebugSettings::CDebugSettings() { @@ -31,6 +32,7 @@ CDebugSettings::CDebugSettings() g_Settings->RegisterChangeCB(Debugger_ShowTLBMisses, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); g_Settings->RegisterChangeCB(Debugger_ShowDivByZero, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); g_Settings->RegisterChangeCB(Debugger_RecordExecutionTimes, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); + g_Settings->RegisterChangeCB(Debugger_HaveExecutionBP, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); RefreshSettings(); } @@ -46,6 +48,7 @@ CDebugSettings::~CDebugSettings() g_Settings->UnregisterChangeCB(Debugger_ShowTLBMisses, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); g_Settings->UnregisterChangeCB(Debugger_ShowDivByZero, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); g_Settings->UnregisterChangeCB(Debugger_RecordExecutionTimes, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); + g_Settings->UnregisterChangeCB(Debugger_HaveExecutionBP, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); } } @@ -56,4 +59,5 @@ void CDebugSettings::RefreshSettings() m_bShowTLBMisses = m_bHaveDebugger && g_Settings->LoadBool(Debugger_ShowTLBMisses); m_bShowDivByZero = m_bHaveDebugger && g_Settings->LoadBool(Debugger_ShowDivByZero); m_RecordExecutionTimes = g_Settings->LoadBool(Debugger_RecordExecutionTimes); + m_HaveExecutionBP = g_Settings->LoadBool(Debugger_HaveExecutionBP); } \ No newline at end of file diff --git a/Source/Project64-core/Settings/DebugSettings.h b/Source/Project64-core/Settings/DebugSettings.h index 8d472bfee..c5bfe2202 100644 --- a/Source/Project64-core/Settings/DebugSettings.h +++ b/Source/Project64-core/Settings/DebugSettings.h @@ -23,6 +23,7 @@ public: static inline bool bShowTLBMisses(void) { return m_bShowTLBMisses; } static inline bool bShowDivByZero(void) { return m_bShowDivByZero; } static inline bool bRecordExecutionTimes(void) { return m_RecordExecutionTimes; } + static inline bool HaveExecutionBP(void) { return m_HaveExecutionBP; } private: static void StaticRefreshSettings(CDebugSettings * _this) @@ -38,6 +39,7 @@ private: static bool m_bShowTLBMisses; static bool m_bShowDivByZero; static bool m_RecordExecutionTimes; + static bool m_HaveExecutionBP; static int32_t m_RefCount; static bool m_Registered; diff --git a/Source/Project64-core/Settings/Settings.h b/Source/Project64-core/Settings/Settings.h index 55aa82039..1c998c287 100644 --- a/Source/Project64-core/Settings/Settings.h +++ b/Source/Project64-core/Settings/Settings.h @@ -229,6 +229,7 @@ enum SettingID Debugger_ShowRecompMemSize, Debugger_DebugLanguage, Debugger_RecordExecutionTimes, + Debugger_HaveExecutionBP, //Trace Debugger_TraceMD5, diff --git a/Source/Project64-core/Settings/SettingsClass.cpp b/Source/Project64-core/Settings/SettingsClass.cpp index 690eb04ac..4ef6f4e6b 100644 --- a/Source/Project64-core/Settings/SettingsClass.cpp +++ b/Source/Project64-core/Settings/SettingsClass.cpp @@ -314,6 +314,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory) AddHandler(Debugger_ShowDListAListCount, new CSettingTypeApplication("Debugger", "Show Dlist Alist Count", false)); AddHandler(Debugger_ShowRecompMemSize, new CSettingTypeApplication("Debugger", "Show Recompiler Memory size", false)); AddHandler(Debugger_RecordExecutionTimes, new CSettingTypeApplication("Debugger", "Record Execution Times", false)); + AddHandler(Debugger_HaveExecutionBP, new CSettingTypeTempBool(false)); AddHandler(Debugger_DebugLanguage, new CSettingTypeApplication("Debugger", "Debug Language", false)); AddHandler(Debugger_ShowDivByZero, new CSettingTypeApplication("Debugger", "Show Div by zero", false)); AddHandler(Debugger_AppLogFlush, new CSettingTypeApplication("Logging", "Log Auto Flush", (uint32_t)false)); diff --git a/Source/Project64/UserInterface/Debugger/Breakpoints.cpp b/Source/Project64/UserInterface/Debugger/Breakpoints.cpp index 508daf5f8..b0eff2c4f 100644 --- a/Source/Project64/UserInterface/Debugger/Breakpoints.cpp +++ b/Source/Project64/UserInterface/Debugger/Breakpoints.cpp @@ -82,12 +82,16 @@ bool CBreakpoints::WBPAdd(uint32_t address, bool bTemporary) bool CBreakpoints::AddExecution(uint32_t address, bool bTemporary) { - if (!ExecutionBPExists(address)) + breakpoints_t::_Pairib res = m_Execution.insert(breakpoint_t::value_type(address, bTemporary)); + if (!res.second && !bTemporary) { - m_Execution.insert(breakpoints_t::value_type(address, bTemporary)); - return true; + res.first->second = true; } - return false; + if (!HaveExecutionBP()) + { + g_Settings->SaveBool(Debugger_HaveExecutionBP, true); + } + return !res.second; } void CBreakpoints::RBPRemove(uint32_t address) @@ -114,6 +118,10 @@ void CBreakpoints::RemoveExecution(uint32_t address) if (itr != m_Execution.end()) { m_Execution.erase(itr); + if (m_Execution.size() == 0) + { + g_Settings->SaveBool(Debugger_HaveExecutionBP, false); + } } } diff --git a/Source/Project64/UserInterface/Debugger/Breakpoints.h b/Source/Project64/UserInterface/Debugger/Breakpoints.h index 2080b015f..3bc1c9f4d 100644 --- a/Source/Project64/UserInterface/Debugger/Breakpoints.h +++ b/Source/Project64/UserInterface/Debugger/Breakpoints.h @@ -12,7 +12,8 @@ #include #include -class CBreakpoints +class CBreakpoints : + private CDebugSettings { public: typedef std::map breakpoints_t; diff --git a/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.h b/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.h index 676f86c7c..f3c8fcaf6 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.h @@ -25,7 +25,7 @@ public: BEGIN_MSG_MAP_EX(CRegEdit64) MESSAGE_HANDLER(WM_CHAR, OnChar) MESSAGE_HANDLER(WM_KILLFOCUS, OnLostFocus) - END_MSG_MAP() + END_MSG_MAP() }; class CRegisterTabs : public CTabCtrl @@ -67,7 +67,8 @@ private: IDC_R28_EDIT, IDC_R29_EDIT, IDC_R30_EDIT, IDC_R31_EDIT, }; - static constexpr WORD FPREditIds[] = { + static constexpr WORD FPREditIds[] = + { IDC_F0_EDIT, IDC_F1_EDIT, IDC_F2_EDIT, IDC_F3_EDIT, IDC_F4_EDIT, IDC_F5_EDIT, IDC_F6_EDIT, IDC_F7_EDIT, IDC_F8_EDIT, IDC_F9_EDIT, IDC_F10_EDIT, IDC_F11_EDIT, @@ -78,7 +79,8 @@ private: IDC_F28_EDIT, IDC_F29_EDIT, IDC_F30_EDIT, IDC_F31_EDIT, }; - static constexpr WORD COP0EditIds[] = { + static constexpr WORD COP0EditIds[] = + { IDC_COP0_0_EDIT, IDC_COP0_1_EDIT, IDC_COP0_2_EDIT, IDC_COP0_3_EDIT, IDC_COP0_4_EDIT, IDC_COP0_5_EDIT, IDC_COP0_6_EDIT, IDC_COP0_7_EDIT, IDC_COP0_8_EDIT, IDC_COP0_9_EDIT, IDC_COP0_10_EDIT, IDC_COP0_11_EDIT, @@ -86,55 +88,65 @@ private: IDC_COP0_16_EDIT, IDC_COP0_17_EDIT, IDC_COP0_18_EDIT, }; - static constexpr WORD RDRAMEditIds[] = { + static constexpr WORD RDRAMEditIds[] = + { IDC_RDRAM00_EDIT, IDC_RDRAM04_EDIT, IDC_RDRAM08_EDIT, IDC_RDRAM0C_EDIT, IDC_RDRAM10_EDIT, IDC_RDRAM14_EDIT, IDC_RDRAM18_EDIT, IDC_RDRAM1C_EDIT, IDC_RDRAM20_EDIT, IDC_RDRAM24_EDIT, }; - static constexpr WORD SPEditIds[] = { + static constexpr WORD SPEditIds[] = + { IDC_SP00_EDIT, IDC_SP04_EDIT, IDC_SP08_EDIT, IDC_SP0C_EDIT, IDC_SP10_EDIT, IDC_SP14_EDIT, IDC_SP18_EDIT, IDC_SP1C_EDIT, }; - static constexpr WORD DPCEditIds[] = { + static constexpr WORD DPCEditIds[] = + { IDC_DPC00_EDIT, IDC_DPC04_EDIT, IDC_DPC08_EDIT, IDC_DPC0C_EDIT, IDC_DPC10_EDIT, IDC_DPC14_EDIT, IDC_DPC18_EDIT, IDC_DPC1C_EDIT, }; - static constexpr WORD MIEditIds[] = { + static constexpr WORD MIEditIds[] = + { IDC_MI00_EDIT, IDC_MI04_EDIT, IDC_MI08_EDIT, IDC_MI0C_EDIT, }; - static constexpr WORD VIEditIds[] = { + static constexpr WORD VIEditIds[] = + { IDC_VI00_EDIT, IDC_VI04_EDIT, IDC_VI08_EDIT, IDC_VI0C_EDIT, IDC_VI10_EDIT, IDC_VI14_EDIT, IDC_VI18_EDIT, IDC_VI1C_EDIT, IDC_VI20_EDIT, IDC_VI24_EDIT, IDC_VI28_EDIT, IDC_VI2C_EDIT, IDC_VI30_EDIT, IDC_VI34_EDIT, }; - static constexpr WORD AIEditIds[] = { + static constexpr WORD AIEditIds[] = + { IDC_AI00_EDIT, IDC_AI04_EDIT, IDC_AI08_EDIT, IDC_AI0C_EDIT, IDC_AI10_EDIT, IDC_AI14_EDIT, }; - static constexpr WORD PIEditIds[] = { + static constexpr WORD PIEditIds[] = + { IDC_PI00_EDIT, IDC_PI04_EDIT, IDC_PI08_EDIT, IDC_PI0C_EDIT, IDC_PI10_EDIT, IDC_PI14_EDIT, IDC_PI18_EDIT, IDC_PI1C_EDIT, IDC_PI20_EDIT, IDC_PI24_EDIT, IDC_PI28_EDIT, IDC_PI2C_EDIT, IDC_PI30_EDIT, }; - static constexpr WORD RIEditIds[] = { + static constexpr WORD RIEditIds[] = + { IDC_RI00_EDIT, IDC_RI04_EDIT, IDC_RI08_EDIT, IDC_RI0C_EDIT, IDC_RI10_EDIT, IDC_RI14_EDIT, IDC_RI18_EDIT, IDC_RI1C_EDIT, }; - static constexpr WORD SIEditIds[] = { + static constexpr WORD SIEditIds[] = + { IDC_SI00_EDIT, IDC_SI04_EDIT, IDC_SI08_EDIT, IDC_SI0C_EDIT, }; - static constexpr WORD DDEditIds[] = { + static constexpr WORD DDEditIds[] = + { IDC_DD00_EDIT, IDC_DD04_EDIT, IDC_DD08_EDIT, IDC_DD0C_EDIT, IDC_DD10_EDIT, IDC_DD14_EDIT, IDC_DD18_EDIT, IDC_DD1C_EDIT, IDC_DD20_EDIT, IDC_DD24_EDIT, IDC_DD28_EDIT, IDC_DD2C_EDIT, @@ -154,7 +166,8 @@ private: return -1; } - static constexpr char* ExceptionCodes[] = { + static constexpr char* ExceptionCodes[] = + { "Interrupt", "TLB mod", "TLB load/fetch",