From 641f97442f6ce65646faa70c6304cd10f2247cc4 Mon Sep 17 00:00:00 2001 From: burninrubber0 Date: Tue, 18 Jun 2024 16:17:35 -0400 Subject: [PATCH] Fix entries alignment when debug data is present --- src/create.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/create.cpp b/src/create.cpp index 1d3a10e..b9fd8af 100644 --- a/src/create.cpp +++ b/src/create.cpp @@ -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 @@ -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); }