Skip to content

Commit

Permalink
Fix entries alignment when debug data is present
Browse files Browse the repository at this point in the history
  • Loading branch information
burninrubber0 committed Jun 18, 2024
1 parent e571b5c commit 641f974
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ void YAP::createBundle(GameDataStream& stream, YAML::Node& meta, Bundle& bundle)
QFileInfo debugDataInfo(inPath + debugDataFilename);
if (debugDataInfo.exists() && debugDataInfo.size() > 0)
{
bundle.resourceEntries = ((bundle.debugData + debugDataInfo.size() + 1) & 0xFFFFFFF0) + 0x10;
uint32_t entriesOffset = bundle.debugData + debugDataInfo.size() + 1;
if (entriesOffset % 0x10 != 0)
bundle.resourceEntries = (entriesOffset & 0xFFFFFFF0) + 0x10;
else
bundle.resourceEntries = entriesOffset;
bundle.flags |= (uint32_t)Bundle::Flags::ContainsDebugData;
}
else
Expand Down Expand Up @@ -294,7 +298,6 @@ void YAP::outputBundle(GameDataStream& stream, Bundle& bundle, QByteArray data[]
debugDataFile.open(QIODeviceBase::ReadOnly);
QByteArray debugData = debugDataFile.readAll();
debugDataFile.close();
debugData.append('\0');
stream.writeString(debugData);
}

Expand Down

0 comments on commit 641f974

Please sign in to comment.