1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-02-22 14:55:39 +00:00

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

This commit is contained in:
cadmic 2024-06-19 11:05:01 -07:00
parent 38921684a5
commit 0f031ad34d
2 changed files with 27 additions and 0 deletions

View file

@ -585,6 +585,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 +627,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)

View file

@ -30,6 +30,21 @@ public:
return result;
}
static std::string Join(const std::vector<std::string> parts, const std::string& delimiter)
{
std::string result;
for (size_t i = 0; i < parts.size(); i++)
{
result += parts[i];
if (i != parts.size() - 1)
result += delimiter;
}
return result;
}
static std::string Strip(std::string s, const std::string& delimiter)
{
size_t pos = 0;