diff options
| author | Anghelo Carvajal <angheloalf95@gmail.com> | 2021-09-16 15:05:34 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-16 14:05:34 -0400 |
| commit | ba947126665bf7a968aa2e71410842b8746f4849 (patch) | |
| tree | 4fc35c48cb9acce14ce7cceea45d2a1dc26bad3a /ZAPD/ZDisplayList.cpp | |
| parent | 3c00dcb30f33b763e215aebfa8ebdf96a8c3ee4d (diff) | |
Fix gsSPBranchList intersection warning (#184)
* Fix gsSPBranchList intersection warning
* Run formatter
Diffstat (limited to 'ZAPD/ZDisplayList.cpp')
| -rw-r--r-- | ZAPD/ZDisplayList.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/ZAPD/ZDisplayList.cpp b/ZAPD/ZDisplayList.cpp index d8f278f..24353d4 100644 --- a/ZAPD/ZDisplayList.cpp +++ b/ZAPD/ZDisplayList.cpp @@ -1,19 +1,18 @@ #include "ZDisplayList.h" -#include <Utils/File.h> -#include <Utils/Path.h> #include <algorithm> #include <cassert> #include <chrono> #include <math.h> + #include "Globals.h" #include "OutputFormatter.h" #include "Utils/BitConverter.h" +#include "Utils/File.h" +#include "Utils/Path.h" #include "Utils/StringHelper.h" #include "gfxd.h" -using namespace tinyxml2; - REGISTER_ZFILENODE(DList, ZDisplayList); ZDisplayList::ZDisplayList(ZFile* nParent) : ZResource(nParent) @@ -412,11 +411,18 @@ int32_t ZDisplayList::GetDListLength(const std::vector<uint8_t>& rawData, uint32 DListType dListType) { uint8_t endDLOpcode; + uint8_t branchListOpcode; if (dListType == DListType::F3DZEX) - endDLOpcode = (uint8_t)F3DZEXOpcode::G_ENDDL; + { + endDLOpcode = static_cast<uint8_t>(F3DZEXOpcode::G_ENDDL); + branchListOpcode = static_cast<uint8_t>(F3DZEXOpcode::G_DL); + } else - endDLOpcode = (uint8_t)F3DEXOpcode::G_ENDDL; + { + endDLOpcode = static_cast<uint8_t>(F3DEXOpcode::G_ENDDL); + branchListOpcode = static_cast<uint8_t>(F3DEXOpcode::G_DL); + } uint32_t ptr = rawDataIndex; size_t rawDataSize = rawData.size(); @@ -429,14 +435,16 @@ int32_t ZDisplayList::GetDListLength(const std::vector<uint8_t>& rawData, uint32 "\t End of file found when trying to find the end of the " "DisplayList at offset: '0x%X'.\n", "Raw data size: 0x%zX.\n", __PRETTY_FUNCTION__, rawDataIndex, rawDataSize)); - throw std::runtime_error(""); } uint8_t opcode = rawData.at(ptr); + bool dlNoPush = rawData.at(ptr + 1) == 1; ptr += 8; - if (opcode == endDLOpcode) + if (opcode == endDLOpcode || (opcode == branchListOpcode && dlNoPush)) + { return ptr - rawDataIndex; + } } } @@ -1573,9 +1581,15 @@ static int32_t GfxdCallback_FormatSingleEntry() } // dont print a new line after the last command - if (macroId != gfxd_SPEndDisplayList) + switch (macroId) { + case gfxd_SPEndDisplayList: + case gfxd_SPBranchList: + break; + + default: gfxd_puts("\n"); + break; } return 0; |
