From a4e01d4593a2f056367bbda4de2f39b061738468 Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Sun, 7 Mar 2021 21:33:37 +0100 Subject: [PATCH] gsdump: fix parsing of last packet in non debug mode and code simplification --- pcsx2/gui/Dialogs/GSDumpDialog.cpp | 19 +++++++++---------- pcsx2/gui/Dialogs/ModalPopups.h | 4 ++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/pcsx2/gui/Dialogs/GSDumpDialog.cpp b/pcsx2/gui/Dialogs/GSDumpDialog.cpp index 1d8d779a36..409336b1bf 100644 --- a/pcsx2/gui/Dialogs/GSDumpDialog.cpp +++ b/pcsx2/gui/Dialogs/GSDumpDialog.cpp @@ -184,7 +184,7 @@ void Dialogs::GSDumpDialog::RunDump(wxCommandEvent& event) return; } -void Dialogs::GSDumpDialog::ProcessDumpEvent(GSData& event, char* regs) +void Dialogs::GSDumpDialog::ProcessDumpEvent(const GSData& event, char* regs) { switch (event.id) { @@ -249,13 +249,13 @@ void Dialogs::GSDumpDialog::ToStart(wxCommandEvent& event) m_button_events.push_back(GSEvent{RunCursor, 0}); } -void Dialogs::GSDumpDialog::GenPacketList(std::vector& dump) +void Dialogs::GSDumpDialog::GenPacketList() { int i = 0; m_gif_list->DeleteAllItems(); wxTreeItemId mainrootId = m_gif_list->AddRoot("root"); wxTreeItemId rootId = m_gif_list->AppendItem(mainrootId, "0 - VSync"); - for (auto& element : dump) + for (auto& element : m_dump_packets) { wxString s, t; element.id == Transfer ? t.Printf(" - %s", GSTransferPathNames[element.path]) : t.Printf(""); @@ -577,7 +577,7 @@ void Dialogs::GSDumpDialog::ParseTreePrim(wxTreeItemId& id, u32 prim) void Dialogs::GSDumpDialog::CheckDebug(wxCommandEvent& event) { if (m_debug_mode->GetValue()) - GenPacketList(m_dump_packets); + GenPacketList(); else { m_gif_list->DeleteAllItems(); @@ -675,7 +675,7 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread() } if (m_root_window->m_debug_mode->GetValue()) - m_root_window->GenPacketList(m_root_window->m_dump_packets); + m_root_window->GenPacketList(); //return here to debug pre gs //return; @@ -743,20 +743,19 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread() } // do vsync - GSData vsync_end = {VSync, 0, 0, Dummy}; - m_root_window->ProcessDumpEvent(vsync_end, regs); + m_root_window->ProcessDumpEvent({VSync, 0, 0, Dummy}, regs); } } else { - while (i < (m_root_window->m_dump_packets.size()-1)) + while (i < (m_root_window->m_dump_packets.size())) { m_root_window->ProcessDumpEvent(m_root_window->m_dump_packets[i++], regs); - if (m_root_window->m_dump_packets[i].id == VSync) + if (i >= m_root_window->m_dump_packets.size() || m_root_window->m_dump_packets[i].id == VSync) break; } - if (i >= m_root_window->m_dump_packets.size()-1) + if (i >= m_root_window->m_dump_packets.size()) i = 0; } } diff --git a/pcsx2/gui/Dialogs/ModalPopups.h b/pcsx2/gui/Dialogs/ModalPopups.h index bf5fdfb6ba..89482ae192 100644 --- a/pcsx2/gui/Dialogs/ModalPopups.h +++ b/pcsx2/gui/Dialogs/ModalPopups.h @@ -341,8 +341,8 @@ namespace Dialogs std::vector m_dump_packets; float m_stored_q = 1.0; - void ProcessDumpEvent(GSData& event, char* regs); - void GenPacketList(std::vector& dump); + void ProcessDumpEvent(const GSData& event, char* regs); + void GenPacketList(); void GenPacketInfo(GSData& dump); void ParseTreeReg(wxTreeItemId& id, GIFReg reg, u128 data, bool packed); void ParseTreePrim(wxTreeItemId& id, u32 prim);