diff --git a/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp b/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp index 1649991d44..4e22b8fbdf 100644 --- a/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp @@ -19,6 +19,7 @@ #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/IniFile.h" +#include "Core/ConfigManager.h" #include "Core/HW/Memmap.h" #include "Core/PowerPC/PowerPC.h" #include "DolphinWX/WxUtils.h" @@ -66,7 +67,7 @@ public: } AddTool(ID_LOAD, _("Load"), m_Bitmaps[Toolbar_Delete]); - Bind(wxEVT_TOOL, &CBreakPointWindow::LoadAll, parent, ID_LOAD); + Bind(wxEVT_TOOL, &CBreakPointWindow::Event_LoadAll, parent, ID_LOAD); AddTool(ID_SAVE, _("Save"), m_Bitmaps[Toolbar_Delete]); Bind(wxEVT_TOOL, &CBreakPointWindow::Event_SaveAll, parent, ID_SAVE); @@ -180,32 +181,38 @@ void CBreakPointWindow::SaveAll() { // simply dump all to bp/mc files in a way we can read again IniFile ini; - if (ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX))) - { - ini.SetLines("BreakPoints", PowerPC::breakpoints.GetStrings()); - ini.SetLines("MemoryChecks", PowerPC::memchecks.GetStrings()); - ini.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX)); - } + ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() + ".ini", false); + ini.SetLines("BreakPoints", PowerPC::breakpoints.GetStrings()); + ini.SetLines("MemoryChecks", PowerPC::memchecks.GetStrings()); + ini.Save(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() + ".ini"); } -void CBreakPointWindow::LoadAll(wxCommandEvent& WXUNUSED(event)) +void CBreakPointWindow::Event_LoadAll(wxCommandEvent& WXUNUSED(event)) +{ + LoadAll(); + return; +} + +void CBreakPointWindow::LoadAll() { IniFile ini; BreakPoints::TBreakPointsStr newbps; MemChecks::TMemChecksStr newmcs; - 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("BreakPoints", &newbps, false)) { + PowerPC::breakpoints.Clear(); PowerPC::breakpoints.AddFromStrings(newbps); } if (ini.GetLines("MemoryChecks", &newmcs, false)) { + PowerPC::memchecks.Clear(); PowerPC::memchecks.AddFromStrings(newmcs); } diff --git a/Source/Core/DolphinWX/Debugger/BreakpointWindow.h b/Source/Core/DolphinWX/Debugger/BreakpointWindow.h index 8c2ffc9a2b..03549a241c 100644 --- a/Source/Core/DolphinWX/Debugger/BreakpointWindow.h +++ b/Source/Core/DolphinWX/Debugger/BreakpointWindow.h @@ -39,7 +39,8 @@ public: void OnAddMemoryCheck(wxCommandEvent& WXUNUSED(event)); void Event_SaveAll(wxCommandEvent& WXUNUSED(event)); void SaveAll(); - void LoadAll(wxCommandEvent& WXUNUSED(event)); + void Event_LoadAll(wxCommandEvent& WXUNUSED(event)); + void LoadAll(); private: DECLARE_EVENT_TABLE(); 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::LoadAll(wxCommandEvent& WXUNUSED(event)) +void CWatchWindow::Event_LoadAll(wxCommandEvent& WXUNUSED(event)) +{ + LoadAll(); +} + +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); } diff --git a/Source/Core/DolphinWX/Debugger/WatchWindow.h b/Source/Core/DolphinWX/Debugger/WatchWindow.h index 2f7dd75839..360974dcb3 100644 --- a/Source/Core/DolphinWX/Debugger/WatchWindow.h +++ b/Source/Core/DolphinWX/Debugger/WatchWindow.h @@ -26,11 +26,13 @@ public: const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL | wxNO_BORDER, const wxString& name = _("Watch")); + ~CWatchWindow(); void NotifyUpdate(); void Event_SaveAll(wxCommandEvent& WXUNUSED(event)); void SaveAll(); - void LoadAll(wxCommandEvent& WXUNUSED(event)); + void Event_LoadAll(wxCommandEvent& WXUNUSED(event)); + void LoadAll(); private: DECLARE_EVENT_TABLE(); diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index eb9c6632a7..2ef29ccecc 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -78,7 +78,9 @@ #include "DolphinWX/WXInputBase.h" #include "DolphinWX/WxUtils.h" #include "DolphinWX/Cheats/CheatsWindow.h" +#include "DolphinWX/Debugger/BreakpointWindow.h" #include "DolphinWX/Debugger/CodeWindow.h" +#include "DolphinWX/Debugger/WatchWindow.h" #include "InputCommon/ControllerInterface/ControllerInterface.h" @@ -656,7 +658,19 @@ void CFrame::BootGame(const std::string& filename) } } if (!bootfile.empty()) + { StartGame(bootfile); + if (UseDebugger) + { + if (g_pCodeWindow) + { + if (g_pCodeWindow->m_WatchWindow) + g_pCodeWindow->m_WatchWindow->LoadAll(); + if (g_pCodeWindow->m_BreakpointWindow) + g_pCodeWindow->m_BreakpointWindow->LoadAll(); + } + } + } } // Open file to boot @@ -1163,6 +1177,25 @@ void CFrame::DoStop() } } + if (UseDebugger) + { + if (g_pCodeWindow) + { + if (g_pCodeWindow->m_WatchWindow) + { + g_pCodeWindow->m_WatchWindow->SaveAll(); + PowerPC::watches.Clear(); + } + if (g_pCodeWindow->m_BreakpointWindow) + { + g_pCodeWindow->m_BreakpointWindow->SaveAll(); + PowerPC::breakpoints.Clear(); + PowerPC::memchecks.Clear(); + g_pCodeWindow->m_BreakpointWindow->NotifyUpdate(); + } + } + } + // TODO: Show the author/description dialog here if (Movie::IsRecordingInput()) DoRecordingSave();