summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArchez <Archez@users.noreply.github.com>2024-10-10 19:35:42 -0400
committerGitHub <noreply@github.com>2024-10-10 19:35:42 -0400
commit467f36589b0d6fe6c7f9d248945650a459bce768 (patch)
tree61aaa251af5fc512edab3c474e3b39ec61340804
parent2cfdb3960900ba059f570b2ded2fed3494a96a9b (diff)
Support finding mtx in external files for display lists (#27)
-rw-r--r--OTRExporter/DisplayListExporter.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/OTRExporter/DisplayListExporter.cpp b/OTRExporter/DisplayListExporter.cpp
index a8c25b6..bacc528 100644
--- a/OTRExporter/DisplayListExporter.cpp
+++ b/OTRExporter/DisplayListExporter.cpp
@@ -239,9 +239,28 @@ 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)));
+ uint32_t seg = data & 0xFFFFFFFF;
+ std::string resourceName = "";
+ bool foundDecl = Globals::Instance->GetSegmentedPtrName(seg, dList->parent, "", resourceName, res->parent->workerID);
+ if (foundDecl) {
+ // Remove any leading '&' on the resource name when building our OTR path string
+ if (resourceName[0] == '&') {
+ resourceName = resourceName.substr(1, resourceName.length() - 1);
+ }
+
+ 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(data)));
+ }
}
}
}