GSDump: initial implementation of the run feature

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2021-01-30 13:36:29 +01:00 committed by Kojin
parent f1df1de64f
commit e94b5f9e54
4 changed files with 26 additions and 5 deletions

View File

@ -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 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 *_GSopen)(void *pDsp, const char *Title, int multithread);
typedef s32(CALLBACK *_GSopen2)(void *pDsp, u32 flags); 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 *_GSvsync)(int field);
typedef void(CALLBACK *_GSgifTransfer)(const u32 *pMem, u32 size); typedef void(CALLBACK *_GSgifTransfer)(const u32 *pMem, u32 size);
typedef void(CALLBACK *_GSgifTransfer1)(u32 *pMem, u32 addr); typedef void(CALLBACK *_GSgifTransfer1)(u32 *pMem, u32 addr);
@ -202,6 +203,7 @@ extern _GSosdLog GSosdLog;
extern _GSosdMonitor GSosdMonitor; extern _GSosdMonitor GSosdMonitor;
extern _GSopen GSopen; extern _GSopen GSopen;
extern _GSopen2 GSopen2; extern _GSopen2 GSopen2;
extern _GSReplay GSReplay;
extern _GSvsync GSvsync; extern _GSvsync GSvsync;
extern _GSgifTransfer GSgifTransfer; extern _GSgifTransfer GSgifTransfer;
extern _GSgifTransfer1 GSgifTransfer1; extern _GSgifTransfer1 GSgifTransfer1;

View File

@ -157,6 +157,7 @@ _GSosdLog GSosdLog;
_GSosdMonitor GSosdMonitor; _GSosdMonitor GSosdMonitor;
_GSopen GSopen; _GSopen GSopen;
_GSopen2 GSopen2; _GSopen2 GSopen2;
_GSReplay GSReplay;
_GSgifTransfer GSgifTransfer; _GSgifTransfer GSgifTransfer;
_GSgifTransfer1 GSgifTransfer1; _GSgifTransfer1 GSgifTransfer1;
_GSgifTransfer2 GSgifTransfer2; _GSgifTransfer2 GSgifTransfer2;
@ -315,6 +316,7 @@ static const LegacyApi_OptMethod s_MethMessOpt_GS[] =
{ "GSosdLog", (vMeth**)&GSosdLog }, { "GSosdLog", (vMeth**)&GSosdLog },
{ "GSosdMonitor", (vMeth**)&GSosdMonitor }, { "GSosdMonitor", (vMeth**)&GSosdMonitor },
{ "GSopen2", (vMeth**)&GSopen2 }, { "GSopen2", (vMeth**)&GSopen2 },
{ "GSReplay", (vMeth**)&GSReplay },
{ "GSreset", (vMeth**)&GSreset }, { "GSreset", (vMeth**)&GSreset },
{ "GSsetupRecording", (vMeth**)&GSsetupRecording }, { "GSsetupRecording", (vMeth**)&GSsetupRecording },
{ "GSendRecording", (vMeth**)&GSendRecording }, { "GSendRecording", (vMeth**)&GSendRecording },

View File

@ -23,6 +23,7 @@
#include "Utilities/EmbeddedImage.h" #include "Utilities/EmbeddedImage.h"
#include "Resources/NoIcon.h" #include "Resources/NoIcon.h"
#include "GS.h"
#include "PathDefs.h" #include "PathDefs.h"
#include "AppConfig.h" #include "AppConfig.h"
@ -47,6 +48,7 @@ Dialogs::GSDumpDialog::GSDumpDialog(wxWindow* parent)
: wxDialogWithHelpers(parent, _("GSDumpGov"), pxDialogFlags()) : wxDialogWithHelpers(parent, _("GSDumpGov"), pxDialogFlags())
, m_dump_list(new wxListView(this, ID_DUMP_LIST, wxDefaultPosition, wxSize(250, 200))) , m_dump_list(new wxListView(this, ID_DUMP_LIST, wxDefaultPosition, wxSize(250, 200)))
, m_preview_image(new wxStaticBitmap(this, wxID_ANY, wxBitmap(EmbeddedImage<res_NoIcon>().Get()))) , m_preview_image(new wxStaticBitmap(this, wxID_ANY, wxBitmap(EmbeddedImage<res_NoIcon>().Get())))
, m_selected_dump(new wxString(""))
{ {
const float scale = MSW_GetDPIScale(); const float scale = MSW_GetDPIScale();
SetMinWidth(scale * 460); 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, _("D3D11 HW"));
dump_info += new wxRadioButton(this, wxID_ANY, _("OGL HW")); dump_info += new wxRadioButton(this, wxID_ANY, _("OGL HW"));
dump_info += new wxRadioButton(this, wxID_ANY, _("OGL SW")); 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()); SetSizerAndFit(GetSizer());
Bind(wxEVT_LIST_ITEM_SELECTED, &Dialogs::GSDumpDialog::SelectedDump, this, ID_DUMP_LIST); 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() void Dialogs::GSDumpDialog::GetDumpsList()
@ -128,15 +131,26 @@ void Dialogs::GSDumpDialog::GetDumpsList()
void Dialogs::GSDumpDialog::SelectedDump(wxListEvent& evt) void Dialogs::GSDumpDialog::SelectedDump(wxListEvent& evt)
{ {
wxString filename = g_Conf->Folders.Snapshots.ToAscii() + ("/" + evt.GetText()) + ".png"; wxString filename_preview = g_Conf->Folders.Snapshots.ToAscii() + ("/" + evt.GetText()) + ".png";
if (wxFileExists(filename)) 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); img.Rescale(250 * MSW_GetDPIScale(), 200 * MSW_GetDPIScale(), wxIMAGE_QUALITY_HIGH);
m_preview_image->SetBitmap(wxBitmap(img)); m_preview_image->SetBitmap(wxBitmap(img));
delete m_selected_dump;
m_selected_dump = new wxString(filename);
} }
else else
{ {
m_preview_image->SetBitmap(EmbeddedImage<res_NoIcon>().Get()); m_preview_image->SetBitmap(EmbeddedImage<res_NoIcon>().Get());
} }
} }
void Dialogs::GSDumpDialog::RunDump(wxCommandEvent& event)
{
if (GSReplay != NULL)
{
GSReplay("test", 0);
}
}

View File

@ -86,11 +86,14 @@ namespace Dialogs
protected: protected:
wxListView* m_dump_list; wxListView* m_dump_list;
wxStaticBitmap* m_preview_image; wxStaticBitmap* m_preview_image;
wxString* m_selected_dump;
void GetDumpsList(); void GetDumpsList();
void SelectedDump(wxListEvent& evt); void SelectedDump(wxListEvent& evt);
void RunDump(wxCommandEvent& event);
enum enum
{ {
ID_DUMP_LIST ID_DUMP_LIST,
ID_RUN_DUMP
}; };
}; };