1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-10 08:50:23 +00:00

Set up multiversion assets with ZAPD and match gc-eu (#1967)

* Add ZAPD hack to deal with extracted/VERSION/ in include paths

* Extract assets to extracted/VERSION

* Add ZAPD flags to override virtual address / start offset / end offset

* Configure offsets for code and overlay assets

* Reorganize ZAPD configs

* Match gc-eu-mq

* Match gc-eu

* Remove old asset dirs during distclean

* Revert "Remove old asset dirs during distclean"

This reverts commit fc8027a75f.

* make zapd addresses globals int64_t so they can store uint32_t addresses and -1

* slight cleanup extract_assets.py

* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "0285e11f0"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "0285e11f0"
git-subrepo:
  version:  "0.4.6"
  origin:   "git@github.com:ingydotnet/git-subrepo.git"
  commit:   "110b9eb"

---------

Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
cadmic 2024-06-24 06:22:39 -07:00 committed by GitHub
parent b2d80568b9
commit 9def6f4d0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
92 changed files with 4911 additions and 487 deletions

View file

@ -120,6 +120,9 @@ void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename)
if (reader->Attribute("BaseAddress") != nullptr)
baseAddress = StringHelper::StrToL(reader->Attribute("BaseAddress"), 16);
if (mode == ZFileMode::Extract && Globals::Instance->baseAddress != -1)
baseAddress = Globals::Instance->baseAddress;
if (reader->Attribute("RangeStart") != nullptr)
rangeStart = StringHelper::StrToL(reader->Attribute("RangeStart"), 16);
@ -197,6 +200,9 @@ void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename)
}
rawData = File::ReadAllBytes((basePath / name).string());
if (mode == ZFileMode::Extract && Globals::Instance->startOffset != -1 && Globals::Instance->endOffset != -1)
rawData = std::vector<uint8_t>(rawData.begin() + Globals::Instance->startOffset,
rawData.begin() + Globals::Instance->endOffset);
if (reader->Attribute("RangeEnd") == nullptr)
rangeEnd = rawData.size();
@ -585,6 +591,12 @@ Declaration* ZFile::AddDeclarationIncludeArray(offset_t address, std::string& in
includePath = "assets/" + StringHelper::Split(includePath, "assets/extracted/")[1];
if (StringHelper::StartsWith(includePath, "assets/custom/"))
includePath = "assets/" + StringHelper::Split(includePath, "assets/custom/")[1];
// Hack for OOT: don't prefix include paths with extracted/VERSION/
if (StringHelper::StartsWith(includePath, "extracted/")) {
std::vector<std::string> parts = StringHelper::Split(includePath, "/");
parts.erase(parts.begin(), parts.begin() + 2);
includePath = StringHelper::Join(parts, "/");
}
Declaration* decl = GetDeclaration(address);
if (decl == nullptr)
@ -621,6 +633,12 @@ Declaration* ZFile::AddDeclarationIncludeArray(offset_t address, std::string& in
includePath = "assets/" + StringHelper::Split(includePath, "assets/extracted/")[1];
if (StringHelper::StartsWith(includePath, "assets/custom/"))
includePath = "assets/" + StringHelper::Split(includePath, "assets/custom/")[1];
// Hack for OOT: don't prefix include paths with extracted/VERSION/
if (StringHelper::StartsWith(includePath, "extracted/")) {
std::vector<std::string> parts = StringHelper::Split(includePath, "/");
parts.erase(parts.begin(), parts.begin() + 2);
includePath = StringHelper::Join(parts, "/");
}
Declaration* decl = GetDeclaration(address);
if (decl == nullptr)