Fix games that don't store compressed size in the header (?).

This commit is contained in:
Admiral H. Curtiss
2014-05-29 22:15:40 +02:00
parent 08679e4485
commit 724f59512f

View File

@@ -175,9 +175,12 @@ namespace WfcPatcher {
data = blz.BLZ_Encode( decData, 0 );
newCompressedSize = (uint)data.Length;
byte[] newCompressedSizeBytes = BitConverter.GetBytes( newCompressedSize );
nds.Position = pos + i + 0x1C;
nds.Write( newCompressedSizeBytes, 0, 3 );
// replace compressed size, if it was used before
if ( compressedSize == overlaySize ) {
byte[] newCompressedSizeBytes = BitConverter.GetBytes( newCompressedSize );
nds.Position = pos + i + 0x1C;
nds.Write( newCompressedSizeBytes, 0, 3 );
}
} else {
Console.WriteLine( "Replacing overlay " + id + "..." );