gsdump: vastly simplify string exports & beginning to work on reg browser

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2021-03-05 19:32:30 +01:00 committed by Kojin
parent 8817e71c99
commit f9ee7e01bf
2 changed files with 155 additions and 183 deletions

View File

@ -411,37 +411,9 @@ void Dialogs::GSDumpDialog::GenPacketList(std::vector<GSData>& dump)
{
case Transfer:
{
switch (element.path)
{
case Path1Old:
{
wxString s;
s.Printf("%d - Transfer - Path1Old - %d byte", i, element.length);
m_gif_list->AppendItem(rootId, s);
break;
}
case Path1New:
{
wxString s;
s.Printf("%d - Transfer - Path1New - %d byte", i, element.length);
m_gif_list->AppendItem(rootId, s);
break;
}
case Path2:
{
wxString s;
s.Printf("%d - Transfer - Path2 - %d byte", i, element.length);
m_gif_list->AppendItem(rootId, s);
break;
}
case Path3:
{
wxString s;
s.Printf("%d - Transfer - Path3 - %d byte", i, element.length);
m_gif_list->AppendItem(rootId, s);
break;
}
}
wxString s;
s.Printf("%d - Transfer - %s - %d byte", i, GSTransferPathNames[element.path], element.length);
m_gif_list->AppendItem(rootId, s);
break;
}
case VSync:
@ -452,17 +424,10 @@ void Dialogs::GSDumpDialog::GenPacketList(std::vector<GSData>& dump)
rootId = m_gif_list->AppendItem(mainrootId, "VSync");
break;
}
case ReadFIFO2:
default:
{
wxString s;
s.Printf("%d - ReadFIFO2 - %d byte", i, element.length);
m_gif_list->AppendItem(rootId, s);
break;
}
case Registers:
{
wxString s;
s.Printf("%d - Registers - %d byte", i, element.length);
s.Printf("%d - %s - %d byte", i, GSTypeNames[element.id], element.length);
m_gif_list->AppendItem(rootId, s);
break;
}
@ -482,37 +447,9 @@ void Dialogs::GSDumpDialog::GenPacketInfo(GSData& dump)
case Transfer:
{
wxTreeItemId trootId;
switch (dump.path)
{
case Path1Old:
{
wxString s;
s.Printf("Transfer Path Path1Old");
trootId = m_gif_packet->AppendItem(rootId, s);
break;
}
case Path1New:
{
wxString s;
s.Printf("Transfer Path Path1New");
trootId = m_gif_packet->AppendItem(rootId, s);
break;
}
case Path2:
{
wxString s;
s.Printf("Transfer Path Path2");
trootId = m_gif_packet->AppendItem(rootId, s);
break;
}
case Path3:
{
wxString s;
s.Printf("Transfer Path Path3");
trootId = m_gif_packet->AppendItem(rootId, s);
break;
}
}
wxString s;
s.Printf("Transfer Path %s", GSTransferPathNames[dump.path]);
trootId = m_gif_packet->AppendItem(rootId, s);
u64 tag = *dump.data;
u64 regs = *(dump.data+8);
u8 nloop = tag & ((u64)(1 << 15) - 1);
@ -520,7 +457,7 @@ void Dialogs::GSDumpDialog::GenPacketInfo(GSData& dump)
u8 pre = (tag >> 46) & 1;
u8 prim = (tag >> 47) & ((u64)(1 << 11) - 1);
//t.prim = GIFPrim.ExtractGIFPrim((uint)GetBit(t.TAG, 47, 11));
GifFlag flg = (GifFlag)((tag >> 58) & 3);
u8 flg = ((tag >> 58) & 3);
u8 nreg = (tag >> 60) & ((u64)(1 << 4) - 1);
if (nreg == 0)
nreg = 16;
@ -533,21 +470,7 @@ void Dialogs::GSDumpDialog::GenPacketInfo(GSData& dump)
infos[0].Printf("nloop = %u", nloop);
infos[1].Printf("eop = %u", eop);
switch (flg)
{
case GIF_FLG_PACKED:
infos[2].Printf("flg = GIF_FLG_PACKED");
break;
case GIF_FLG_REGLIST:
infos[2].Printf("flg = GIF_FLG_REGLIST");
break;
case GIF_FLG_IMAGE:
infos[2].Printf("flg = GIF_FLG_IMAGE");
break;
case GIF_FLG_IMAGE2:
infos[2].Printf("flg = GIF_FLG_IMAGE2");
break;
}
infos[2].Printf("flg = %s", GifFlagNames[flg]);
infos[3].Printf("pre = %u", pre);
infos[4].Printf("Prim");
infos[5].Printf("nreg = %u", nreg);
@ -569,74 +492,15 @@ void Dialogs::GSDumpDialog::GenPacketInfo(GSData& dump)
}
}
switch ((GsPrim)(tag & ((u64)(1 << 3) - 1)))
{
case GS_POINTLIST:
prim_infos[0].Printf("Primitive Type = GS_POINTLIST");
break;
case GS_LINELIST:
prim_infos[0].Printf("Primitive Type = GS_LINELIST");
break;
case GS_LINESTRIP:
prim_infos[0].Printf("Primitive Type = GS_LINESTRIP");
break;
case GS_TRIANGLELIST:
prim_infos[0].Printf("Primitive Type = GS_TRIANGLELIST");
break;
case GS_TRIANGLESTRIP:
prim_infos[0].Printf("Primitive Type = GS_TRIANGLESTRIP");
break;
case GS_TRIANGLEFAN:
prim_infos[0].Printf("Primitive Type = GS_TRIANGLEFAN");
break;
case GS_SPRITE:
prim_infos[0].Printf("Primitive Type = GS_SPRITE");
break;
case GS_INVALID:
prim_infos[0].Printf("Primitive Type = GS_INVALID");
break;
}
switch ((GsIIP)((tag >> 3) & 1))
{
case FlatShading:
prim_infos[1].Printf("IIP = FlatShading");
break;
case Gouraud:
prim_infos[1].Printf("IIP = Gouraud");
break;
}
prim_infos[0].Printf("Primitive Type = %s", GsPrimNames[(tag & ((u64)(1 << 3) - 1))]);
prim_infos[1].Printf("IIP = %s", GsIIPNames[((tag >> 3) & 1)]);
prim_infos[2].Printf("TME = %s", (bool)((tag >> 4) & 1) ? "True" : "False");
prim_infos[3].Printf("FGE = %s", (bool)((tag >> 5) & 1) ? "True" : "False");
prim_infos[4].Printf("FGE = %s", (bool)((tag >> 6) & 1) ? "True" : "False");
prim_infos[5].Printf("AA1 = %s", (bool)((tag >> 7) & 1) ? "True" : "False");
switch ((GsFST)((tag >> 3) & 1))
{
case STQValue:
prim_infos[6].Printf("FST = STQValue");
break;
case UVValue:
prim_infos[6].Printf("FST = UVValue");
break;
}
switch ((GsCTXT)((tag >> 9) & 1))
{
case Context1:
prim_infos[7].Printf("CTXT = Context1");
break;
case Context2:
prim_infos[7].Printf("CTXT = Context2");
break;
}
switch ((GsFIX)((tag >> 10) & 1))
{
case Unfixed:
prim_infos[8].Printf("FIX = Unfixed");
break;
case Fixed:
prim_infos[8].Printf("FIX = Fixed");
break;
}
prim_infos[6].Printf("FST = %s", GsFSTNames[((tag >> 3) & 1)]);
prim_infos[7].Printf("CTXT = %s", GsCTXTNames[((tag >> 9) & 1)]);
prim_infos[8].Printf("FIX = %s", GsFIXNames[((tag >> 10) & 1)]);
for (auto& el : prim_infos)
m_gif_packet->AppendItem(primId, el);

View File

@ -118,6 +118,12 @@ namespace Dialogs
ReadFIFO2 = 2,
Registers = 3
};
static constexpr const char* GSTypeNames[] = {
"Transfer",
"VSync",
"ReadFIFO2",
"Registers"
};
enum GSTransferPath : u8
{
Path1Old = 0,
@ -139,43 +145,145 @@ namespace Dialogs
RunCursor,
RunVSync
};
enum GifFlag : u8
{
GIF_FLG_PACKED = 0,
GIF_FLG_REGLIST = 1,
GIF_FLG_IMAGE = 2,
GIF_FLG_IMAGE2 = 3
static constexpr const char* GSTransferPathNames[] = {
"Path1Old",
"Path2",
"Path3",
"Path1New",
"Dummy"
};
enum GsPrim : u8
{
GS_POINTLIST = 0,
GS_LINELIST = 1,
GS_LINESTRIP = 2,
GS_TRIANGLELIST = 3,
GS_TRIANGLESTRIP = 4,
GS_TRIANGLEFAN = 5,
GS_SPRITE = 6,
GS_INVALID = 7,
static constexpr const char* GifFlagNames[] = {
"GIF_FLG_PACKED",
"GIF_FLG_REGLIST",
"GIF_FLG_IMAGE",
"GIF_FLG_IMAGE2"
};
enum GsIIP : u8
{
FlatShading = 0,
Gouraud = 1
static constexpr const char* GsPrimNames[] = {
"GS_POINTLIST",
"GS_LINELIST",
"GS_LINESTRIP",
"GS_TRIANGLELIST",
"GS_TRIANGLESTRIP",
"GS_TRIANGLEFAN",
"GS_SPRITE",
"GS_INVALID"
};
enum GsFST : u8
{
STQValue = 0,
UVValue = 1
static constexpr const char* GsIIPNames[] = {
"FlatShading",
"Gouraud"
};
enum GsCTXT : u8
{
Context1 = 0,
Context2 = 1
static constexpr const char* GsFSTNames[] = {
"STQValue",
"UVValue"
};
enum GsFIX : u8
{
Unfixed = 0,
Fixed = 1
static constexpr const char* GsCTXTNames[] = {
"Context1",
"Context2"
};
static constexpr const char* GsFIXNames[] = {
"Unfixed",
"Fixed"
};
static constexpr const char* GIFRegDescriptorNames[] = {
"PRIM",
"RGBAQ",
"ST",
"UV",
"XYZF2",
"XYZ2",
"TEX0_1",
"TEX0_2",
"CLAMP_1",
"CLAMP_2",
"FOG",
"",
"XYZF3",
"XYZ3",
"AD",
"NOP",
"",
"",
"",
"",
"TEX1_1",
"TEX1_2",
"TEX2_1",
"TEX2_2",
"XYOFFSET_1",
"XYOFFSET_2",
"PRMODECONT",
"PRMODE",
"TEXCLUT",
"",
"",
"",
"",
"",
"SCANMSK",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"MIPTBP1_1",
"MIPTBP1_2",
"MIPTBP2_1",
"MIPTBP2_2",
"",
"",
"",
"TEXA",
"",
"FOGCOL",
"",
"TEXFLUSH",
"SCISSOR_1",
"SCISSOR_2",
"ALPHA_1",
"ALPHA_2",
"DIMX",
"DTHE",
"COLCLAMP",
"TEST_1",
"TEST_2",
"PABE",
"FBA_1",
"FBA_2",
"FRAME_1",
"FRAME_2",
"ZBUF_1",
"ZBUF_2",
"BITBLTBUF",
"TRXPOS",
"TRXREG",
"TRXDIR",
"HWREG",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"SIGNAL",
"FINISH",
"LABEL",
};
struct GSEvent
{