From 698def66ff36fc0155d84b3777501e71a2ad22a1 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Tue, 8 Feb 2022 21:10:31 -0800 Subject: [PATCH] Fifo analyzer: Fix various XF mistakes * 'hangle' was a typo * Light colors include an alpha value, so they should be 8 characters, not 6 * The XF command format adds 1 to the count internally (so 0 is one word), but we need to subtract that back to produce a valid command * XFMEM_POSTMATRICES was calculating the row by subtracting XFMEM_POSMATRICES (POS vs POST), resulting in incorrect row numbering --- Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp | 2 +- Source/Core/VideoCommon/XFStructs.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp b/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp index 586982e0e4..d593a7419d 100644 --- a/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp +++ b/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp @@ -224,7 +224,7 @@ public: const auto [name, desc] = GetXFTransferInfo(address, count, data); ASSERT(!name.empty()); - const u32 command = address | (count << 16); + const u32 command = address | ((count - 1) << 16); text = QStringLiteral("XF %1 ").arg(command, 8, 16, QLatin1Char('0')); diff --git a/Source/Core/VideoCommon/XFStructs.cpp b/Source/Core/VideoCommon/XFStructs.cpp index 33e148d043..1d6811f92a 100644 --- a/Source/Core/VideoCommon/XFStructs.cpp +++ b/Source/Core/VideoCommon/XFStructs.cpp @@ -321,17 +321,17 @@ std::pair GetXFRegInfo(u32 address, u32 value) case XFMEM_SETCHAN0_AMBCOLOR: return std::make_pair(RegName(XFMEM_SETCHAN0_AMBCOLOR), - fmt::format("Channel 0 Ambient Color: {:06x}", value)); + fmt::format("Channel 0 Ambient Color: {:08x}", value)); case XFMEM_SETCHAN1_AMBCOLOR: return std::make_pair(RegName(XFMEM_SETCHAN1_AMBCOLOR), - fmt::format("Channel 1 Ambient Color: {:06x}", value)); + fmt::format("Channel 1 Ambient Color: {:08x}", value)); case XFMEM_SETCHAN0_MATCOLOR: return std::make_pair(RegName(XFMEM_SETCHAN0_MATCOLOR), - fmt::format("Channel 0 Material Color: {:06x}", value)); + fmt::format("Channel 0 Material Color: {:08x}", value)); case XFMEM_SETCHAN1_MATCOLOR: return std::make_pair(RegName(XFMEM_SETCHAN1_MATCOLOR), - fmt::format("Channel 1 Material Color: {:06x}", value)); + fmt::format("Channel 1 Material Color: {:08x}", value)); case XFMEM_SETCHAN0_COLOR: // Channel Color return std::make_pair(RegName(XFMEM_SETCHAN0_COLOR), @@ -474,8 +474,8 @@ std::string GetXFMemName(u32 address) } else if (address >= XFMEM_POSTMATRICES && address < XFMEM_POSTMATRICES_END) { - const u32 row = (address - XFMEM_POSMATRICES) / 4; - const u32 col = (address - XFMEM_POSMATRICES) % 4; + const u32 row = (address - XFMEM_POSTMATRICES) / 4; + const u32 col = (address - XFMEM_POSTMATRICES) % 4; return fmt::format("Post matrix row {:2d} col {:2d}", row, col); } else if (address >= XFMEM_LIGHTS && address < XFMEM_LIGHTS_END) @@ -508,9 +508,9 @@ std::string GetXFMemName(u32 address) case 15: // Yagcd says light dir or "1/2 angle", dolphin has union for ddir or shalfangle. // It would make sense if d stood for direction and s for specular, but it's ddir and - // shalfhangle that have the comment "specular lights only", both at the same offset, + // shalfangle that have the comment "specular lights only", both at the same offset, // while dpos and sdir have none... - return fmt::format("Light {0} {1} direction or half hangle {1}", light, "xyz"[offset - 13]); + return fmt::format("Light {0} {1} direction or half angle {1}", light, "xyz"[offset - 13]); } } else