diff options
| author | Archez <Archez@users.noreply.github.com> | 2024-05-02 20:43:16 -0400 |
|---|---|---|
| committer | louist103 <35883445+louist103@users.noreply.github.com> | 2025-03-29 13:50:21 -0400 |
| commit | c12ec3bbc1ee2630e0788e5ec66e7ba2275aef69 (patch) | |
| tree | 665ed6509d61b8e8daf0ad7476afc94ee2fa70c2 | |
| parent | 07d2b908db667be1b3b0dd04648b80076cf8c650 (diff) | |
search for dlist in external files for branch z (#21)
| -rw-r--r-- | OTRExporter/DisplayListExporter.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/OTRExporter/DisplayListExporter.cpp b/OTRExporter/DisplayListExporter.cpp index 40bb779..5f686a6 100644 --- a/OTRExporter/DisplayListExporter.cpp +++ b/OTRExporter/DisplayListExporter.cpp @@ -391,9 +391,24 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina } else { - word0 = 0; - word1 = 0; - spdlog::error(StringHelper::Sprintf("dListDecl == nullptr! Addr = {:08X}", GETSEGOFFSET(data))); + // If we can't find the display list in this file, try looking in other files based on the segment number + uint32_t seg = data2 & 0xFFFFFFFF; + std::string resourceName = ""; + bool foundDecl = Globals::Instance->GetSegmentedPtrName(seg, dList->parent, "", resourceName, res->parent->workerID); + if (foundDecl) { + ZFile* assocFile = Globals::Instance->GetSegment(GETSEGNUM(seg), res->parent->workerID); + std::string assocFileName = assocFile->GetName(); + std::string fName = GetPathToRes(assocFile->resources[0], resourceName.c_str()); + + uint64_t hash = CRC64(fName.c_str()); + + word0 = hash >> 32; + word1 = hash & 0xFFFFFFFF; + } else { + word0 = 0; + word1 = 0; + spdlog::error(StringHelper::Sprintf("dListDecl == nullptr! Addr = {:08X}", GETSEGOFFSET(data2))); + } } for (size_t i = 0; i < dList->otherDLists.size(); i++) |
