diff options
| author | Garrett Cox <garrettjcox@gmail.com> | 2024-01-14 05:07:56 +0000 |
|---|---|---|
| committer | louist103 <35883445+louist103@users.noreply.github.com> | 2025-03-29 13:50:21 -0400 |
| commit | f9ca6c7efbf4e965e2f2d9096c97ee8e5d7e0b0f (patch) | |
| tree | b1d6ee45329923e7b481adabe908782afc0c259f | |
| parent | 033c64a9471abfcf2bede2af2d6ce87d020a7441 (diff) | |
Fix for dlist referencing vtx outside of their own file (#6)
| -rw-r--r-- | OTRExporter/DisplayListExporter.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/OTRExporter/DisplayListExporter.cpp b/OTRExporter/DisplayListExporter.cpp index f096352..efead06 100644 --- a/OTRExporter/DisplayListExporter.cpp +++ b/OTRExporter/DisplayListExporter.cpp @@ -815,6 +815,22 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina int32_t aa = (data & 0x000000FF00000000ULL) >> 32; int32_t nn = (data & 0x000FF00000000000ULL) >> 44; + bool isSegmentedPtr = false; + std::string fName = ""; + + // If we can't find the display list in this file, try looking in other files based on the segment number + if (vtxDecl == nullptr) { + uint32_t seg = data & 0xFFFFFFFF; + std::string resourceName = ""; + isSegmentedPtr = Globals::Instance->GetSegmentedPtrName(seg, dList->parent, "", resourceName, res->parent->workerID); + + if (isSegmentedPtr) { + ZFile* assocFile = Globals::Instance->GetSegment(GETSEGNUM(seg), res->parent->workerID); + std::string assocFileName = assocFile->GetName(); + fName = GetPathToRes(assocFile->resources[0], resourceName.c_str()); + vtxDecl = assocFile->GetDeclarationRanged(segOffset); + } + } if (vtxDecl != nullptr && vtxDecl->declName != "Gfx") { @@ -830,7 +846,9 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina writer->Write(word0); writer->Write(word1); - std::string fName = OTRExporter_DisplayList::GetPathToRes(res, vtxDecl->declName); + if (!isSegmentedPtr) { + fName = OTRExporter_DisplayList::GetPathToRes(res, vtxDecl->declName); + } uint64_t hash = CRC64(fName.c_str()); |
