From 613cae613a8c2ac34dd823f875ac4a6a0059db38 Mon Sep 17 00:00:00 2001 From: skidau Date: Sun, 19 Oct 2014 21:45:40 +1100 Subject: Added a RAM Watch window to the debugger Conflicts: Source/Core/Core/HW/Memmap.cpp Source/Core/Core/HW/Memmap.h Source/Core/DolphinWX/Debugger/CodeWindow.h --- Source/Core/DolphinWX/Debugger/WatchWindow.cpp | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Source/Core/DolphinWX/Debugger/WatchWindow.cpp (limited to 'Source/Core/DolphinWX/Debugger/WatchWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/WatchWindow.cpp b/Source/Core/DolphinWX/Debugger/WatchWindow.cpp new file mode 100644 index 0000000000..8f6f578b01 --- /dev/null +++ b/Source/Core/DolphinWX/Debugger/WatchWindow.cpp @@ -0,0 +1,46 @@ +// Copyright 2013 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "DolphinWX/Debugger/WatchView.h" +#include "DolphinWX/Debugger/WatchWindow.h" + +class wxWindow; + +BEGIN_EVENT_TABLE(CWatchWindow, wxPanel) +END_EVENT_TABLE() + + +CWatchWindow::CWatchWindow(wxWindow* parent, wxWindowID id, + const wxPoint& position, const wxSize& size, + long style, const wxString& name) + : wxPanel(parent, id, position, size, style, name) + , m_GPRGridView(nullptr) +{ + CreateGUIControls(); +} + +void CWatchWindow::CreateGUIControls() +{ + wxBoxSizer *sGrid = new wxBoxSizer(wxVERTICAL); + m_GPRGridView = new CWatchView(this, ID_GPR); + sGrid->Add(m_GPRGridView, 1, wxGROW); + SetSizer(sGrid); + + NotifyUpdate(); +} + +void CWatchWindow::NotifyUpdate() +{ + if (m_GPRGridView != nullptr) + m_GPRGridView->Update(); +} -- cgit v1.2.3 From b34e220086a79a0e6f1824d2f7c94894a90d2998 Mon Sep 17 00:00:00 2001 From: skidau Date: Fri, 24 Oct 2014 17:16:54 +1100 Subject: Added a "Delete watch" context menu to the Watch window. Added a "View memory" command to the context menu. --- Source/Core/DolphinWX/Debugger/WatchWindow.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Source/Core/DolphinWX/Debugger/WatchWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/WatchWindow.cpp b/Source/Core/DolphinWX/Debugger/WatchWindow.cpp index 8f6f578b01..7ac1630625 100644 --- a/Source/Core/DolphinWX/Debugger/WatchWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/WatchWindow.cpp @@ -17,6 +17,8 @@ class wxWindow; BEGIN_EVENT_TABLE(CWatchWindow, wxPanel) +EVT_GRID_CELL_RIGHT_CLICK(CWatchView::OnMouseDownR) +EVT_MENU(-1, CWatchView::OnPopupMenu) END_EVENT_TABLE() -- cgit v1.2.3 From b73130af77e4a978e7837a0e40431af768d2f34c Mon Sep 17 00:00:00 2001 From: skidau Date: Fri, 24 Oct 2014 22:24:17 +1100 Subject: Added Load/Save function for the Watch window. Made the floating windows toolbars dockable. Scaled down the breakpoint toolbar icons to 16x16. --- Source/Core/DolphinWX/Debugger/WatchWindow.cpp | 89 ++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 5 deletions(-) (limited to 'Source/Core/DolphinWX/Debugger/WatchWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/WatchWindow.cpp b/Source/Core/DolphinWX/Debugger/WatchWindow.cpp index 7ac1630625..dc25d32d4b 100644 --- a/Source/Core/DolphinWX/Debugger/WatchWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/WatchWindow.cpp @@ -3,6 +3,8 @@ // Refer to the license.txt file included. #include + +#include #include #include #include @@ -10,10 +12,19 @@ #include #include #include +#include +#include "Common/FileUtil.h" +#include "Common/IniFile.h" +#include "Core/PowerPC/PowerPC.h" +#include "DolphinWX/WxUtils.h" #include "DolphinWX/Debugger/WatchView.h" #include "DolphinWX/Debugger/WatchWindow.h" +extern "C" { +#include "DolphinWX/resources/toolbar_debugger_delete.c" +} + class wxWindow; BEGIN_EVENT_TABLE(CWatchWindow, wxPanel) @@ -21,6 +32,40 @@ EVT_GRID_CELL_RIGHT_CLICK(CWatchView::OnMouseDownR) EVT_MENU(-1, CWatchView::OnPopupMenu) END_EVENT_TABLE() +class CWatchToolbar : public wxAuiToolBar +{ +public: +CWatchToolbar(CWatchWindow* parent, const wxWindowID id) + : wxAuiToolBar(parent, id, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_TEXT) +{ + SetToolBitmapSize(wxSize(16, 16)); + + m_Bitmaps[Toolbar_File] = wxBitmap(wxGetBitmapFromMemory(toolbar_delete_png).ConvertToImage().Rescale(16, 16)); + + AddTool(ID_LOAD, _("Load"), m_Bitmaps[Toolbar_File]); + Bind(wxEVT_TOOL, &CWatchWindow::LoadAll, parent, ID_LOAD); + + AddTool(ID_SAVE, _("Save"), m_Bitmaps[Toolbar_File]); + Bind(wxEVT_TOOL, &CWatchWindow::Event_SaveAll, parent, ID_SAVE); +} + +private: + + enum + { + Toolbar_File, + Num_Bitmaps + }; + + enum + { + ID_LOAD, + ID_SAVE + }; + + wxBitmap m_Bitmaps[Num_Bitmaps]; +}; CWatchWindow::CWatchWindow(wxWindow* parent, wxWindowID id, const wxPoint& position, const wxSize& size, @@ -28,17 +73,18 @@ CWatchWindow::CWatchWindow(wxWindow* parent, wxWindowID id, : wxPanel(parent, id, position, size, style, name) , m_GPRGridView(nullptr) { - CreateGUIControls(); -} + m_mgr.SetManagedWindow(this); + m_mgr.SetFlags(wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE); -void CWatchWindow::CreateGUIControls() -{ wxBoxSizer *sGrid = new wxBoxSizer(wxVERTICAL); m_GPRGridView = new CWatchView(this, ID_GPR); sGrid->Add(m_GPRGridView, 1, wxGROW); SetSizer(sGrid); - NotifyUpdate(); + m_mgr.AddPane(new CWatchToolbar(this, wxID_ANY), wxAuiPaneInfo().ToolbarPane().Top(). + LeftDockable(true).RightDockable(true).BottomDockable(false).Floatable(false)); + m_mgr.AddPane(m_GPRGridView, wxAuiPaneInfo().CenterPane()); + m_mgr.Update(); } void CWatchWindow::NotifyUpdate() @@ -46,3 +92,36 @@ void CWatchWindow::NotifyUpdate() if (m_GPRGridView != nullptr) m_GPRGridView->Update(); } + +void CWatchWindow::Event_SaveAll(wxCommandEvent& WXUNUSED(event)) +{ + SaveAll(); +} + +void CWatchWindow::SaveAll() +{ + IniFile ini; + if (ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX))) + { + ini.SetLines("Watches", PowerPC::watches.GetStrings()); + ini.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX)); + } +} + +void CWatchWindow::LoadAll(wxCommandEvent& WXUNUSED(event)) +{ + IniFile ini; + Watches::TWatchesStr watches; + + if (!ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX))) + { + return; + } + + if (ini.GetLines("Watches", &watches, false)) + { + PowerPC::watches.AddFromStrings(watches); + } + + NotifyUpdate(); +} -- cgit v1.2.3 From 8d2931cf1803234ced2429a6bf5dbb8b934e9f38 Mon Sep 17 00:00:00 2001 From: skidau Date: Sat, 25 Oct 2014 00:13:53 +1100 Subject: Breakpoints and watches are now loaded and saved on start/stop. Saved Breakpoints and watches per game in the game ini. --- Source/Core/DolphinWX/Debugger/WatchWindow.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'Source/Core/DolphinWX/Debugger/WatchWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/WatchWindow.cpp b/Source/Core/DolphinWX/Debugger/WatchWindow.cpp index dc25d32d4b..ef192b7419 100644 --- a/Source/Core/DolphinWX/Debugger/WatchWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/WatchWindow.cpp @@ -16,6 +16,7 @@ #include "Common/FileUtil.h" #include "Common/IniFile.h" +#include "Core/ConfigManager.h" #include "Core/PowerPC/PowerPC.h" #include "DolphinWX/WxUtils.h" #include "DolphinWX/Debugger/WatchView.h" @@ -44,7 +45,7 @@ CWatchToolbar(CWatchWindow* parent, const wxWindowID id) m_Bitmaps[Toolbar_File] = wxBitmap(wxGetBitmapFromMemory(toolbar_delete_png).ConvertToImage().Rescale(16, 16)); AddTool(ID_LOAD, _("Load"), m_Bitmaps[Toolbar_File]); - Bind(wxEVT_TOOL, &CWatchWindow::LoadAll, parent, ID_LOAD); + Bind(wxEVT_TOOL, &CWatchWindow::Event_LoadAll, parent, ID_LOAD); AddTool(ID_SAVE, _("Save"), m_Bitmaps[Toolbar_File]); Bind(wxEVT_TOOL, &CWatchWindow::Event_SaveAll, parent, ID_SAVE); @@ -87,6 +88,11 @@ CWatchWindow::CWatchWindow(wxWindow* parent, wxWindowID id, m_mgr.Update(); } +CWatchWindow::~CWatchWindow() +{ + m_mgr.UnInit(); +} + void CWatchWindow::NotifyUpdate() { if (m_GPRGridView != nullptr) @@ -101,25 +107,29 @@ void CWatchWindow::Event_SaveAll(wxCommandEvent& WXUNUSED(event)) void CWatchWindow::SaveAll() { IniFile ini; - if (ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX))) - { - ini.SetLines("Watches", PowerPC::watches.GetStrings()); - ini.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX)); - } + ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() + ".ini", false); + ini.SetLines("Watches", PowerPC::watches.GetStrings()); + ini.Save(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() + ".ini"); +} + +void CWatchWindow::Event_LoadAll(wxCommandEvent& WXUNUSED(event)) +{ + LoadAll(); } -void CWatchWindow::LoadAll(wxCommandEvent& WXUNUSED(event)) +void CWatchWindow::LoadAll() { IniFile ini; Watches::TWatchesStr watches; - if (!ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX))) + if (!ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() + ".ini", false)) { return; } if (ini.GetLines("Watches", &watches, false)) { + PowerPC::watches.Clear(); PowerPC::watches.AddFromStrings(watches); } -- cgit v1.2.3