mirror of https://github.com/PCSX2/pcsx2.git
gsdump: add message when failing to load dump, fix dumps without preview image
This commit is contained in:
parent
3bb8fcf655
commit
4280ee1f0a
|
@ -22,7 +22,6 @@
|
||||||
|
|
||||||
|
|
||||||
#include "Utilities/EmbeddedImage.h"
|
#include "Utilities/EmbeddedImage.h"
|
||||||
#include "Utilities/pxStreams.h"
|
|
||||||
#include "Resources/NoIcon.h"
|
#include "Resources/NoIcon.h"
|
||||||
#include "GS.h"
|
#include "GS.h"
|
||||||
|
|
||||||
|
@ -52,7 +51,6 @@ Dialogs::GSDumpDialog::GSDumpDialog(wxWindow* parent)
|
||||||
: wxDialogWithHelpers(parent, _("GSDumpGov"), pxDialogFlags())
|
: wxDialogWithHelpers(parent, _("GSDumpGov"), pxDialogFlags())
|
||||||
, m_dump_list(new wxListView(this, ID_DUMP_LIST, wxDefaultPosition, wxSize(400, 300), wxLC_NO_HEADER | wxLC_REPORT | wxLC_SINGLE_SEL))
|
, m_dump_list(new wxListView(this, ID_DUMP_LIST, wxDefaultPosition, wxSize(400, 300), wxLC_NO_HEADER | wxLC_REPORT | wxLC_SINGLE_SEL))
|
||||||
, m_preview_image(new wxStaticBitmap(this, wxID_ANY, wxBitmap(EmbeddedImage<res_NoIcon>().Get()), wxDefaultPosition, wxSize(400,250)))
|
, m_preview_image(new wxStaticBitmap(this, wxID_ANY, wxBitmap(EmbeddedImage<res_NoIcon>().Get()), wxDefaultPosition, wxSize(400,250)))
|
||||||
, m_selected_dump(new wxString(""))
|
|
||||||
, m_debug_mode(new wxCheckBox(this, ID_DEBUG_MODE, _("Debug Mode")))
|
, m_debug_mode(new wxCheckBox(this, ID_DEBUG_MODE, _("Debug Mode")))
|
||||||
, m_renderer_overrides(new wxRadioBox())
|
, m_renderer_overrides(new wxRadioBox())
|
||||||
, m_gif_list(new wxTreeCtrl(this, ID_SEL_PACKET, wxDefaultPosition, wxSize(400, 300), wxTR_HIDE_ROOT | wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT))
|
, m_gif_list(new wxTreeCtrl(this, ID_SEL_PACKET, wxDefaultPosition, wxSize(400, 300), wxTR_HIDE_ROOT | wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT))
|
||||||
|
@ -154,11 +152,10 @@ void Dialogs::GSDumpDialog::SelectedDump(wxListEvent& evt)
|
||||||
auto img = wxImage(filename_preview);
|
auto img = wxImage(filename_preview);
|
||||||
img.Rescale(400,250, wxIMAGE_QUALITY_HIGH);
|
img.Rescale(400,250, 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());
|
||||||
|
m_selected_dump = wxString(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dialogs::GSDumpDialog::RunDump(wxCommandEvent& event)
|
void Dialogs::GSDumpDialog::RunDump(wxCommandEvent& event)
|
||||||
|
@ -169,6 +166,16 @@ void Dialogs::GSDumpDialog::RunDump(wxCommandEvent& event)
|
||||||
m_selection->Enable();
|
m_selection->Enable();
|
||||||
m_vsync->Enable();
|
m_vsync->Enable();
|
||||||
GetCorePlugins().Shutdown();
|
GetCorePlugins().Shutdown();
|
||||||
|
|
||||||
|
m_thread->m_dump_file = std::make_unique<pxInputStream>(m_selected_dump, new wxFFileInputStream(m_selected_dump));
|
||||||
|
|
||||||
|
if (!(m_thread->m_dump_file)->IsOk())
|
||||||
|
{
|
||||||
|
wxString s;
|
||||||
|
s.Printf(_("Failed to load the dump %s !"), m_selected_dump);
|
||||||
|
wxMessageBox(s, _("GSDumpGov"), wxICON_ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
m_thread->Start();
|
m_thread->Start();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -603,48 +610,41 @@ void Dialogs::GSDumpDialog::GSThread::OnStop()
|
||||||
m_root_window->m_gif_packet->DeleteAllItems();
|
m_root_window->m_gif_packet->DeleteAllItems();
|
||||||
m_root_window->m_gif_list->Refresh();
|
m_root_window->m_gif_list->Refresh();
|
||||||
m_root_window->m_button_events.clear();
|
m_root_window->m_button_events.clear();
|
||||||
|
m_dump_file->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread()
|
void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread()
|
||||||
{
|
{
|
||||||
pxInputStream dump_file(*m_root_window->m_selected_dump, new wxFFileInputStream(*m_root_window->m_selected_dump));
|
|
||||||
|
|
||||||
if (!dump_file.IsOk())
|
|
||||||
{
|
|
||||||
OnStop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 crc = 0, ss = 0;
|
u32 crc = 0, ss = 0;
|
||||||
// XXX: check the numbers are correct
|
// XXX: check the numbers are correct
|
||||||
const int renderer_override = m_root_window->m_renderer_overrides->GetSelection();
|
const int renderer_override = m_root_window->m_renderer_overrides->GetSelection();
|
||||||
char regs[8192];
|
char regs[8192];
|
||||||
|
|
||||||
dump_file.Read(&crc, 4);
|
m_dump_file->Read(&crc, 4);
|
||||||
dump_file.Read(&ss, 4);
|
m_dump_file->Read(&ss, 4);
|
||||||
|
|
||||||
|
|
||||||
char* state_data = (char*)malloc(sizeof(char) * ss);
|
char* state_data = (char*)malloc(sizeof(char) * ss);
|
||||||
dump_file.Read(state_data, ss);
|
m_dump_file->Read(state_data, ss);
|
||||||
dump_file.Read(®s, 8192);
|
m_dump_file->Read(®s, 8192);
|
||||||
|
|
||||||
freezeData fd = {(int)ss, (s8*)state_data};
|
freezeData fd = {(int)ss, (s8*)state_data};
|
||||||
m_root_window->m_dump_packets.clear();
|
m_root_window->m_dump_packets.clear();
|
||||||
|
|
||||||
while (dump_file.Tell() < dump_file.Length())
|
while ( m_dump_file->Tell() < m_dump_file->Length())
|
||||||
{
|
{
|
||||||
GSType id = Transfer;
|
GSType id = Transfer;
|
||||||
dump_file.Read(&id, 1);
|
m_dump_file->Read(&id, 1);
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
case Transfer:
|
case Transfer:
|
||||||
{
|
{
|
||||||
GSTransferPath id_transfer;
|
GSTransferPath id_transfer;
|
||||||
dump_file.Read(&id_transfer, 1);
|
m_dump_file->Read(&id_transfer, 1);
|
||||||
s32 size = 0;
|
s32 size = 0;
|
||||||
dump_file.Read(&size, 4);
|
m_dump_file->Read(&size, 4);
|
||||||
char* transfer_data = (char*)malloc(size);
|
char* transfer_data = (char*)malloc(size);
|
||||||
dump_file.Read(transfer_data, size);
|
m_dump_file->Read(transfer_data, size);
|
||||||
GSData data = {id, transfer_data, size, id_transfer};
|
GSData data = {id, transfer_data, size, id_transfer};
|
||||||
m_root_window->m_dump_packets.push_back(data);
|
m_root_window->m_dump_packets.push_back(data);
|
||||||
break;
|
break;
|
||||||
|
@ -652,7 +652,7 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread()
|
||||||
case VSync:
|
case VSync:
|
||||||
{
|
{
|
||||||
u8 vsync = 0;
|
u8 vsync = 0;
|
||||||
dump_file.Read(&vsync, 1);
|
m_dump_file->Read(&vsync, 1);
|
||||||
GSData data = {id, (char*)vsync, 1, Dummy};
|
GSData data = {id, (char*)vsync, 1, Dummy};
|
||||||
m_root_window->m_dump_packets.push_back(data);
|
m_root_window->m_dump_packets.push_back(data);
|
||||||
break;
|
break;
|
||||||
|
@ -660,7 +660,7 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread()
|
||||||
case ReadFIFO2:
|
case ReadFIFO2:
|
||||||
{
|
{
|
||||||
u32 fifo = 0;
|
u32 fifo = 0;
|
||||||
dump_file.Read(&fifo, 4);
|
m_dump_file->Read(&fifo, 4);
|
||||||
GSData data = {id, (char*)fifo, 4, Dummy};
|
GSData data = {id, (char*)fifo, 4, Dummy};
|
||||||
m_root_window->m_dump_packets.push_back(data);
|
m_root_window->m_dump_packets.push_back(data);
|
||||||
break;
|
break;
|
||||||
|
@ -668,7 +668,7 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread()
|
||||||
case Registers:
|
case Registers:
|
||||||
{
|
{
|
||||||
char regs_tmp[8192];
|
char regs_tmp[8192];
|
||||||
dump_file.Read(®s, 8192);
|
m_dump_file->Read(®s, 8192);
|
||||||
GSData data = {id, regs_tmp, 8192, Dummy};
|
GSData data = {id, regs_tmp, 8192, Dummy};
|
||||||
m_root_window->m_dump_packets.push_back(data);
|
m_root_window->m_dump_packets.push_back(data);
|
||||||
break;
|
break;
|
||||||
|
@ -757,7 +757,7 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread()
|
||||||
if (m_root_window->m_dump_packets[i].id == VSync)
|
if (m_root_window->m_dump_packets[i].id == VSync)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i >= m_root_window->m_dump_packets.size())
|
if (i >= m_root_window->m_dump_packets.size()-1)
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "App.h"
|
#include "App.h"
|
||||||
#include "ConfigurationDialog.h"
|
#include "ConfigurationDialog.h"
|
||||||
#include "Panels/ConfigurationPanels.h"
|
#include "Panels/ConfigurationPanels.h"
|
||||||
|
#include "Utilities/pxStreams.h"
|
||||||
|
|
||||||
#include <wx/wizard.h>
|
#include <wx/wizard.h>
|
||||||
#include <wx/treectrl.h>
|
#include <wx/treectrl.h>
|
||||||
|
@ -150,7 +151,7 @@ namespace Dialogs
|
||||||
protected:
|
protected:
|
||||||
wxListView* m_dump_list;
|
wxListView* m_dump_list;
|
||||||
wxStaticBitmap* m_preview_image;
|
wxStaticBitmap* m_preview_image;
|
||||||
wxString* m_selected_dump;
|
wxString m_selected_dump;
|
||||||
wxCheckBox* m_debug_mode;
|
wxCheckBox* m_debug_mode;
|
||||||
wxRadioBox* m_renderer_overrides;
|
wxRadioBox* m_renderer_overrides;
|
||||||
wxTreeCtrl* m_gif_list;
|
wxTreeCtrl* m_gif_list;
|
||||||
|
@ -335,6 +336,7 @@ namespace Dialogs
|
||||||
};
|
};
|
||||||
std::vector<GSEvent> m_button_events;
|
std::vector<GSEvent> m_button_events;
|
||||||
std::vector<GSData> m_dump_packets;
|
std::vector<GSData> m_dump_packets;
|
||||||
|
|
||||||
float m_stored_q = 1.0;
|
float m_stored_q = 1.0;
|
||||||
void ProcessDumpEvent(GSData event, char* regs);
|
void ProcessDumpEvent(GSData event, char* regs);
|
||||||
void GenPacketList(std::vector<GSData>& dump);
|
void GenPacketList(std::vector<GSData>& dump);
|
||||||
|
@ -352,6 +354,7 @@ namespace Dialogs
|
||||||
bool m_running = true;
|
bool m_running = true;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
std::unique_ptr<pxInputStream> m_dump_file;
|
||||||
GSThread(GSDumpDialog* dlg);
|
GSThread(GSDumpDialog* dlg);
|
||||||
virtual ~GSThread();
|
virtual ~GSThread();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue