gsdump: add a settings button; add safety checks for user missing braincells

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2021-03-14 18:25:39 +01:00 committed by Kojin
parent d5b312866d
commit 6c73256196
3 changed files with 37 additions and 1 deletions

View File

@ -68,6 +68,7 @@ Dialogs::GSDumpDialog::GSDumpDialog(wxWindow* parent)
, m_step(new wxButton(this, ID_RUN_STEP, _("Step"), wxDefaultPosition, wxSize(150, 50))) , m_step(new wxButton(this, ID_RUN_STEP, _("Step"), wxDefaultPosition, wxSize(150, 50)))
, m_selection(new wxButton(this, ID_RUN_CURSOR, _("Run to Selection"), wxDefaultPosition, wxSize(150, 50))) , m_selection(new wxButton(this, ID_RUN_CURSOR, _("Run to Selection"), wxDefaultPosition, wxSize(150, 50)))
, m_vsync(new wxButton(this, ID_RUN_VSYNC, _("Go to next VSync"), wxDefaultPosition, wxSize(150, 50))) , m_vsync(new wxButton(this, ID_RUN_VSYNC, _("Go to next VSync"), wxDefaultPosition, wxSize(150, 50)))
, m_settings(new wxButton(this, ID_SETTINGS, _("Open GS Settings"), wxDefaultPosition, wxSize(150, 50)))
, m_thread(std::make_unique<GSThread>(this)) , m_thread(std::make_unique<GSThread>(this))
, m_run(new wxButton(this, ID_RUN_DUMP, _("Run"), wxDefaultPosition, wxSize(150, 100))) , m_run(new wxButton(this, ID_RUN_DUMP, _("Run"), wxDefaultPosition, wxSize(150, 100)))
{ {
@ -95,6 +96,7 @@ Dialogs::GSDumpDialog::GSDumpDialog(wxWindow* parent)
dbg_actions->Add(m_step, StdExpand()); dbg_actions->Add(m_step, StdExpand());
dbg_actions->Add(m_selection, StdExpand()); dbg_actions->Add(m_selection, StdExpand());
dbg_actions->Add(m_vsync, StdExpand()); dbg_actions->Add(m_vsync, StdExpand());
dbg_actions->Add(m_settings, StdExpand());
gif->Add(new wxStaticText(this, wxID_ANY, _("Packet Content"))); gif->Add(new wxStaticText(this, wxID_ANY, _("Packet Content")));
gif->Add(m_gif_packet, StdExpand()); gif->Add(m_gif_packet, StdExpand());
@ -135,6 +137,7 @@ Dialogs::GSDumpDialog::GSDumpDialog(wxWindow* parent)
Bind(wxEVT_BUTTON, &Dialogs::GSDumpDialog::StepPacket, this, ID_RUN_STEP); Bind(wxEVT_BUTTON, &Dialogs::GSDumpDialog::StepPacket, this, ID_RUN_STEP);
Bind(wxEVT_BUTTON, &Dialogs::GSDumpDialog::ToCursor, this, ID_RUN_CURSOR); Bind(wxEVT_BUTTON, &Dialogs::GSDumpDialog::ToCursor, this, ID_RUN_CURSOR);
Bind(wxEVT_BUTTON, &Dialogs::GSDumpDialog::ToVSync, this, ID_RUN_VSYNC); Bind(wxEVT_BUTTON, &Dialogs::GSDumpDialog::ToVSync, this, ID_RUN_VSYNC);
Bind(wxEVT_BUTTON, &Dialogs::GSDumpDialog::OpenSettings, this, ID_SETTINGS);
Bind(wxEVT_TREE_SEL_CHANGED, &Dialogs::GSDumpDialog::ParsePacket, this, ID_SEL_PACKET); Bind(wxEVT_TREE_SEL_CHANGED, &Dialogs::GSDumpDialog::ParsePacket, this, ID_SEL_PACKET);
Bind(wxEVT_CHECKBOX, &Dialogs::GSDumpDialog::CheckDebug, this, ID_DEBUG_MODE); Bind(wxEVT_CHECKBOX, &Dialogs::GSDumpDialog::CheckDebug, this, ID_DEBUG_MODE);
Bind(EVT_CLOSE_DUMP, &Dialogs::GSDumpDialog::CloseDump, this); Bind(EVT_CLOSE_DUMP, &Dialogs::GSDumpDialog::CloseDump, this);
@ -270,6 +273,11 @@ void Dialogs::GSDumpDialog::ToVSync(wxCommandEvent& event)
} }
} }
void Dialogs::GSDumpDialog::OpenSettings(wxCommandEvent& event)
{
GetCorePlugins().Configure(PluginId_GS);
}
void Dialogs::GSDumpDialog::ToStart(wxCommandEvent& event) void Dialogs::GSDumpDialog::ToStart(wxCommandEvent& event)
{ {
m_gif_list->SelectItem(m_gif_items[0]); m_gif_list->SelectItem(m_gif_items[0]);

View File

@ -161,6 +161,7 @@ namespace Dialogs
wxButton* m_step; wxButton* m_step;
wxButton* m_selection; wxButton* m_selection;
wxButton* m_vsync; wxButton* m_vsync;
wxButton* m_settings;
wxButton* m_run; wxButton* m_run;
long m_focused_dump; long m_focused_dump;
wxFileSystemWatcher m_fs_watcher; wxFileSystemWatcher m_fs_watcher;
@ -172,6 +173,7 @@ namespace Dialogs
void StepPacket(wxCommandEvent& event); void StepPacket(wxCommandEvent& event);
void ToCursor(wxCommandEvent& event); void ToCursor(wxCommandEvent& event);
void ToVSync(wxCommandEvent& event); void ToVSync(wxCommandEvent& event);
void OpenSettings(wxCommandEvent& event);
void ParsePacket(wxTreeEvent& event); void ParsePacket(wxTreeEvent& event);
void CheckDebug(wxCommandEvent& event); void CheckDebug(wxCommandEvent& event);
void PathChanged(wxFileSystemWatcherEvent& event); void PathChanged(wxFileSystemWatcherEvent& event);
@ -184,7 +186,8 @@ namespace Dialogs
ID_RUN_CURSOR, ID_RUN_CURSOR,
ID_RUN_VSYNC, ID_RUN_VSYNC,
ID_SEL_PACKET, ID_SEL_PACKET,
ID_DEBUG_MODE ID_DEBUG_MODE,
ID_SETTINGS
}; };
enum GSType : u8 enum GSType : u8
{ {

View File

@ -165,6 +165,11 @@ void MainEmuFrame::Menu_ResetAllSettings_Click(wxCommandEvent& event)
// (anything else) - Standard swap, no reset. (hotswap!) // (anything else) - Standard swap, no reset. (hotswap!)
wxWindowID SwapOrReset_Iso(wxWindow* owner, IScopedCoreThread& core_control, const wxString& isoFilename, const wxString& descpart1) wxWindowID SwapOrReset_Iso(wxWindow* owner, IScopedCoreThread& core_control, const wxString& isoFilename, const wxString& descpart1)
{ {
if (GSDump::isRunning)
{
wxMessageBox("Please close the GS debugger first before playing a game", _("GS Debugger"), wxICON_ERROR);
return wxID_CANCEL;
}
wxWindowID result = wxID_CANCEL; wxWindowID result = wxID_CANCEL;
if ((g_Conf->CdvdSource == CDVD_SourceType::Iso) && (isoFilename == g_Conf->CurrentIso)) if ((g_Conf->CdvdSource == CDVD_SourceType::Iso) && (isoFilename == g_Conf->CurrentIso))
@ -222,6 +227,11 @@ wxWindowID SwapOrReset_Iso(wxWindow* owner, IScopedCoreThread& core_control, con
// (anything else) - Standard swap, no reset. (hotswap!) // (anything else) - Standard swap, no reset. (hotswap!)
wxWindowID SwapOrReset_Disc(wxWindow* owner, IScopedCoreThread& core, const wxString driveLetter) wxWindowID SwapOrReset_Disc(wxWindow* owner, IScopedCoreThread& core, const wxString driveLetter)
{ {
if (GSDump::isRunning)
{
wxMessageBox("Please close the GS debugger first before playing a game", _("GS Debugger"), wxICON_ERROR);
return wxID_CANCEL;
}
wxWindowID result = wxID_CANCEL; wxWindowID result = wxID_CANCEL;
if ((g_Conf->CdvdSource == CDVD_SourceType::Disc) && (driveLetter == g_Conf->Folders.RunDisc.GetPath())) if ((g_Conf->CdvdSource == CDVD_SourceType::Disc) && (driveLetter == g_Conf->Folders.RunDisc.GetPath()))
@ -270,6 +280,11 @@ wxWindowID SwapOrReset_Disc(wxWindow* owner, IScopedCoreThread& core, const wxSt
wxWindowID SwapOrReset_CdvdSrc(wxWindow* owner, CDVD_SourceType newsrc) wxWindowID SwapOrReset_CdvdSrc(wxWindow* owner, CDVD_SourceType newsrc)
{ {
if (GSDump::isRunning)
{
wxMessageBox("Please close the GS debugger first before playing a game", _("GS Debugger"), wxICON_ERROR);
return wxID_CANCEL;
}
if (newsrc == g_Conf->CdvdSource) if (newsrc == g_Conf->CdvdSource)
return wxID_CANCEL; return wxID_CANCEL;
wxWindowID result = wxID_CANCEL; wxWindowID result = wxID_CANCEL;
@ -406,6 +421,11 @@ bool MainEmuFrame::_DoSelectELFBrowser()
void MainEmuFrame::_DoBootCdvd() void MainEmuFrame::_DoBootCdvd()
{ {
if (GSDump::isRunning)
{
wxMessageBox("Please close the GS debugger first before playing a game", _("GS Debugger"), wxICON_ERROR);
return;
}
ScopedCoreThreadPause paused_core; ScopedCoreThreadPause paused_core;
if (g_Conf->CdvdSource == CDVD_SourceType::Iso) if (g_Conf->CdvdSource == CDVD_SourceType::Iso)
@ -823,6 +843,11 @@ void MainEmuFrame::Menu_SysShutdown_Click(wxCommandEvent& event)
void MainEmuFrame::Menu_ConfigPlugin_Click(wxCommandEvent& event) void MainEmuFrame::Menu_ConfigPlugin_Click(wxCommandEvent& event)
{ {
if (GSDump::isRunning)
{
wxMessageBox("Please open the settings window from the main GS Debugger window", _("GS Debugger"), wxICON_ERROR);
return;
}
const int eventId = event.GetId() - MenuId_PluginBase_Settings; const int eventId = event.GetId() - MenuId_PluginBase_Settings;
PluginsEnum_t pid = (PluginsEnum_t)(eventId / PluginMenuId_Interval); PluginsEnum_t pid = (PluginsEnum_t)(eventId / PluginMenuId_Interval);