From 72f1d9963410e5c80e74a0d99f56b6ac7ed39e03 Mon Sep 17 00:00:00 2001 From: aldelaro5 Date: Thu, 18 Aug 2016 16:08:26 -0400 Subject: [PATCH] Implement the configuration of how a breakpoint is added in the memory window There might be a better way to highlight the options when adding the memory check, but for now, this works and the breakpoint list reports the right settings anyway. --- Source/Core/DolphinWX/Debugger/MemoryView.cpp | 2 +- Source/Core/DolphinWX/Debugger/MemoryView.h | 11 ++++++++ .../Core/DolphinWX/Debugger/MemoryWindow.cpp | 27 ++++++++++++++++++- Source/Core/DolphinWX/Debugger/MemoryWindow.h | 6 +++++ 4 files changed, 44 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinWX/Debugger/MemoryView.cpp b/Source/Core/DolphinWX/Debugger/MemoryView.cpp index 195cd965b3..485b131584 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryView.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryView.cpp @@ -82,7 +82,7 @@ void CMemoryView::OnMouseDownL(wxMouseEvent& event) } else { - debugger->ToggleMemCheck(YToAddress(y)); + debugger->ToggleMemCheck(YToAddress(y), memCheckRead, memCheckWrite, memCheckLog); Refresh(); diff --git a/Source/Core/DolphinWX/Debugger/MemoryView.h b/Source/Core/DolphinWX/Debugger/MemoryView.h index c540e96c70..03cb68d21f 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryView.h +++ b/Source/Core/DolphinWX/Debugger/MemoryView.h @@ -35,6 +35,13 @@ public: Refresh(); } + void SetMemCheckOptions(bool read, bool write, bool log) + { + memCheckRead = read; + memCheckWrite = write; + memCheckLog = log; + } + private: void OnPaint(wxPaintEvent& event); void OnMouseDownL(wxMouseEvent& event); @@ -60,6 +67,10 @@ private: int curAddress; MemoryDataType dataType; + bool memCheckRead; + bool memCheckWrite; + bool memCheckLog; + enum EViewAsType { VIEWAS_ASCII = 0, diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index bfd5829ef0..17dea4a17d 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -47,7 +48,8 @@ enum IDM_U32, IDM_SEARCH, IDM_ASCII, - IDM_HEX + IDM_HEX, + IDM_MEMCHECK_OPTIONS_CHANGE }; BEGIN_EVENT_TABLE(CMemoryWindow, wxPanel) @@ -63,6 +65,8 @@ EVT_CHECKBOX(IDM_U32, CMemoryWindow::U32) EVT_BUTTON(IDM_SEARCH, CMemoryWindow::onSearch) EVT_CHECKBOX(IDM_ASCII, CMemoryWindow::onAscii) EVT_CHECKBOX(IDM_HEX, CMemoryWindow::onHex) +EVT_RADIOBUTTON(IDM_MEMCHECK_OPTIONS_CHANGE, CMemoryWindow::onMemCheckOptionChange) +EVT_CHECKBOX(IDM_MEMCHECK_OPTIONS_CHANGE, CMemoryWindow::onMemCheckOptionChange) END_EVENT_TABLE() CMemoryWindow::CMemoryWindow(CCodeWindow* code_window, wxWindow* parent, wxWindowID id, @@ -104,12 +108,24 @@ CMemoryWindow::CMemoryWindow(CCodeWindow* code_window, wxWindow* parent, wxWindo sizerDataTypes->Add(chk16 = new wxCheckBox(this, IDM_U16, "U16")); sizerDataTypes->Add(chk32 = new wxCheckBox(this, IDM_U32, "U32")); + wxStaticBoxSizer* const sizerMemCheckOptions = + new wxStaticBoxSizer(wxVERTICAL, this, "Memory check options"); + sizerMemCheckOptions->Add(rdbReadWrite = new wxRadioButton(this, IDM_MEMCHECK_OPTIONS_CHANGE, + "Read and Write", wxDefaultPosition, + wxDefaultSize, wxRB_GROUP)); + sizerMemCheckOptions->Add(rdbRead = + new wxRadioButton(this, IDM_MEMCHECK_OPTIONS_CHANGE, "Read only")); + sizerMemCheckOptions->Add(rdbWrite = + new wxRadioButton(this, IDM_MEMCHECK_OPTIONS_CHANGE, "Write only")); + sizerMemCheckOptions->Add(chkLog = new wxCheckBox(this, IDM_MEMCHECK_OPTIONS_CHANGE, "Log")); + wxBoxSizer* const sizerRight = new wxBoxSizer(wxVERTICAL); sizerRight->Add(search_sizer); sizerRight->AddSpacer(5); sizerRight->Add(dump_sizer); sizerRight->Add(sizerSearchType); sizerRight->Add(sizerDataTypes); + sizerRight->Add(sizerMemCheckOptions); wxBoxSizer* const sizerBig = new wxBoxSizer(wxHORIZONTAL); sizerBig->Add(memview, 20, wxEXPAND); @@ -118,6 +134,7 @@ CMemoryWindow::CMemoryWindow(CCodeWindow* code_window, wxWindow* parent, wxWindo SetSizer(sizerBig); chkHex->SetValue(1); // Set defaults chk8->SetValue(1); + chkLog->SetValue(1); sizerRight->Fit(this); sizerBig->Fit(this); @@ -450,3 +467,11 @@ void CMemoryWindow::onHex(wxCommandEvent& event) { chkAscii->SetValue(0); } + +void CMemoryWindow::onMemCheckOptionChange(wxCommandEvent& event) +{ + if (rdbReadWrite->GetValue()) + memview->SetMemCheckOptions(true, true, chkLog->GetValue()); + else + memview->SetMemCheckOptions(rdbRead->GetValue(), rdbWrite->GetValue(), chkLog->GetValue()); +} diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.h b/Source/Core/DolphinWX/Debugger/MemoryWindow.h index 3eca29e613..f9ff2ca285 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.h +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.h @@ -15,6 +15,7 @@ class wxCheckBox; class wxListBox; class wxSearchCtrl; class wxTextCtrl; +class wxRadioButton; class CMemoryWindow : public wxPanel { @@ -48,6 +49,7 @@ private: void OnDumpMemory(wxCommandEvent& event); void OnDumpMem2(wxCommandEvent& event); void OnDumpFakeVMEM(wxCommandEvent& event); + void onMemCheckOptionChange(wxCommandEvent& event); wxCheckBox* chk8; wxCheckBox* chk16; @@ -55,6 +57,10 @@ private: wxButton* btnSearch; wxCheckBox* chkAscii; wxCheckBox* chkHex; + wxCheckBox* chkLog; + wxRadioButton* rdbRead; + wxRadioButton* rdbWrite; + wxRadioButton* rdbReadWrite; CCodeWindow* m_code_window;