diff --git a/BurnOutSharp.Builders/Quantum.cs b/BurnOutSharp.Builders/Quantum.cs
index 9faed8d1..e0b2c196 100644
--- a/BurnOutSharp.Builders/Quantum.cs
+++ b/BurnOutSharp.Builders/Quantum.cs
@@ -78,7 +78,7 @@ namespace BurnOutSharp.Builders
// Read all entries in turn
for (int i = 0; i < header.FileCount; i++)
{
- var file = ParseFileDescriptor(data);
+ var file = ParseFileDescriptor(data, header.MinorVersion);
if (file == null)
return null;
@@ -91,6 +91,9 @@ namespace BurnOutSharp.Builders
#endregion
+ // Cache the compressed data offset
+ archive.CompressedDataOffset = data.Position;
+
return archive;
}
@@ -122,8 +125,9 @@ namespace BurnOutSharp.Builders
/// Parse a Stream into a file descriptor
///
/// Stream to parse
+ /// Minor version of the archive
/// Filled file descriptor on success, null on error
- private static FileDescriptor ParseFileDescriptor(Stream data)
+ private static FileDescriptor ParseFileDescriptor(Stream data, byte minorVersion)
{
// TODO: Use marshalling here instead of building
FileDescriptor fileDescriptor = new FileDescriptor();
@@ -146,6 +150,10 @@ namespace BurnOutSharp.Builders
fileDescriptor.FileTime = data.ReadUInt16();
fileDescriptor.FileDate = data.ReadUInt16();
+ // Hack for unknown format data
+ if (minorVersion == 22)
+ _ = data.ReadUInt16();
+
return fileDescriptor;
}
diff --git a/BurnOutSharp.Compression/Quantum/Decompressor.cs b/BurnOutSharp.Compression/Quantum/Decompressor.cs
index 1accf436..f9976180 100644
--- a/BurnOutSharp.Compression/Quantum/Decompressor.cs
+++ b/BurnOutSharp.Compression/Quantum/Decompressor.cs
@@ -142,7 +142,7 @@ namespace BurnOutSharp.Compression.Quantum
}
}
- if (togo != 0)
+ if (togo > 0)
return false;
Array.Copy(state.Window, (windowPosition == 0 ? windowSize : windowPosition) - outlen, outbuf, 0, outlen);
diff --git a/BurnOutSharp.Models/Quantum/Archive.cs b/BurnOutSharp.Models/Quantum/Archive.cs
index 4f6722a6..e8444613 100644
--- a/BurnOutSharp.Models/Quantum/Archive.cs
+++ b/BurnOutSharp.Models/Quantum/Archive.cs
@@ -16,6 +16,9 @@ namespace BurnOutSharp.Models.Quantum
///
public FileDescriptor[] FileList { get; set; }
- // Immediately following the list of files is the compressed data.
+ ///
+ /// Immediately following the list of files is the compressed data
+ ///
+ public long CompressedDataOffset { get; set; }
}
}
\ No newline at end of file
diff --git a/BurnOutSharp.Wrappers/Quantum.cs b/BurnOutSharp.Wrappers/Quantum.cs
index 3fe48376..1899544c 100644
--- a/BurnOutSharp.Wrappers/Quantum.cs
+++ b/BurnOutSharp.Wrappers/Quantum.cs
@@ -1,7 +1,5 @@
using System;
using System.IO;
-using SharpCompress.Compressors;
-using SharpCompress.Compressors.Deflate;
namespace BurnOutSharp.Wrappers
{
@@ -38,6 +36,9 @@ namespace BurnOutSharp.Wrappers
#endregion
+ ///
+ public long CompressedDataOffset => _archive.CompressedDataOffset;
+
#endregion
#region Instance Variables
@@ -162,6 +163,8 @@ namespace BurnOutSharp.Wrappers
PrintHeader();
PrintFileList();
+ Console.WriteLine($" Compressed data offset: {CompressedDataOffset}");
+ Console.WriteLine();
}
///