Skip to content

Commit

Permalink
Enforce null padding between memtypes 1 and 2
Browse files Browse the repository at this point in the history
  • Loading branch information
burninrubber0 committed Jun 18, 2024
1 parent ba07ad2 commit 8fb7936
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ int YAP::create()
if (remainder != 0)
resourceData[0].resize(resourceData[0].size() - remainder + 0x80, '\0');
}
if (i == 1)
{
uint64_t total = 0;
for (uint32_t j = 0; j < bundle.resourceCount; ++j)
total += bundle.entries[j].uncompressedInfo[i + 1] & 0x0FFFFFFF;
if (total > 0)
{
auto remainder = (bundle.resourceData[0] + resourceData[0].size() + resourceData[1].size()) % 0x80;
if (remainder != 0)
resourceData[1].resize(resourceData[1].size() - remainder + 0x80, '\0');
}
}
}
std::cout << '\n';
outputBundle(stream, bundle, resourceData);
Expand Down

0 comments on commit 8fb7936

Please sign in to comment.