Breakpoints and watches are now loaded and saved on start/stop.

Saved Breakpoints and watches per game in the game ini.
This commit is contained in:
skidau 2014-10-25 00:13:53 +11:00
parent b73130af77
commit 8d2931cf18
5 changed files with 72 additions and 19 deletions

View File

@ -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.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(F_DEBUGGERCONFIG_IDX));
}
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);
}

View File

@ -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();

View File

@ -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.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() + ".ini", false);
ini.SetLines("Watches", PowerPC::watches.GetStrings());
ini.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
}
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);
}

View File

@ -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();

View File

@ -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();