mirror of https://github.com/PCSX2/pcsx2.git
gsdump: various logic and code formatting improvements
This commit is contained in:
parent
65291ace12
commit
3bb8fcf655
|
@ -1,5 +1,5 @@
|
||||||
/* PCSX2 - PS2 Emulator for PCs
|
/* PCSX2 - PS2 Emulator for PCs
|
||||||
* Copyright (C) 2002-2010 PCSX2 Dev Team
|
* Copyright (C) 2002-2020 PCSX2 Dev Team
|
||||||
*
|
*
|
||||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||||
|
@ -158,10 +158,8 @@ void Dialogs::GSDumpDialog::SelectedDump(wxListEvent& evt)
|
||||||
m_selected_dump = new wxString(filename);
|
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)
|
void Dialogs::GSDumpDialog::RunDump(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
|
@ -193,30 +191,22 @@ void Dialogs::GSDumpDialog::ProcessDumpEvent(GSData event, char* regs)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Path1New:
|
case Path1New:
|
||||||
{
|
|
||||||
GSgifTransfer((u32*)event.data, event.length / 16);
|
GSgifTransfer((u32*)event.data, event.length / 16);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case Path2:
|
case Path2:
|
||||||
{
|
|
||||||
GSgifTransfer2((u32*)event.data, event.length / 16);
|
GSgifTransfer2((u32*)event.data, event.length / 16);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case Path3:
|
case Path3:
|
||||||
{
|
|
||||||
GSgifTransfer3((u32*)event.data, event.length / 16);
|
GSgifTransfer3((u32*)event.data, event.length / 16);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case VSync:
|
case VSync:
|
||||||
{
|
|
||||||
GSvsync((*((int*)(regs + 4096)) & 0x2000) > 0 ? (u8)1 : (u8)0);
|
GSvsync((*((int*)(regs + 4096)) & 0x2000) > 0 ? (u8)1 : (u8)0);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case ReadFIFO2:
|
case ReadFIFO2:
|
||||||
{
|
{
|
||||||
u64* arr = (u64*)malloc(*((int*)event.data));
|
u64* arr = (u64*)malloc(*((int*)event.data));
|
||||||
|
@ -225,12 +215,10 @@ void Dialogs::GSDumpDialog::ProcessDumpEvent(GSData event, char* regs)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Registers:
|
case Registers:
|
||||||
{
|
|
||||||
memcpy(regs, event.data, 8192);
|
memcpy(regs, event.data, 8192);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Dialogs::GSDumpDialog::StepPacket(wxCommandEvent& event)
|
void Dialogs::GSDumpDialog::StepPacket(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
|
@ -260,9 +248,9 @@ void Dialogs::GSDumpDialog::GenPacketList(std::vector<GSData>& dump)
|
||||||
wxTreeItemId rootId = m_gif_list->AppendItem(mainrootId, "0 - VSync");
|
wxTreeItemId rootId = m_gif_list->AppendItem(mainrootId, "0 - VSync");
|
||||||
for (auto& element : dump)
|
for (auto& element : dump)
|
||||||
{
|
{
|
||||||
wxString s;
|
wxString s, t;
|
||||||
([&] { return element.id == Transfer; })() ? (s.Printf("%d - %s - %s - %d byte", i, GSTypeNames[element.id], GSTransferPathNames[element.path], element.length)) :
|
element.id == Transfer ? t.Printf(" - %s", GSTransferPathNames[element.path]) : t.Printf("");
|
||||||
s.Printf("%d - %s - %d byte", i, GSTypeNames[element.id], element.length);
|
s.Printf("%d - %s%s - %d byte", i, GSTypeNames[element.id], t, element.length);
|
||||||
if (element.id == VSync)
|
if (element.id == VSync)
|
||||||
{
|
{
|
||||||
m_gif_list->SetItemText(rootId, s);
|
m_gif_list->SetItemText(rootId, s);
|
||||||
|
@ -289,12 +277,12 @@ void Dialogs::GSDumpDialog::GenPacketInfo(GSData& dump)
|
||||||
trootId = m_gif_packet->AppendItem(rootId, s);
|
trootId = m_gif_packet->AppendItem(rootId, s);
|
||||||
u64 tag = *(u64*)(dump.data);
|
u64 tag = *(u64*)(dump.data);
|
||||||
u64 regs = *(u64*)(dump.data + 8);
|
u64 regs = *(u64*)(dump.data + 8);
|
||||||
u8 nloop = tag & ((u64)(1 << 15) - 1);
|
u32 nloop = tag & ((1 << 15) - 1);
|
||||||
u8 eop = (tag >> 15) & 1;
|
u8 eop = (tag >> 15) & 1;
|
||||||
u8 pre = (tag >> 46) & 1;
|
u8 pre = (tag >> 46) & 1;
|
||||||
u32 prim = (tag >> 47) & ((u64)(1 << 11) - 1);
|
u32 prim = (tag >> 47) & ((1 << 11) - 1);
|
||||||
u8 flg = ((tag >> 58) & 3);
|
u8 flg = ((tag >> 58) & 3);
|
||||||
u32 nreg = (u32)((tag >> 60) & ((u64)(1 << 4) - 1));
|
u32 nreg = (u32)((tag >> 60) & ((1 << 4) - 1));
|
||||||
if (nreg == 0)
|
if (nreg == 0)
|
||||||
nreg = 16;
|
nreg = 16;
|
||||||
|
|
||||||
|
@ -330,7 +318,7 @@ void Dialogs::GSDumpDialog::GenPacketInfo(GSData& dump)
|
||||||
{
|
{
|
||||||
case GIF_FLG_PACKED:
|
case GIF_FLG_PACKED:
|
||||||
{
|
{
|
||||||
for (int j = 0; j < nloop; j++)
|
for (u32 j = 0; j < nloop; j++)
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < nreg; i++)
|
for (u32 i = 0; i < nreg; i++)
|
||||||
{
|
{
|
||||||
|
@ -345,7 +333,7 @@ void Dialogs::GSDumpDialog::GenPacketInfo(GSData& dump)
|
||||||
}
|
}
|
||||||
case GIF_FLG_REGLIST:
|
case GIF_FLG_REGLIST:
|
||||||
{
|
{
|
||||||
for (int j = 0; j < nloop; j++)
|
for (u32 j = 0; j < nloop; j++)
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < nreg; i++)
|
for (u32 i = 0; i < nreg; i++)
|
||||||
{
|
{
|
||||||
|
@ -366,8 +354,6 @@ void Dialogs::GSDumpDialog::GenPacketInfo(GSData& dump)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//m_gif_packet->AppendItem(trootId, s);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case VSync:
|
case VSync:
|
||||||
|
@ -385,11 +371,9 @@ void Dialogs::GSDumpDialog::GenPacketInfo(GSData& dump)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Registers:
|
case Registers:
|
||||||
{
|
|
||||||
m_gif_packet->AppendItem(rootId, "Registers");
|
m_gif_packet->AppendItem(rootId, "Registers");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
m_gif_packet->ExpandAll();
|
m_gif_packet->ExpandAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,10 +389,8 @@ void Dialogs::GSDumpDialog::ParseTreeReg(wxTreeItemId& id, GIFReg reg, u128 data
|
||||||
switch (reg)
|
switch (reg)
|
||||||
{
|
{
|
||||||
case PRIM:
|
case PRIM:
|
||||||
{
|
|
||||||
ParseTreePrim(rootId, data.lo);
|
ParseTreePrim(rootId, data.lo);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case RGBAQ:
|
case RGBAQ:
|
||||||
{
|
{
|
||||||
std::vector<wxString> rgb_infos(5);
|
std::vector<wxString> rgb_infos(5);
|
||||||
|
@ -697,7 +679,9 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread()
|
||||||
if (m_root_window->m_debug_mode->GetValue())
|
if (m_root_window->m_debug_mode->GetValue())
|
||||||
m_root_window->GenPacketList(m_root_window->m_dump_packets);
|
m_root_window->GenPacketList(m_root_window->m_dump_packets);
|
||||||
|
|
||||||
return;
|
//return here to debug pre gs
|
||||||
|
//return;
|
||||||
|
|
||||||
GetCorePlugins().Init();
|
GetCorePlugins().Init();
|
||||||
GSsetBaseMem((void*)regs);
|
GSsetBaseMem((void*)regs);
|
||||||
if (GSopen2((void*)pDsp, renderer_override) != 0)
|
if (GSopen2((void*)pDsp, renderer_override) != 0)
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
#include <wx/wizard.h>
|
#include <wx/wizard.h>
|
||||||
#include <wx/treectrl.h>
|
#include <wx/treectrl.h>
|
||||||
|
|
||||||
#define GSDUMP_GIFREG \
|
// clang-format off
|
||||||
|
#define GSDUMP_GIFREG(X) \
|
||||||
X(PRIM, 0x00) \
|
X(PRIM, 0x00) \
|
||||||
X(RGBAQ, 0x01) \
|
X(RGBAQ, 0x01) \
|
||||||
X(ST, 0x02) \
|
X(ST, 0x02) \
|
||||||
|
@ -79,8 +80,7 @@ X(HWREG,0x54) \
|
||||||
X(SIGNAL, 0x60) \
|
X(SIGNAL, 0x60) \
|
||||||
X(FINISH, 0x61) \
|
X(FINISH, 0x61) \
|
||||||
X(LABEL, 0x62)
|
X(LABEL, 0x62)
|
||||||
|
// clang-format on
|
||||||
#define X(name, value) name = value,
|
|
||||||
|
|
||||||
#define GSDUMP_GIFREG_NAME GIFReg
|
#define GSDUMP_GIFREG_NAME GIFReg
|
||||||
#define GSDUMP_GIFREG_TYPE u8
|
#define GSDUMP_GIFREG_TYPE u8
|
||||||
|
@ -312,10 +312,10 @@ namespace Dialogs
|
||||||
// the actual type is defined above thanks to preprocessing magic
|
// the actual type is defined above thanks to preprocessing magic
|
||||||
enum GSDUMP_GIFREG_NAME : GSDUMP_GIFREG_TYPE
|
enum GSDUMP_GIFREG_NAME : GSDUMP_GIFREG_TYPE
|
||||||
{
|
{
|
||||||
GSDUMP_GIFREG
|
#define X(name, value) name = value,
|
||||||
};
|
GSDUMP_GIFREG(X)
|
||||||
|
|
||||||
#undef X
|
#undef X
|
||||||
|
};
|
||||||
constexpr auto GIFRegName(GSDUMP_GIFREG_NAME e) noexcept
|
constexpr auto GIFRegName(GSDUMP_GIFREG_NAME e) noexcept
|
||||||
{
|
{
|
||||||
#define X(name, value) \
|
#define X(name, value) \
|
||||||
|
@ -323,11 +323,11 @@ namespace Dialogs
|
||||||
return #name;
|
return #name;
|
||||||
switch (e)
|
switch (e)
|
||||||
{
|
{
|
||||||
GSDUMP_GIFREG
|
GSDUMP_GIFREG(X)
|
||||||
}
|
}
|
||||||
#undef X
|
#undef X
|
||||||
return "UNKNOWN";
|
return "UNKNOWN";
|
||||||
}
|
};
|
||||||
struct GSEvent
|
struct GSEvent
|
||||||
{
|
{
|
||||||
ButtonState btn;
|
ButtonState btn;
|
||||||
|
|
Loading…
Reference in New Issue