Fix decompression logic...
This commit is contained in:
parent
1a86e670ca
commit
7710cfba59
@ -53,12 +53,8 @@ namespace RobloxFiles.BinaryFormat
|
|||||||
{
|
{
|
||||||
Stream decompStream = null;
|
Stream decompStream = null;
|
||||||
|
|
||||||
if (CompressedData[0] >= 0xF0)
|
|
||||||
{
|
if (CompressedData[0] == 0x78 || CompressedData[0] == 0x58)
|
||||||
// Probably LZ4
|
|
||||||
decompStream = new LZ4Stream(compStream, CompressionMode.Decompress);
|
|
||||||
}
|
|
||||||
else if (CompressedData[0] == 0x78 || CompressedData[0] == 0x58)
|
|
||||||
{
|
{
|
||||||
// Probably zlib
|
// Probably zlib
|
||||||
decompStream = new DeflateStream(compStream, CompressionMode.Decompress);
|
decompStream = new DeflateStream(compStream, CompressionMode.Decompress);
|
||||||
@ -68,6 +64,12 @@ namespace RobloxFiles.BinaryFormat
|
|||||||
// Probably zstd
|
// Probably zstd
|
||||||
decompStream = new DecompressionStream(compStream);
|
decompStream = new DecompressionStream(compStream);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Probably LZ4
|
||||||
|
var decomp = LZ4Codec.Decode(CompressedData, 0, CompressedSize, Size);
|
||||||
|
decompStream = new MemoryStream(decomp);
|
||||||
|
}
|
||||||
|
|
||||||
if (decompStream == null)
|
if (decompStream == null)
|
||||||
throw new Exception("Unsupported compression scheme!");
|
throw new Exception("Unsupported compression scheme!");
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user