From bf8e3645cb7f32d4d5fab55999f3bf9a6575e6d8 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 11 Aug 2010 01:34:05 +1200 Subject: [PATCH] cnc support (doesn't use format80) --- OpenRA.FileFormats/Graphics/VqaReader.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/OpenRA.FileFormats/Graphics/VqaReader.cs b/OpenRA.FileFormats/Graphics/VqaReader.cs index 82c643bf8c..34c44b75f9 100644 --- a/OpenRA.FileFormats/Graphics/VqaReader.cs +++ b/OpenRA.FileFormats/Graphics/VqaReader.cs @@ -127,7 +127,6 @@ namespace OpenRA.FileFormats { var type = new String(reader.ReadChars(4)); var length = Swap(reader.ReadUInt32()); - Console.WriteLine("Parsing chunk {0}@{1}",type, reader.BaseStream.Position-4); switch(type) { @@ -186,13 +185,15 @@ namespace OpenRA.FileFormats var type = new String(reader.ReadChars(4)); int subchunkLength = (int)Swap(reader.ReadUInt32()); - Console.WriteLine("Parsing VQFR sub-chunk {0}@{1}",type, reader.BaseStream.Position-4); switch(type) { // Full compressed frame-modifier case "CBFZ": Format80.DecodeInto( reader.ReadBytes(subchunkLength), cbf ); break; + case "CBF0": + cbf = reader.ReadBytes(subchunkLength); + break; // Partial compressed frame-modifier case "CBPZ": @@ -207,7 +208,18 @@ namespace OpenRA.FileFormats foreach (var b in bytes) newcbfFormat80.Add(b); cbpCount++; break; - + case "CBP0": + // Partial buffer is full; dump and recreate + if (cbpCount == cbParts) + { + cbf = newcbfFormat80.ToArray(); + cbpCount = 0; + newcbfFormat80.Clear(); + } + var bytes2 = reader.ReadBytes(subchunkLength); + foreach (var b in bytes2) newcbfFormat80.Add(b); + cbpCount++; + break; // Palette case "CPL0": for (int i = 0; i < numColors; i++)