From 953e09428fac6384038c80b7337a71dbb8c00fbb Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 8 Feb 2021 15:22:48 -0800 Subject: Add names and descriptions for CP registers to the FIFO analyzer --- Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp') diff --git a/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp b/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp index 8e806bef6f..4db865b069 100644 --- a/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp +++ b/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp @@ -23,6 +23,7 @@ #include "DolphinQt/Settings.h" #include "VideoCommon/BPMemory.h" +#include "VideoCommon/CPMemory.h" #include "VideoCommon/OpcodeDecoding.h" constexpr int FRAME_ROLE = Qt::UserRole; @@ -224,10 +225,13 @@ void FIFOAnalyzer::UpdateDetails() u32 cmd2 = *objectdata++; u32 value = Common::swap32(objectdata); objectdata += 4; + const auto [name, desc] = GetCPRegInfo(cmd2, value); + ASSERT(!name.empty()); - new_label = QStringLiteral("CP %1 %2") + new_label = QStringLiteral("CP %1 %2 %3") .arg(cmd2, 2, 16, QLatin1Char('0')) - .arg(value, 8, 16, QLatin1Char('0')); + .arg(value, 8, 16, QLatin1Char('0')) + .arg(QString::fromStdString(name)); } break; @@ -484,7 +488,20 @@ void FIFOAnalyzer::UpdateDescription() } else if (*cmddata == OpcodeDecoder::GX_LOAD_CP_REG) { + const u8 cmd = *(cmddata + 1); + const u32 value = Common::swap32(cmddata + 2); + + const auto [name, desc] = GetCPRegInfo(cmd, value); + ASSERT(!name.empty()); + text = tr("CP register "); + text += QString::fromStdString(name); + text += QLatin1Char{'\n'}; + + if (desc.empty()) + text += tr("No description available"); + else + text += QString::fromStdString(desc); } else if (*cmddata == OpcodeDecoder::GX_LOAD_XF_REG) { -- cgit v1.2.3 From 2d6ec7457dc4540ab539c585d004dedb676bf455 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sat, 6 Feb 2021 21:14:21 -0800 Subject: Add names and descriptions for XF registers to the FIFO analyzer --- Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp') diff --git a/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp b/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp index 4db865b069..8764e30b19 100644 --- a/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp +++ b/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp @@ -25,6 +25,7 @@ #include "VideoCommon/BPMemory.h" #include "VideoCommon/CPMemory.h" #include "VideoCommon/OpcodeDecoding.h" +#include "VideoCommon/XFStructs.h" constexpr int FRAME_ROLE = Qt::UserRole; constexpr int OBJECT_ROLE = Qt::UserRole + 1; @@ -237,8 +238,10 @@ void FIFOAnalyzer::UpdateDetails() case OpcodeDecoder::GX_LOAD_XF_REG: { + const auto [name, desc] = GetXFTransferInfo(objectdata); u32 cmd2 = Common::swap32(objectdata); objectdata += 4; + ASSERT(!name.empty()); u8 streamSize = ((cmd2 >> 16) & 15) + 1; @@ -253,6 +256,8 @@ void FIFOAnalyzer::UpdateDetails() if (((objectdata - stream_start) % 4) == 0) new_label += QLatin1Char(' '); } + + new_label += QStringLiteral(" ") + QString::fromStdString(name); } break; @@ -505,7 +510,17 @@ void FIFOAnalyzer::UpdateDescription() } else if (*cmddata == OpcodeDecoder::GX_LOAD_XF_REG) { + const auto [name, desc] = GetXFTransferInfo(cmddata + 1); + ASSERT(!name.empty()); + text = tr("XF register "); + text += QString::fromStdString(name); + text += QLatin1Char{'\n'}; + + if (desc.empty()) + text += tr("No description available"); + else + text += QString::fromStdString(desc); } else { -- cgit v1.2.3 From df81210e96c6603d3aeb6c76f51b030d06cd06ac Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 7 Feb 2021 15:25:11 -0800 Subject: Use formatters in GetBPRegInfo; add missing commands BPMEM_TEV_COLOR_ENV + 6 (0xC6) was missing due to a typo. BPMEM_BP_MASK (0xFE) does not lend itself well to documentation with the current FIFO analyzer implementation (since it requires remembering the values in BP memory) but still shouldn't be treated as unknown. BPMEM_TX_SETMODE0_4 and BPMEM_TX_SETMODE1_4 (0xA4-0xAB) were missing entirely. --- Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp') diff --git a/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp b/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp index 8764e30b19..4b9020ab8f 100644 --- a/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp +++ b/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp @@ -287,11 +287,17 @@ void FIFOAnalyzer::UpdateDetails() case OpcodeDecoder::GX_LOAD_BP_REG: { - u32 cmd2 = Common::swap32(objectdata); - objectdata += 4; - new_label = QStringLiteral("BP %1 %2") - .arg(cmd2 >> 24, 2, 16, QLatin1Char('0')) - .arg(cmd2 & 0xFFFFFF, 6, 16, QLatin1Char('0')); + const u8 cmd2 = *objectdata++; + const u32 cmddata = Common::swap24(objectdata); + objectdata += 3; + + const auto [name, desc] = GetBPRegInfo(cmd2, cmddata); + ASSERT(!name.empty()); + + new_label = QStringLiteral("BP %1 %2 %3") + .arg(cmd2, 2, 16, QLatin1Char('0')) + .arg(cmddata, 6, 16, QLatin1Char('0')) + .arg(QString::fromStdString(name)); } break; @@ -476,14 +482,14 @@ void FIFOAnalyzer::UpdateDescription() QString text; if (*cmddata == OpcodeDecoder::GX_LOAD_BP_REG) { - std::string name; - std::string desc; - GetBPRegInfo(cmddata + 1, &name, &desc); + const u8 cmd = *(cmddata + 1); + const u32 value = Common::swap24(cmddata + 2); + + const auto [name, desc] = GetBPRegInfo(cmd, value); + ASSERT(!name.empty()); text = tr("BP register "); - text += name.empty() ? - QStringLiteral("UNKNOWN_%1").arg(*(cmddata + 1), 2, 16, QLatin1Char('0')) : - QString::fromStdString(name); + text += QString::fromStdString(name); text += QLatin1Char{'\n'}; if (desc.empty()) -- cgit v1.2.3