@@ -269,14 +269,29 @@ private static void ExtractFile(string outDir, Stream blockStream, CFFILE file,
269269 for ( int i = 0 ; i < dataBlocks . Length ; i ++ )
270270 {
271271 var db = dataBlocks [ i ] ;
272- if ( db ? . CompressedData == null )
272+ if ( db . CompressedData == null )
273273 continue ;
274274
275+ // Get the data to be processed
276+ byte [ ] blockData = db . CompressedData ;
277+
278+ // If the block is continued, append
279+ if ( db . UncompressedSize == 0 )
280+ {
281+ var nextBlock = dataBlocks [ i ++ ] ;
282+ byte [ ] ? nextData = nextBlock . CompressedData ;
283+ if ( nextData == null )
284+ continue ;
285+
286+ blockData = [ .. blockData , .. nextData ] ;
287+ db . UncompressedSize = nextBlock . UncompressedSize ;
288+ }
289+
275290 // Get the uncompressed data block
276291 byte [ ] data = compressionType switch
277292 {
278- CompressionType . TYPE_NONE => db . CompressedData ,
279- CompressionType . TYPE_MSZIP => DecompressMSZIPBlock ( folderIndex , mszip , i , db , includeDebug ) ,
293+ CompressionType . TYPE_NONE => blockData ,
294+ CompressionType . TYPE_MSZIP => DecompressMSZIPBlock ( folderIndex , mszip , i , db , blockData , includeDebug ) ,
280295
281296 // TODO: Unsupported
282297 CompressionType . TYPE_QUANTUM => [ ] ,
@@ -301,20 +316,17 @@ private static void ExtractFile(string outDir, Stream blockStream, CFFILE file,
301316 /// <param name="mszip">MS-ZIP decompressor with persistent state</param>
302317 /// <param name="blockIndex">Index of the block within the folder</param>
303318 /// <param name="block">Block data to be used for decompression</param>
319+ /// <param name="blockData">Block data to be used for decompression</param>
304320 /// <param name="includeDebug">True to include debug data, false otherwise</param>
305321 /// <returns>Byte array representing the decompressed data, empty on error</returns>
306322 /// TODO: Remove once Serialization is updated
307- private static byte [ ] DecompressMSZIPBlock ( int folderIndex , SabreTools . Compression . MSZIP . Decompressor mszip , int blockIndex , CFDATA block , bool includeDebug )
323+ private static byte [ ] DecompressMSZIPBlock ( int folderIndex , SabreTools . Compression . MSZIP . Decompressor mszip , int blockIndex , CFDATA block , byte [ ] blockData , bool includeDebug )
308324 {
309- // Ignore invalid blocks
310- if ( block . CompressedData == null )
311- return [ ] ;
312-
313325 try
314326 {
315327 // Decompress to a temporary stream
316328 using var stream = new MemoryStream ( ) ;
317- mszip . CopyTo ( block . CompressedData , stream ) ;
329+ mszip . CopyTo ( blockData , stream ) ;
318330
319331 // Pad to the correct size but throw a warning about this
320332 if ( stream . Length < block . UncompressedSize )
0 commit comments