diff --git a/pcsx2/gui/App.h b/pcsx2/gui/App.h index b4f5f6e319..724c83e84f 100644 --- a/pcsx2/gui/App.h +++ b/pcsx2/gui/App.h @@ -122,7 +122,7 @@ enum MenuIdentifiers MenuId_GameSettingsSubMenu, MenuId_EnablePatches, MenuId_EnableCheats, - MenuId_GSDump, + MenuId_GSDump, MenuId_EnableWideScreenPatches, MenuId_EnableInputRecording, MenuId_EnableLuaTools, diff --git a/pcsx2/gui/Dialogs/GSDumpDialog.cpp b/pcsx2/gui/Dialogs/GSDumpDialog.cpp index 915a5f69fb..fbdf0f6d5b 100644 --- a/pcsx2/gui/Dialogs/GSDumpDialog.cpp +++ b/pcsx2/gui/Dialogs/GSDumpDialog.cpp @@ -274,22 +274,21 @@ void Dialogs::GSDumpDialog::GenPacketList(std::vector& dump) wxTreeItemId rootId = m_gif_list->AppendItem(mainrootId, "0 - VSync"); for (auto& element : dump) { - wxString s; - ([&] { return element.id == Transfer; })() ? (s.Printf("%d - %s - %s - %d byte", i, GSTypeNames[element.id], GSTransferPathNames[element.path], element.length)) : + wxString s; + ([&] { return element.id == Transfer; })() ? (s.Printf("%d - %s - %s - %d byte", i, GSTypeNames[element.id], GSTransferPathNames[element.path], element.length)) : s.Printf("%d - %s - %d byte", i, GSTypeNames[element.id], element.length); - if (element.id == VSync) - { - m_gif_list->SetItemText(rootId, s); - rootId = m_gif_list->AppendItem(mainrootId, "VSync"); - } - else - m_gif_list->AppendItem(rootId, s); + if (element.id == VSync) + { + m_gif_list->SetItemText(rootId, s); + rootId = m_gif_list->AppendItem(mainrootId, "VSync"); + } + else + m_gif_list->AppendItem(rootId, s); i++; } m_gif_list->Delete(rootId); } - void Dialogs::GSDumpDialog::GenPacketInfo(GSData& dump) { m_gif_packet->DeleteAllItems(); @@ -315,7 +314,7 @@ void Dialogs::GSDumpDialog::GenPacketInfo(GSData& dump) wxString snloop, seop, sflg, spre, sprim, snreg, sreg; std::vector infos = {snloop, seop, sflg, spre, sprim, snreg, sreg}; - m_stored_q = 1; + m_stored_q = 1.0; infos[0].Printf("nloop = %u", nloop); infos[1].Printf("eop = %u", eop); @@ -389,7 +388,7 @@ void Dialogs::GSDumpDialog::GenPacketInfo(GSData& dump) case VSync: { wxString s; - s.Printf("Field = %d", (u32)(dump.data)); + s.Printf("Field = %llu", (u64)(dump.data)); m_gif_packet->AppendItem(rootId, s); break; } @@ -455,13 +454,13 @@ void Dialogs::GSDumpDialog::ParseTreeReg(wxTreeItemId& id, GIFReg reg, u128 data { wxString s, t; std::vector st_infos = {s, t}; - st_infos[0].Printf("S = %u", *(u32*)(&data.lo)); - st_infos[1].Printf("T = %u", *(u32*)(&data.lo + 4)); + st_infos[0].Printf("S = %f", *(float*)(&data.lo)); + st_infos[1].Printf("T = %f", *(float*)(&data.lo + 4)); if (packed) { wxString q; - m_stored_q = *(u32*)(&data.hi + 4); - q.Printf("Q = %u", m_stored_q); + m_stored_q = *(float*)(&data.hi + 4); + q.Printf("Q = %f", m_stored_q); st_infos.push_back(q); } for (auto& el : st_infos) @@ -471,12 +470,12 @@ void Dialogs::GSDumpDialog::ParseTreeReg(wxTreeItemId& id, GIFReg reg, u128 data case UV: { wxString s, t; - u32 v; - s.Printf("U = %u", (u32)(data.lo & ((u64)(1 << 14) - 1)) / 16); + double v; + s.Printf("U = %f", (double)(data.lo & ((u64)(1 << 14) - 1)) / 16.0); if (packed) - v = (u32)((data.lo >> 32) & ((u64)(1 << 14) - 1)) / 16; + v = (double)((data.lo >> 32) & ((u64)(1 << 14) - 1)) / 16.0; else - v = (u32)((data.lo >> 16) & ((u64)(1 << 14) - 1)) / 16; + v = (double)((data.lo >> 16) & ((u64)(1 << 14) - 1)) / 16.0; t.Printf("V = %u", v); m_gif_packet->AppendItem(rootId, s); m_gif_packet->AppendItem(rootId, t); @@ -492,15 +491,15 @@ void Dialogs::GSDumpDialog::ParseTreeReg(wxTreeItemId& id, GIFReg reg, u128 data std::vector xyzf_infos = {a, b, c, d}; if (packed) { - xyzf_infos[0].Printf("X = %u", (u32)(data.lo & ((u64)(1 << 16) - 1)) / 16); - xyzf_infos[1].Printf("Y = %u", (u32)((data.lo >> 32) & ((u64)(1 << 16) - 1)) / 16); + xyzf_infos[0].Printf("X = %f", (float)(data.lo & ((u64)(1 << 16) - 1)) / 16.0); + xyzf_infos[1].Printf("Y = %f", (float)((data.lo >> 32) & ((u64)(1 << 16) - 1)) / 16.0); xyzf_infos[2].Printf("Z = %u", (u32)((data.hi >> 4) & ((u64)(1 << 24) - 1))); xyzf_infos[3].Printf("F = %u", (u32)((data.hi >> 36) & ((u64)(1 << 8) - 1))); } else { - xyzf_infos[0].Printf("X = %u", (u32)(data.lo & ((u64)(1 << 16) - 1)) / 16); - xyzf_infos[1].Printf("Y = %u", (u32)((data.lo >> 16) & ((u64)(1 << 16) - 1)) / 16); + xyzf_infos[0].Printf("X = %f", (float)(data.lo & ((u64)(1 << 16) - 1)) / 16.0); + xyzf_infos[1].Printf("Y = %f", (float)((data.lo >> 16) & ((u64)(1 << 16) - 1)) / 16.0); xyzf_infos[2].Printf("Z = %u", (u32)((data.lo >> 32) & ((u64)(1 << 24) - 1))); xyzf_infos[3].Printf("F = %u", (u32)((data.lo >> 56) & ((u64)(1 << 8) - 1))); } @@ -519,14 +518,14 @@ void Dialogs::GSDumpDialog::ParseTreeReg(wxTreeItemId& id, GIFReg reg, u128 data std::vector xyz_infos = {a, b, c}; if (packed) { - xyz_infos[0].Printf("X = %u", (u32)(data.lo & ((u64)(1 << 16) - 1)) / 16); - xyz_infos[1].Printf("Y = %u", (u32)((data.lo >> 32) & ((u64)(1 << 16) - 1)) / 16); + xyz_infos[0].Printf("X = %f", (float)(data.lo & ((u64)(1 << 16) - 1)) / 16.0); + xyz_infos[1].Printf("Y = %f", (float)((data.lo >> 32) & ((u64)(1 << 16) - 1)) / 16.0); xyz_infos[2].Printf("Z = %u", *(u32*)(&data.hi)); } else { - xyz_infos[0].Printf("X = %u", (u32)(data.lo & ((u64)(1 << 16) - 1)) / 16); - xyz_infos[1].Printf("Y = %u", (u32)((data.lo >> 16) & ((u64)(1 << 16) - 1)) / 16); + xyz_infos[0].Printf("X = %f", (float)(data.lo & ((u64)(1 << 16) - 1)) / 16.0); + xyz_infos[1].Printf("Y = %f", (float)((data.lo >> 16) & ((u64)(1 << 16) - 1)) / 16.0); xyz_infos[2].Printf("Z = %u", *(u32*)(&data.lo)+4); } @@ -542,14 +541,14 @@ void Dialogs::GSDumpDialog::ParseTreeReg(wxTreeItemId& id, GIFReg reg, u128 data tex_infos[0].Printf("TBP0 = %u", (u32)(data.lo & ((u64)(1 << 14) - 1))); tex_infos[1].Printf("TBW = %u", (u32)((data.lo >> 14) & ((u64)(1 << 6) - 1))); - tex_infos[2].Printf("PSM = %u", (u32)((data.lo >> 20) & ((u64)(1 << 6) - 1))); + tex_infos[2].Printf("PSM = %s", TEXPSMNames[(u32)((data.lo >> 20) & ((u64)(1 << 6) - 1))]); tex_infos[3].Printf("TW = %u", (u32)((data.lo >> 26) & ((u64)(1 << 4) - 1))); tex_infos[4].Printf("TH = %u", (u32)((data.lo >> 30) & ((u64)(1 << 4) - 1))); - tex_infos[5].Printf("TCC = %u", (u32)((data.lo >> 34) & ((u64)(1 << 1) - 1))); - tex_infos[6].Printf("TFX = %u", (u32)((data.lo >> 35) & ((u64)(1 << 2) - 1))); + tex_infos[5].Printf("TCC = %s", TEXTCCNames[(u32)((data.lo >> 34) & ((u64)(1 << 1) - 1))]); + tex_infos[6].Printf("TFX = %s", TEXTFXNames[(u32)((data.lo >> 35) & ((u64)(1 << 2) - 1))]); tex_infos[7].Printf("CBP = %u", (u32)((data.lo >> 37) & ((u64)(1 << 14) - 1))); - tex_infos[8].Printf("CPSM = %u", (u32)((data.lo >> 51) & ((u64)(1 << 4) - 1))); - tex_infos[9].Printf("CSM = %u", (u32)((data.lo >> 55) & ((u64)(1 << 1) - 1))); + tex_infos[8].Printf("CPSM = %s", TEXCPSMNames[(u32)((data.lo >> 51) & ((u64)(1 << 4) - 1))]); + tex_infos[9].Printf("CSM = %s", TEXCSMNames[(u32)((data.lo >> 55) & ((u64)(1 << 1) - 1))]); tex_infos[10].Printf("CSA = %u", (u32)((data.lo >> 56) & ((u64)(1 << 5) - 1))); tex_infos[11].Printf("CLD = %u", (u32)((data.lo >> 61) & ((u64)(1 << 3) - 1))); @@ -569,10 +568,10 @@ void Dialogs::GSDumpDialog::ParseTreeReg(wxTreeItemId& id, GIFReg reg, u128 data } case AD: { - wxString s; GIFReg nreg = (GIFReg)(data.hi & ((u64)(1 << 8) - 1)); if ((GIFReg)nreg == AD) { + wxString s; s.Printf("NOP"); m_gif_packet->AppendItem(id, s); } @@ -657,7 +656,7 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread() u32 crc = 0, ss = 0; // XXX: check the numbers are correct - int renderer_override = m_root_window->m_renderer_overrides->GetSelection(); + const int renderer_override = m_root_window->m_renderer_overrides->GetSelection(); char regs[8192]; dump_file.Read(&crc, 4); @@ -719,7 +718,7 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread() if (m_root_window->m_debug_mode->GetValue()) m_root_window->GenPacketList(m_root_window->m_dump_packets); - //return; + return; GetCorePlugins().Init(); GSsetBaseMem((void*)regs); if (GSopen2((void*)pDsp, renderer_override) != 0) @@ -803,4 +802,4 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread() GetCorePlugins().Shutdown(); OnStop(); return; -} \ No newline at end of file +} diff --git a/pcsx2/gui/Dialogs/ModalPopups.h b/pcsx2/gui/Dialogs/ModalPopups.h index 6a2ffed175..39b9e79b7e 100644 --- a/pcsx2/gui/Dialogs/ModalPopups.h +++ b/pcsx2/gui/Dialogs/ModalPopups.h @@ -187,7 +187,7 @@ namespace Dialogs ReadFIFO2 = 2, Registers = 3 }; - static constexpr const char* GSTypeNames[] = { + static constexpr const char* GSTypeNames[256] = { "Transfer", "VSync", "ReadFIFO2", @@ -214,7 +214,7 @@ namespace Dialogs RunCursor, RunVSync }; - static constexpr const char* GSTransferPathNames[] = { + static constexpr const char* GSTransferPathNames[256] = { "Path1Old", "Path2", "Path3", @@ -228,13 +228,13 @@ namespace Dialogs GIF_FLG_IMAGE = 2, GIF_FLG_IMAGE2 = 3 }; - static constexpr const char* GifFlagNames[] = { + static constexpr const char* GifFlagNames[256] = { "GIF_FLG_PACKED", "GIF_FLG_REGLIST", "GIF_FLG_IMAGE", "GIF_FLG_IMAGE2" }; - static constexpr const char* GsPrimNames[] = { + static constexpr const char* GsPrimNames[256] = { "GS_POINTLIST", "GS_LINELIST", "GS_LINESTRIP", @@ -244,22 +244,70 @@ namespace Dialogs "GS_SPRITE", "GS_INVALID" }; - static constexpr const char* GsIIPNames[] = { + static constexpr const char* GsIIPNames[256] = { "FlatShading", "Gouraud" }; - static constexpr const char* GsFSTNames[] = { + static constexpr const char* GsFSTNames[256] = { "STQValue", "UVValue" }; - static constexpr const char* GsCTXTNames[] = { + static constexpr const char* GsCTXTNames[256] = { "Context1", "Context2" }; - static constexpr const char* GsFIXNames[] = { + static constexpr const char* GsFIXNames[256] = { "Unfixed", "Fixed" }; + static constexpr const char* TEXTCCNames[256] = { + "RGB", + "RGBA" + }; + static constexpr const char* TEXTFXNames[256] = { + "MODULATE", + "DECAL", + "HIGHLIGHT", + "HIGHLIGHT2" + }; + static constexpr const char* TEXCSMNames[256] = { + "CSM1", + "CSM2" + }; + // a GNU extension exists to initialize array at given indices which would be + // exactly what we need here but, obviously, MSVC is at it again to make our + // life harder than sandpaper on your skin, so we make do + // clang-format off + static constexpr const char* TEXCPSMNames[256] = { + "PSMCT32", + "", + "PSMCT16", + "","","","","","","", + "PSMCT16S" + }; + static constexpr const char* TEXPSMNames[256] = { + "PSMCT32", + "PSMCT24", + "PSMCT16", + "","","","","","","", + "PSMCT16S", + "","","","","","","","", + "PSMT8", + "PSMT4", + "","","","","","", + "PSMT8H", + "","","","","","","","", + "PSMT4HL", + "","","","","","","", + "PSMT4HH", + "","","", + "PSMZ32", + "PSMZ24", + "PSMZ16", + "","","","","","","", + "PSMZ16S" + }; + // clang-format on // the actual type is defined above thanks to preprocessing magic enum GSDUMP_GIFREG_NAME : GSDUMP_GIFREG_TYPE @@ -287,7 +335,7 @@ namespace Dialogs }; std::vector m_button_events; std::vector m_dump_packets; - u32 m_stored_q = 1; + float m_stored_q = 1.0; void ProcessDumpEvent(GSData event, char* regs); void GenPacketList(std::vector& dump); void GenPacketInfo(GSData& dump);