1
0
mirror of synced 2025-01-19 09:17:30 +01:00

Add support for non magic LZSS decompresson

This commit is contained in:
KillzXGaming 2020-01-22 17:13:54 -05:00
parent bb7302e36c
commit 094a4673b7

View File

@ -23,7 +23,7 @@ namespace Toolbox.Library
using (var reader = new FileReader(stream, true))
{
hasMagic = reader.CheckSignature(4, "LzS\x01");
return hasMagic;
return hasMagic || Utils.GetExtension(fileName) == ".lzs";
}
}
@ -42,14 +42,14 @@ namespace Toolbox.Library
uint unknown = BitConverter.ToUInt32(arcdata, 4);
decompressedSize = BitConverter.ToUInt32(arcdata, 8);
compressedSize = BitConverter.ToUInt32(arcdata, 12);
if (arcdata.Length != compressedSize + 0x10) throw new Exception("compressed size mismatch");
}
else
{
decompressedSize = BitConverter.ToUInt32(arcdata, 0);
compressedSize = BitConverter.ToUInt32(arcdata, 4);
}
if (arcdata.Length != compressedSize + 0x10) throw new Exception("compressed size mismatch");
List<byte> outdata = new List<byte>();
byte[] BUFFER = new byte[4096];
@ -58,6 +58,8 @@ namespace Toolbox.Library
ushort writeidx = 0xFEE;
ushort readidx = 0;
uint fidx = 0x10;
if (!hasMagic)
fidx = 4;
while (fidx < arcdata.Length)
{