diff --git a/pcsx2/gui/Dialogs/GSDumpDialog.cpp b/pcsx2/gui/Dialogs/GSDumpDialog.cpp index 2b67d77749..46c14d7b3b 100644 --- a/pcsx2/gui/Dialogs/GSDumpDialog.cpp +++ b/pcsx2/gui/Dialogs/GSDumpDialog.cpp @@ -1,5 +1,5 @@ /* 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 * of the GNU Lesser General Public License as published by the Free Software Found- @@ -158,9 +158,7 @@ void Dialogs::GSDumpDialog::SelectedDump(wxListEvent& evt) m_selected_dump = new wxString(filename); } else - { m_preview_image->SetBitmap(EmbeddedImage().Get()); - } } void Dialogs::GSDumpDialog::RunDump(wxCommandEvent& event) @@ -193,30 +191,22 @@ void Dialogs::GSDumpDialog::ProcessDumpEvent(GSData event, char* regs) break; } case Path1New: - { GSgifTransfer((u32*)event.data, event.length / 16); break; - } case Path2: - { GSgifTransfer2((u32*)event.data, event.length / 16); break; - } case Path3: - { GSgifTransfer3((u32*)event.data, event.length / 16); break; - } default: break; } break; } case VSync: - { GSvsync((*((int*)(regs + 4096)) & 0x2000) > 0 ? (u8)1 : (u8)0); break; - } case ReadFIFO2: { u64* arr = (u64*)malloc(*((int*)event.data)); @@ -225,10 +215,8 @@ void Dialogs::GSDumpDialog::ProcessDumpEvent(GSData event, char* regs) break; } case Registers: - { memcpy(regs, event.data, 8192); break; - } } } @@ -260,9 +248,9 @@ 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)) : - s.Printf("%d - %s - %d byte", i, GSTypeNames[element.id], element.length); + wxString s, t; + element.id == Transfer ? t.Printf(" - %s", GSTransferPathNames[element.path]) : t.Printf(""); + s.Printf("%d - %s%s - %d byte", i, GSTypeNames[element.id], t, element.length); if (element.id == VSync) { m_gif_list->SetItemText(rootId, s); @@ -281,114 +269,110 @@ void Dialogs::GSDumpDialog::GenPacketInfo(GSData& dump) wxTreeItemId rootId = m_gif_packet->AddRoot("root"); switch (dump.id) { - case Transfer: + case Transfer: + { + wxTreeItemId trootId; + wxString s; + s.Printf("Transfer Path %s", GSTransferPathNames[dump.path]); + trootId = m_gif_packet->AppendItem(rootId, s); + u64 tag = *(u64*)(dump.data); + u64 regs = *(u64*)(dump.data + 8); + u32 nloop = tag & ((1 << 15) - 1); + u8 eop = (tag >> 15) & 1; + u8 pre = (tag >> 46) & 1; + u32 prim = (tag >> 47) & ((1 << 11) - 1); + u8 flg = ((tag >> 58) & 3); + u32 nreg = (u32)((tag >> 60) & ((1 << 4) - 1)); + if (nreg == 0) + nreg = 16; + + std::vector infos(7); + m_stored_q = 1.0; + + infos[0].Printf("nloop = %u", nloop); + infos[1].Printf("eop = %u", eop); + infos[2].Printf("flg = %s", GifFlagNames[flg]); + infos[3].Printf("pre = %u", pre); + infos[4].Printf("Prim"); + infos[5].Printf("nreg = %u", nreg); + infos[6].Printf("reg"); + + wxTreeItemId primId; + wxTreeItemId regId; + for (int i = 0; i < 7; i++) { - wxTreeItemId trootId; - wxString s; - s.Printf("Transfer Path %s", GSTransferPathNames[dump.path]); - trootId = m_gif_packet->AppendItem(rootId, s); - u64 tag = *(u64*)(dump.data); - u64 regs = *(u64*)(dump.data + 8); - u8 nloop = tag & ((u64)(1 << 15) - 1); - u8 eop = (tag >> 15) & 1; - u8 pre = (tag >> 46) & 1; - u32 prim = (tag >> 47) & ((u64)(1 << 11) - 1); - u8 flg = ((tag >> 58) & 3); - u32 nreg = (u32)((tag >> 60) & ((u64)(1 << 4) - 1)); - if (nreg == 0) - nreg = 16; - - std::vector infos(7); - m_stored_q = 1.0; - - infos[0].Printf("nloop = %u", nloop); - infos[1].Printf("eop = %u", eop); - infos[2].Printf("flg = %s", GifFlagNames[flg]); - infos[3].Printf("pre = %u", pre); - infos[4].Printf("Prim"); - infos[5].Printf("nreg = %u", nreg); - infos[6].Printf("reg"); - - wxTreeItemId primId; - wxTreeItemId regId; - for (int i = 0; i < 7; i++) + wxTreeItemId res = m_gif_packet->AppendItem(trootId, infos[i]); + switch (i) { - wxTreeItemId res = m_gif_packet->AppendItem(trootId, infos[i]); - switch (i) - { - case 4: - ParseTreePrim(res, prim); - break; - case 6: - regId = res; - break; - } + case 4: + ParseTreePrim(res, prim); + break; + case 6: + regId = res; + break; } + } - int p = 16; - switch ((GifFlag)flg) + int p = 16; + switch ((GifFlag)flg) + { + case GIF_FLG_PACKED: { - case GIF_FLG_PACKED: + for (u32 j = 0; j < nloop; j++) { - for (int j = 0; j < nloop; j++) + for (u32 i = 0; i < nreg; i++) { - for (u32 i = 0; i < nreg; i++) - { - u128 reg_data; - reg_data.lo = *(u64*)(dump.data + p); - reg_data.hi = *(u64*)(dump.data + p + 8); - ParseTreeReg(regId, (GIFReg)((regs >> (i * 4)) & ((u64)(1 << 4) - 1)), reg_data, true); - p += 16; - } + u128 reg_data; + reg_data.lo = *(u64*)(dump.data + p); + reg_data.hi = *(u64*)(dump.data + p + 8); + ParseTreeReg(regId, (GIFReg)((regs >> (i * 4)) & ((u64)(1 << 4) - 1)), reg_data, true); + p += 16; } - break; - } - case GIF_FLG_REGLIST: - { - for (int j = 0; j < nloop; j++) - { - for (u32 i = 0; i < nreg; i++) - { - u128 reg_data; - reg_data.lo = *(u64*)(dump.data + p); - ParseTreeReg(regId, (GIFReg)((regs >> (i * 4)) & ((u64)(1 << 4) - 1)), reg_data, false); - p += 8; - } - } - break; - } - case GIF_FLG_IMAGE: - case GIF_FLG_IMAGE2: - { - wxString z; - s.Printf("IMAGE %d bytes", nloop * 16); - m_gif_packet->AppendItem(regId, z); - break; } + break; + } + case GIF_FLG_REGLIST: + { + for (u32 j = 0; j < nloop; j++) + { + for (u32 i = 0; i < nreg; i++) + { + u128 reg_data; + reg_data.lo = *(u64*)(dump.data + p); + ParseTreeReg(regId, (GIFReg)((regs >> (i * 4)) & ((u64)(1 << 4) - 1)), reg_data, false); + p += 8; + } + } + break; + } + case GIF_FLG_IMAGE: + case GIF_FLG_IMAGE2: + { + wxString z; + s.Printf("IMAGE %d bytes", nloop * 16); + m_gif_packet->AppendItem(regId, z); + break; } - - //m_gif_packet->AppendItem(trootId, s); - break; - } - case VSync: - { - wxString s; - s.Printf("Field = %llu", (u64)(dump.data)); - m_gif_packet->AppendItem(rootId, s); - break; - } - case ReadFIFO2: - { - wxString s; - s.Printf("ReadFIFO2: Size = %d byte", dump.length); - m_gif_packet->AppendItem(rootId, s); - break; - } - case Registers: - { - m_gif_packet->AppendItem(rootId, "Registers"); - break; } + break; + } + case VSync: + { + wxString s; + s.Printf("Field = %llu", (u64)(dump.data)); + m_gif_packet->AppendItem(rootId, s); + break; + } + case ReadFIFO2: + { + wxString s; + s.Printf("ReadFIFO2: Size = %d byte", dump.length); + m_gif_packet->AppendItem(rootId, s); + break; + } + case Registers: + m_gif_packet->AppendItem(rootId, "Registers"); + break; } m_gif_packet->ExpandAll(); } @@ -405,10 +389,8 @@ void Dialogs::GSDumpDialog::ParseTreeReg(wxTreeItemId& id, GIFReg reg, u128 data switch (reg) { case PRIM: - { ParseTreePrim(rootId, data.lo); break; - } case RGBAQ: { std::vector rgb_infos(5); @@ -697,7 +679,9 @@ 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 here to debug pre gs + //return; + GetCorePlugins().Init(); GSsetBaseMem((void*)regs); if (GSopen2((void*)pDsp, renderer_override) != 0) diff --git a/pcsx2/gui/Dialogs/ModalPopups.h b/pcsx2/gui/Dialogs/ModalPopups.h index 39b9e79b7e..b52c73f949 100644 --- a/pcsx2/gui/Dialogs/ModalPopups.h +++ b/pcsx2/gui/Dialogs/ModalPopups.h @@ -22,65 +22,65 @@ #include #include -#define GSDUMP_GIFREG \ -X(PRIM,0x00) \ -X(RGBAQ,0x01) \ -X(ST,0x02) \ -X(UV,0x03) \ -X(XYZF2,0x04) \ -X(XYZ2,0x05) \ -X(TEX0_1,0x06) \ -X(TEX0_2,0x07) \ -X(CLAMP_1,0x08) \ -X(CLAMP_2,0x09) \ -X(FOG,0x0a) \ -X(XYZF3,0x0c) \ -X(XYZ3,0x0d) \ -X(AD,0x0e) \ -X(NOP,0x0f) \ -X(TEX1_1,0x14) \ -X(TEX1_2,0x15) \ -X(TEX2_1,0x16) \ -X(TEX2_2,0x17) \ -X(XYOFFSET_1,0x18) \ -X(XYOFFSET_2,0x19) \ -X(PRMODECONT,0x1a) \ -X(PRMODE,0x1b) \ -X(TEXCLUT,0x1c) \ -X(SCANMSK,0x22) \ -X(MIPTBP1_1,0x34) \ -X(MIPTBP1_2,0x35) \ -X(MIPTBP2_1,0x36) \ -X(MIPTBP2_2,0x37) \ -X(TEXA,0x3b) \ -X(FOGCOL,0x3d) \ -X(TEXFLUSH,0x3f) \ -X(SCISSOR_1,0x40) \ -X(SCISSOR_2,0x41) \ -X(ALPHA_1,0x42) \ -X(ALPHA_2,0x43) \ -X(DIMX,0x44) \ -X(DTHE,0x45) \ -X(COLCLAMP,0x46) \ -X(TEST_1,0x47) \ -X(TEST_2,0x48) \ -X(PABE,0x49) \ -X(FBA_1,0x4a) \ -X(FBA_2,0x4b) \ -X(FRAME_1,0x4c) \ -X(FRAME_2,0x4d) \ -X(ZBUF_1,0x4e) \ -X(ZBUF_2,0x4f) \ -X(BITBLTBUF,0x50) \ -X(TRXPOS,0x51) \ -X(TRXREG,0x52) \ -X(TRXDIR,0x53) \ -X(HWREG,0x54) \ -X(SIGNAL,0x60) \ -X(FINISH,0x61) \ -X(LABEL,0x62) - -#define X(name, value) name = value, +// clang-format off +#define GSDUMP_GIFREG(X) \ + X(PRIM, 0x00) \ + X(RGBAQ, 0x01) \ + X(ST, 0x02) \ + X(UV, 0x03) \ + X(XYZF2, 0x04) \ + X(XYZ2, 0x05) \ + X(TEX0_1, 0x06) \ + X(TEX0_2, 0x07) \ + X(CLAMP_1, 0x08) \ + X(CLAMP_2, 0x09) \ + X(FOG, 0x0a) \ + X(XYZF3, 0x0c) \ + X(XYZ3, 0x0d) \ + X(AD, 0x0e) \ + X(NOP, 0x0f) \ + X(TEX1_1, 0x14) \ + X(TEX1_2, 0x15) \ + X(TEX2_1, 0x16) \ + X(TEX2_2, 0x17) \ + X(XYOFFSET_1, 0x18) \ + X(XYOFFSET_2, 0x19) \ + X(PRMODECONT, 0x1a) \ + X(PRMODE, 0x1b) \ + X(TEXCLUT, 0x1c) \ + X(SCANMSK, 0x22) \ + X(MIPTBP1_1, 0x34) \ + X(MIPTBP1_2, 0x35) \ + X(MIPTBP2_1, 0x36) \ + X(MIPTBP2_2, 0x37) \ + X(TEXA, 0x3b) \ + X(FOGCOL, 0x3d) \ + X(TEXFLUSH, 0x3f) \ + X(SCISSOR_1, 0x40) \ + X(SCISSOR_2, 0x41) \ + X(ALPHA_1, 0x42) \ + X(ALPHA_2, 0x43) \ + X(DIMX, 0x44) \ + X(DTHE, 0x45) \ + X(COLCLAMP, 0x46) \ + X(TEST_1, 0x47) \ + X(TEST_2, 0x48) \ + X(PABE, 0x49) \ + X(FBA_1, 0x4a) \ + X(FBA_2, 0x4b) \ + X(FRAME_1, 0x4c) \ + X(FRAME_2, 0x4d) \ + X(ZBUF_1, 0x4e) \ + X(ZBUF_2, 0x4f) \ + X(BITBLTBUF, 0x50) \ + X(TRXPOS, 0x51) \ + X(TRXREG, 0x52) \ + X(TRXDIR, 0x53) \ + X(HWREG, 0x54) \ + X(SIGNAL, 0x60) \ + X(FINISH, 0x61) \ + X(LABEL, 0x62) +// clang-format on #define GSDUMP_GIFREG_NAME GIFReg #define GSDUMP_GIFREG_TYPE u8 @@ -288,7 +288,7 @@ namespace Dialogs static constexpr const char* TEXPSMNames[256] = { "PSMCT32", "PSMCT24", - "PSMCT16", + "PSMCT16", "","","","","","","", "PSMCT16S", "","","","","","","","", @@ -307,15 +307,15 @@ namespace Dialogs "","","","","","","", "PSMZ16S" }; - // clang-format on + // clang-format on // the actual type is defined above thanks to preprocessing magic enum GSDUMP_GIFREG_NAME : GSDUMP_GIFREG_TYPE { - GSDUMP_GIFREG - }; - +#define X(name, value) name = value, + GSDUMP_GIFREG(X) #undef X + }; constexpr auto GIFRegName(GSDUMP_GIFREG_NAME e) noexcept { #define X(name, value) \ @@ -323,11 +323,11 @@ namespace Dialogs return #name; switch (e) { - GSDUMP_GIFREG + GSDUMP_GIFREG(X) } #undef X return "UNKNOWN"; - } + }; struct GSEvent { ButtonState btn;