From 3d6993a1ece2e4de73355a3cab45260f68dd930a Mon Sep 17 00:00:00 2001 From: parax0 Date: Sat, 19 Mar 2016 03:00:13 -0600 Subject: [PATCH] Fixed an issue in the area cooker where unneeded padding is written to the file if the padding is exactly 32 bytes --- src/Core/Resource/Cooker/CAreaCooker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Core/Resource/Cooker/CAreaCooker.cpp b/src/Core/Resource/Cooker/CAreaCooker.cpp index 932a676d..4c9893f2 100644 --- a/src/Core/Resource/Cooker/CAreaCooker.cpp +++ b/src/Core/Resource/Cooker/CAreaCooker.cpp @@ -277,14 +277,14 @@ void CAreaCooker::FinishBlock() if (EnableCompression) { bool Success = CompressionUtil::CompressSegmentedData((u8*) mCompressedData.Data(), mCompressedData.Size(), CompressedBuf.data(), CompressedSize, UseZlib); - u32 PadBytes = (32 - (CompressedSize % 32)) & 0x3F; + u32 PadBytes = (32 - (CompressedSize % 32)) & 0x1F; WriteCompressedData = Success && (CompressedSize + PadBytes < (u32) mCompressedData.Size()); } if (WriteCompressedData) { u32 PadBytes = 32 - (CompressedSize % 32); - PadBytes &= 0x3F; + PadBytes &= 0x1F; for (u32 iPad = 0; iPad < PadBytes; iPad++) mAreaData.WriteByte(0);