diff --git a/pcsx2/gui/Dialogs/GSDumpDialog.cpp b/pcsx2/gui/Dialogs/GSDumpDialog.cpp index c909b692f2..c0cedc3a7b 100644 --- a/pcsx2/gui/Dialogs/GSDumpDialog.cpp +++ b/pcsx2/gui/Dialogs/GSDumpDialog.cpp @@ -24,6 +24,9 @@ #include "Utilities/EmbeddedImage.h" #include "Resources/NoIcon.h" +#include "PathDefs.h" +#include "AppConfig.h" + #include #include #include @@ -31,6 +34,7 @@ #include #include #include +#include using namespace pxSizerFlags; @@ -40,6 +44,7 @@ using namespace pxSizerFlags; Dialogs::GSDumpDialog::GSDumpDialog(wxWindow* parent) : wxDialogWithHelpers(parent, _("GSDumpGov"), pxDialogFlags()) + , m_dump_list(new wxListView(this, wxID_ANY, wxDefaultPosition, wxSize(250, 200))) { const float scale = MSW_GetDPIScale(); SetMinWidth(scale * 460); @@ -54,7 +59,6 @@ Dialogs::GSDumpDialog::GSDumpDialog(wxWindow* parent) wxBoxSizer& gif(*new wxBoxSizer(wxVERTICAL)); wxBoxSizer& dumps_list(*new wxBoxSizer(wxVERTICAL)); - //dump_info += new wxFilePickerCtrl(this, wxID_ANY); dump_info += new wxRadioButton(this, wxID_ANY, _("None")); dump_info += new wxRadioButton(this, wxID_ANY, _("D3D11 HW")); dump_info += new wxRadioButton(this, wxID_ANY, _("OGL HW")); @@ -80,8 +84,10 @@ Dialogs::GSDumpDialog::GSDumpDialog(wxWindow* parent) debugger += dbg_tree; debugger += dbg_actions; + GetDumpsList(); + dumps_list += new wxStaticText(this, wxID_ANY, _("GS Dumps List")); - dumps_list += new wxListView(this, wxID_ANY, wxDefaultPosition, wxSize(250, 200)); + dumps_list += m_dump_list; dump_preview += new wxStaticText(this, wxID_ANY, _("Preview")); wxImage img = EmbeddedImage().Get(); @@ -101,4 +107,32 @@ Dialogs::GSDumpDialog::GSDumpDialog(wxWindow* parent) *this += general; SetSizerAndFit(GetSizer()); + + Bind(wxEVT_LIST_ITEM_SELECTED, &Dialogs::GSDumpDialog::SelectedDump, this, ID_DUMP_LIST); +} + +void Dialogs::GSDumpDialog::GetDumpsList() +{ + wxDir snaps(g_Conf->Folders.Snapshots.GetFilename().GetName()); + wxString filename; + bool cont = snaps.GetFirst(&filename, "*.gs", wxDIR_DEFAULT); + int i = 0; + while (cont) + { + m_dump_list->InsertItem(i, filename.c_str()); + i++; + cont = snaps.GetNext(&filename); + } +} + +Dialogs::GSDumpDialog::~GSDumpDialog() +{ + // we can't use smart pointers because of wxWidgets operator overload so we + // do the next best thing and handle the manual memory management ourselves + delete m_dump_list; +} + +void Dialogs::GSDumpDialog::SelectedDump(wxListEvent& evt) +{ + //evt->GetText(); } diff --git a/pcsx2/gui/Dialogs/ModalPopups.h b/pcsx2/gui/Dialogs/ModalPopups.h index f6b0f0f60d..32c32fde57 100644 --- a/pcsx2/gui/Dialogs/ModalPopups.h +++ b/pcsx2/gui/Dialogs/ModalPopups.h @@ -72,10 +72,25 @@ namespace Dialogs { public: GSDumpDialog(wxWindow* parent = NULL); - virtual ~GSDumpDialog() = default; + virtual ~GSDumpDialog(); - static wxString GetNameStatic() { return L"AboutBox"; } - wxString GetDialogName() const { return GetNameStatic(); } + static wxString GetNameStatic() + { + return L"AboutBox"; + } + wxString GetDialogName() const + { + return GetNameStatic(); + } + + protected: + wxListView* m_dump_list; + void GetDumpsList(); + void SelectedDump(wxListEvent& evt); + enum + { + ID_DUMP_LIST + }; };