From 724f59512f277fb3ad3ddc75670c879dcff1420d Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Thu, 29 May 2014 22:15:40 +0200 Subject: [PATCH] Fix games that don't store compressed size in the header (?). --- Program.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Program.cs b/Program.cs index 05714d4..e1c3788 100644 --- a/Program.cs +++ b/Program.cs @@ -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 + "..." );