From a2808d94ce1e53224444d56cd575c33db7bb9d1f Mon Sep 17 00:00:00 2001 From: shygoo Date: Sat, 8 Dec 2018 06:45:52 -0600 Subject: [PATCH] [Debugger] Make auto-refresh optional in memory viewer --- Source/Project64-core/Settings.cpp | 1 + Source/Project64-core/Settings/SettingsID.h | 1 + .../UserInterface/Debugger/Debugger-ViewMemory.cpp | 12 +++++++++++- .../UserInterface/Debugger/Debugger-ViewMemory.h | 2 ++ Source/Project64/UserInterface/UIResources.rc | 7 ++++++- Source/Project64/UserInterface/resource.h | 5 +++-- 6 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Source/Project64-core/Settings.cpp b/Source/Project64-core/Settings.cpp index dd61177a8..cf1603c86 100644 --- a/Source/Project64-core/Settings.cpp +++ b/Source/Project64-core/Settings.cpp @@ -330,6 +330,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory) AddHandler(Debugger_WriteBPExists, new CSettingTypeTempBool(false)); AddHandler(Debugger_ReadBPExists, new CSettingTypeTempBool(false)); AddHandler(Debugger_WaitingForStep, new CSettingTypeTempBool(false)); + AddHandler(Debugger_AutoRefreshMemoryView, new CSettingTypeApplication("Debugger", "Auto Referesh Memory View", true)); 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-core/Settings/SettingsID.h b/Source/Project64-core/Settings/SettingsID.h index af221c4d7..06c9b11e4 100644 --- a/Source/Project64-core/Settings/SettingsID.h +++ b/Source/Project64-core/Settings/SettingsID.h @@ -246,6 +246,7 @@ enum SettingID Debugger_WriteBPExists, Debugger_ReadBPExists, Debugger_WaitingForStep, + Debugger_AutoRefreshMemoryView, //Trace Debugger_TraceMD5, diff --git a/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.cpp b/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.cpp index 8c3cca60f..de974e4df 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.cpp @@ -119,6 +119,9 @@ LRESULT CDebugMemoryView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM m_SymInfo.Attach(GetDlgItem(IDC_SYM_INFO)); m_DMAInfo.Attach(GetDlgItem(IDC_DMA_INFO)); + m_bAutoRefreshEnabled = g_Settings->LoadBool(Debugger_AutoRefreshMemoryView); + SendDlgItemMessage(IDC_CHK_AUTOREFRESH, BM_SETCHECK, m_bAutoRefreshEnabled ? BST_CHECKED : BST_UNCHECKED, 0); + _this = this; DWORD dwThreadID = ::GetCurrentThreadId(); @@ -136,7 +139,10 @@ DWORD WINAPI CDebugMemoryView::AutoRefreshProc(void* _self) CDebugMemoryView* self = (CDebugMemoryView*)_self; while (true) { - self->RefreshMemory(true); + if (self->m_bAutoRefreshEnabled) + { + self->RefreshMemory(true); + } Sleep(100); } } @@ -203,6 +209,10 @@ LRESULT CDebugMemoryView::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL& case IDC_SYMBOLS_BTN: m_Debugger->OpenSymbolsWindow(); break; + case IDC_CHK_AUTOREFRESH: + m_bAutoRefreshEnabled = (SendMessage(GetDlgItem(IDC_CHK_AUTOREFRESH), BM_GETSTATE, 0, 0) & BST_CHECKED) != 0; + g_Settings->SaveBool(Debugger_AutoRefreshMemoryView, m_bAutoRefreshEnabled); + break; case IDCANCEL: EndDialog(0); break; diff --git a/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.h b/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.h index 582e8b62f..9f01a34b6 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.h @@ -72,6 +72,8 @@ private: CStatic m_SymInfo; CStatic m_DMAInfo; + bool m_bAutoRefreshEnabled; + CBreakpoints* m_Breakpoints; int m_SymbolColorStride; diff --git a/Source/Project64/UserInterface/UIResources.rc b/Source/Project64/UserInterface/UIResources.rc index bbf840a83..55b975d86 100644 --- a/Source/Project64/UserInterface/UIResources.rc +++ b/Source/Project64/UserInterface/UIResources.rc @@ -25,7 +25,6 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) - #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // @@ -529,6 +528,7 @@ BEGIN LTEXT "",IDC_SYM_INFO,8,198,418,8 LTEXT "",IDC_DMA_INFO,8,208,415,8 GROUPBOX "",IDC_STATIC,4,190,428,30 + CONTROL "Auto",IDC_CHK_AUTOREFRESH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,218,7,31,8 END IDD_Debugger_Search DIALOGEX 0, 0, 229, 233 @@ -1881,6 +1881,11 @@ BEGIN 0 END +IDD_Debugger_Memory AFX_DIALOG_LAYOUT +BEGIN + 0 +END + ///////////////////////////////////////////////////////////////////////////// // diff --git a/Source/Project64/UserInterface/resource.h b/Source/Project64/UserInterface/resource.h index 8e34ce16d..56370dbb9 100644 --- a/Source/Project64/UserInterface/resource.h +++ b/Source/Project64/UserInterface/resource.h @@ -603,6 +603,7 @@ #define IDC_DD44_EDIT 1443 #define IDC_DD48_EDIT 1444 #define IDC_ROM_FIXEDAUDIO 1445 +#define IDC_CHK_AUTOREFRESH 1446 #define ID_POPUP_SHOWINMEMORYVIEWER 40005 #define ID_POPUPMENU_PLAYGAMEWITHDISK 40008 #define ID_POPUPMENU_ADDSYMBOL 40013 @@ -638,9 +639,9 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 195 +#define _APS_NEXT_RESOURCE_VALUE 196 #define _APS_NEXT_COMMAND_VALUE 40043 -#define _APS_NEXT_CONTROL_VALUE 1446 +#define _APS_NEXT_CONTROL_VALUE 1447 #define _APS_NEXT_SYMED_VALUE 102 #endif #endif