gsdump: dump fully parsed

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2021-03-05 01:51:04 +01:00 committed by Kojin
parent 0ba7b18032
commit d579dc16f1
4 changed files with 93 additions and 8 deletions

View File

@ -166,8 +166,12 @@ 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* _GSReplay)(char* lpszCmdLine, int renderer);
typedef void(CALLBACK *_GSvsync)(int field);
typedef s32(CALLBACK* _GSinit)();
typedef s32(CALLBACK* _GSfreeze)(int mode, freezeData* data);
typedef void(CALLBACK* _GSclose)();
typedef void(CALLBACK* _GSshutdown)();
typedef void(CALLBACK *_GSgifTransfer)(const u32 *pMem, u32 size);
typedef void(CALLBACK *_GSgifTransfer1)(u32 *pMem, u32 addr);
typedef void(CALLBACK *_GSgifTransfer2)(u32 *pMem, u32 size);
@ -204,6 +208,10 @@ extern _GSosdMonitor GSosdMonitor;
extern _GSopen GSopen;
extern _GSopen2 GSopen2;
extern _GSReplay GSReplay;
extern _GSinit GSinit;
extern _GSfreeze GSfreeze;
extern _GSclose GSclose;
extern _GSshutdown GSshutdown;
extern _GSvsync GSvsync;
extern _GSgifTransfer GSgifTransfer;
extern _GSgifTransfer1 GSgifTransfer1;

View File

@ -158,6 +158,10 @@ _GSosdMonitor GSosdMonitor;
_GSopen GSopen;
_GSopen2 GSopen2;
_GSReplay GSReplay;
_GSinit GSinit;
_GSfreeze GSfreeze;
_GSclose GSclose;
_GSshutdown GSshutdown;
_GSgifTransfer GSgifTransfer;
_GSgifTransfer1 GSgifTransfer1;
_GSgifTransfer2 GSgifTransfer2;

View File

@ -152,7 +152,8 @@ void Dialogs::GSDumpDialog::SelectedDump(wxListEvent& evt)
void Dialogs::GSDumpDialog::RunDump(wxCommandEvent& event)
{
pxInputStream dump_file(m_selected_dump, new wxFFileInputStream(m_selected_dump));
//TODO: switch all of that to a pxThread
pxInputStream dump_file(*m_selected_dump, new wxFFileInputStream(*m_selected_dump));
if (!dump_file.IsOk())
return;
@ -166,13 +167,62 @@ void Dialogs::GSDumpDialog::RunDump(wxCommandEvent& event)
dump_file.Read(&crc, 4);
dump_file.Read(&ss, 4);
char state_data[ss];
dump_file.Read(&state_data, ss);
char* state_data = (char*)malloc(sizeof(char) * ss);
dump_file.Read(state_data, ss);
dump_file.Read(&regs, 8192);
int ssi = ss;
GSFreezeData fd = {ssi, state_data};
freezeData fd = {0, (s8*)state_data};
std::vector<GSData> dump;
while (dump_file.Tell() <= dump_file.Length())
{
GSType id = Transfer;
dump_file.Read(&id, 1);
switch (id)
{
case Transfer:
{
GSTransferPath id_transfer;
dump_file.Read(&id_transfer, 1);
s32 size = 0;
dump_file.Read(&size, 4);
char* transfer_data = (char*)malloc(size);
dump_file.Read(transfer_data, size);
GSTransfer data = {{id, transfer_data}, id_transfer};
dump.push_back(data);
break;
}
case VSync:
{
u8 vsync = 0;
dump_file.Read(&vsync, 1);
GSData data = {id, (char*)&vsync};
dump.push_back(data);
break;
}
case ReadFIFO2:
{
u32 fifo = 0;
dump_file.Read(&fifo, 4);
GSData data = {id, (char*)&fifo};
dump.push_back(data);
break;
}
case Registers:
{
char regs_tmp[8192];
dump_file.Read(&regs, 8192);
GSData data = {id, regs_tmp};
dump.push_back(data);
break;
}
default:
break;
}
}
GSinit();
GSsetBaseMem((void*)regs);
@ -182,15 +232,15 @@ void Dialogs::GSDumpDialog::RunDump(wxCommandEvent& event)
GSsetGameCRC((int)crc, 0);
if (GSfreeze(0, fd) == -1)
if (GSfreeze(0, &fd) == -1)
{
//DumpTooOld = true;
//Running = false;
}
GSVSync(1);
GSvsync(1);
GSreset();
GSsetBaseMem((void*)regs);
GSfreeze(0, fd);
GSfreeze(0, &fd);
while (0!=1)

View File

@ -95,6 +95,29 @@ namespace Dialogs
ID_DUMP_LIST,
ID_RUN_DUMP
};
enum GSType : u8
{
Transfer = 0,
VSync = 1,
ReadFIFO2 = 2,
Registers = 3
};
enum GSTransferPath : u8
{
Path1Old = 0,
Path2 = 1,
Path3 = 2,
Path1New = 3
};
struct GSData
{
GSType id;
char* data;
};
struct GSTransfer : GSData
{
GSTransferPath path;
};
};