diff options
| author | Garrett Cox <garrettjcox@gmail.com> | 2024-01-14 05:07:56 +0000 |
|---|---|---|
| committer | louist103 <35883445+louist103@users.noreply.github.com> | 2024-03-02 12:13:15 -0500 |
| commit | 9cf49d9a868e55bcdcf18462ae7e809477440274 (patch) | |
| tree | e99eaed72014255753f5fb202d2a1b278829f2af | |
| parent | fb78ffd5ddc18d03f07991002bb2a756beaef528 (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 5f84abe..f5dcb41 100644 --- a/OTRExporter/DisplayListExporter.cpp +++ b/OTRExporter/DisplayListExporter.cpp @@ -793,6 +793,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") { @@ -808,7 +824,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()); |
