diff --git a/common/include/PS2Edefs.h b/common/include/PS2Edefs.h index f5e1c0cb27..99962c19c9 100644 --- a/common/include/PS2Edefs.h +++ b/common/include/PS2Edefs.h @@ -166,6 +166,7 @@ typedef void(CALLBACK *_GSosdLog)(const char *utf8, u32 color); typedef void(CALLBACK *_GSosdMonitor)(const char *key, const char *value, u32 color); typedef s32(CALLBACK *_GSopen)(void *pDsp, const char *Title, int multithread); typedef s32(CALLBACK *_GSopen2)(void *pDsp, u32 flags); +typedef s32(CALLBACK* _GSReplay)(char* lpszCmdLine, int renderer); typedef void(CALLBACK *_GSvsync)(int field); typedef void(CALLBACK *_GSgifTransfer)(const u32 *pMem, u32 size); typedef void(CALLBACK *_GSgifTransfer1)(u32 *pMem, u32 addr); @@ -202,6 +203,7 @@ extern _GSosdLog GSosdLog; extern _GSosdMonitor GSosdMonitor; extern _GSopen GSopen; extern _GSopen2 GSopen2; +extern _GSReplay GSReplay; extern _GSvsync GSvsync; extern _GSgifTransfer GSgifTransfer; extern _GSgifTransfer1 GSgifTransfer1; diff --git a/pcsx2/PluginManager.cpp b/pcsx2/PluginManager.cpp index 4880c04378..ecc3822cf2 100644 --- a/pcsx2/PluginManager.cpp +++ b/pcsx2/PluginManager.cpp @@ -157,6 +157,7 @@ _GSosdLog GSosdLog; _GSosdMonitor GSosdMonitor; _GSopen GSopen; _GSopen2 GSopen2; +_GSReplay GSReplay; _GSgifTransfer GSgifTransfer; _GSgifTransfer1 GSgifTransfer1; _GSgifTransfer2 GSgifTransfer2; @@ -315,6 +316,7 @@ static const LegacyApi_OptMethod s_MethMessOpt_GS[] = { "GSosdLog", (vMeth**)&GSosdLog }, { "GSosdMonitor", (vMeth**)&GSosdMonitor }, { "GSopen2", (vMeth**)&GSopen2 }, + { "GSReplay", (vMeth**)&GSReplay }, { "GSreset", (vMeth**)&GSreset }, { "GSsetupRecording", (vMeth**)&GSsetupRecording }, { "GSendRecording", (vMeth**)&GSendRecording }, diff --git a/pcsx2/gui/Dialogs/GSDumpDialog.cpp b/pcsx2/gui/Dialogs/GSDumpDialog.cpp index 8ab8ff076a..99fde5728f 100644 --- a/pcsx2/gui/Dialogs/GSDumpDialog.cpp +++ b/pcsx2/gui/Dialogs/GSDumpDialog.cpp @@ -23,6 +23,7 @@ #include "Utilities/EmbeddedImage.h" #include "Resources/NoIcon.h" +#include "GS.h" #include "PathDefs.h" #include "AppConfig.h" @@ -47,6 +48,7 @@ Dialogs::GSDumpDialog::GSDumpDialog(wxWindow* parent) : wxDialogWithHelpers(parent, _("GSDumpGov"), pxDialogFlags()) , m_dump_list(new wxListView(this, ID_DUMP_LIST, wxDefaultPosition, wxSize(250, 200))) , m_preview_image(new wxStaticBitmap(this, wxID_ANY, wxBitmap(EmbeddedImage().Get()))) + , m_selected_dump(new wxString("")) { const float scale = MSW_GetDPIScale(); SetMinWidth(scale * 460); @@ -65,7 +67,7 @@ Dialogs::GSDumpDialog::GSDumpDialog(wxWindow* parent) dump_info += new wxRadioButton(this, wxID_ANY, _("D3D11 HW")); dump_info += new wxRadioButton(this, wxID_ANY, _("OGL HW")); dump_info += new wxRadioButton(this, wxID_ANY, _("OGL SW")); - dump_info += new wxButton(this, wxID_ANY, _("Run")); + dump_info += new wxButton(this, ID_RUN_DUMP, _("Run")); @@ -109,6 +111,7 @@ Dialogs::GSDumpDialog::GSDumpDialog(wxWindow* parent) SetSizerAndFit(GetSizer()); Bind(wxEVT_LIST_ITEM_SELECTED, &Dialogs::GSDumpDialog::SelectedDump, this, ID_DUMP_LIST); + Bind(wxEVT_BUTTON, &Dialogs::GSDumpDialog::RunDump, this, ID_RUN_DUMP); } void Dialogs::GSDumpDialog::GetDumpsList() @@ -128,15 +131,26 @@ void Dialogs::GSDumpDialog::GetDumpsList() void Dialogs::GSDumpDialog::SelectedDump(wxListEvent& evt) { - wxString filename = g_Conf->Folders.Snapshots.ToAscii() + ("/" + evt.GetText()) + ".png"; - if (wxFileExists(filename)) + wxString filename_preview = g_Conf->Folders.Snapshots.ToAscii() + ("/" + evt.GetText()) + ".png"; + wxString filename = g_Conf->Folders.Snapshots.ToAscii() + ("/" + evt.GetText()) + ".gs"; + if (wxFileExists(filename_preview)) { - auto img = wxImage(filename); + auto img = wxImage(filename_preview); img.Rescale(250 * MSW_GetDPIScale(), 200 * MSW_GetDPIScale(), wxIMAGE_QUALITY_HIGH); m_preview_image->SetBitmap(wxBitmap(img)); + delete m_selected_dump; + m_selected_dump = new wxString(filename); } else { m_preview_image->SetBitmap(EmbeddedImage().Get()); } } + +void Dialogs::GSDumpDialog::RunDump(wxCommandEvent& event) +{ + if (GSReplay != NULL) + { + GSReplay("test", 0); + } +} \ No newline at end of file diff --git a/pcsx2/gui/Dialogs/ModalPopups.h b/pcsx2/gui/Dialogs/ModalPopups.h index cb004771d1..05a147b118 100644 --- a/pcsx2/gui/Dialogs/ModalPopups.h +++ b/pcsx2/gui/Dialogs/ModalPopups.h @@ -86,11 +86,14 @@ namespace Dialogs protected: wxListView* m_dump_list; wxStaticBitmap* m_preview_image; + wxString* m_selected_dump; void GetDumpsList(); void SelectedDump(wxListEvent& evt); + void RunDump(wxCommandEvent& event); enum { - ID_DUMP_LIST + ID_DUMP_LIST, + ID_RUN_DUMP }; };