mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-26 06:20:24 +00:00
Auto detect lz4 compression on open files and also sdf
This commit is contained in:
parent
29b4e07fd5
commit
059e9d9ecc
7 changed files with 10 additions and 1 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -150,7 +150,7 @@ namespace FirstPlugin
|
||||||
byte[] decomp = null;
|
byte[] decomp = null;
|
||||||
if (magic == 0xDFF25B82 || magic == 0xFD2FB528)
|
if (magic == 0xDFF25B82 || magic == 0xFD2FB528)
|
||||||
decomp = STLibraryCompression.ZSTD.Decompress(CompressedBlock);
|
decomp = STLibraryCompression.ZSTD.Decompress(CompressedBlock);
|
||||||
else if (header.Version > 22)
|
else if (magic == 0x184D2204)
|
||||||
decomp = STLibraryCompression.Type_LZ4.Decompress(CompressedBlock);
|
decomp = STLibraryCompression.Type_LZ4.Decompress(CompressedBlock);
|
||||||
else
|
else
|
||||||
decomp = STLibraryCompression.ZLIB.Decompress(CompressedBlock);
|
decomp = STLibraryCompression.ZLIB.Decompress(CompressedBlock);
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -124,6 +124,15 @@ namespace Switch_Toolbox.Library.IO
|
||||||
return OpenFileFormat(FileName, data, LeaveStreamOpen, InArchive, archiveNode, true,
|
return OpenFileFormat(FileName, data, LeaveStreamOpen, InArchive, archiveNode, true,
|
||||||
CompressionType.Gzip, DecompressedFileSize, CompressedFileSize);
|
CompressionType.Gzip, DecompressedFileSize, CompressedFileSize);
|
||||||
}
|
}
|
||||||
|
if (MagicHex == 0x184D2204)
|
||||||
|
{
|
||||||
|
if (data == null)
|
||||||
|
data = File.ReadAllBytes(FileName);
|
||||||
|
|
||||||
|
data = STLibraryCompression.Type_LZ4.Decompress(data);
|
||||||
|
return OpenFileFormat(FileName, data, LeaveStreamOpen, InArchive, archiveNode, true,
|
||||||
|
CompressionType.Lz4, DecompressedFileSize, CompressedFileSize);
|
||||||
|
}
|
||||||
if (Path.GetExtension(FileName) == ".lz" && CompType == CompressionType.None)
|
if (Path.GetExtension(FileName) == ".lz" && CompType == CompressionType.None)
|
||||||
{
|
{
|
||||||
if (data == null)
|
if (data == null)
|
||||||
|
|
Loading…
Reference in a new issue