Skip to content

Commit

Permalink
Exclude the rsizetable from dict compression
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchLeaders committed May 13, 2023
1 parent 20aafc0 commit e58f37c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ExKingEditor.Core/TotkZstd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ public class TotkZstd
{
private static readonly string _zsDicPath = Path.Combine(TotkConfig.Shared.GamePath, "Pack", "ZsDic.pack.zs");

private static readonly Decompressor _defaultDecompressor = new();
private static readonly Decompressor _commonDecompressor = new();
private static readonly Decompressor _mapDecompressor = new();
private static readonly Decompressor _packDecompressor = new();

private static readonly Compressor _defaultCompressor = new(16);
private static readonly Compressor _commonCompressor = new(16);
private static readonly Compressor _mapCompressor = new(16);
private static readonly Compressor _packCompressor = new(16);
Expand All @@ -34,6 +36,7 @@ public static Span<byte> Decompress(string file, Span<byte> raw)
return
file.EndsWith(".bcett.byml.zs") ? _mapDecompressor.Unwrap(raw) :
file.EndsWith(".pack.zs") ? _packDecompressor.Unwrap(raw) :
file.EndsWith(".rsizetable.zs") ? _defaultDecompressor.Unwrap(raw) :
_commonDecompressor.Unwrap(raw);
}

Expand All @@ -42,6 +45,7 @@ public static Span<byte> Compress(string file, Span<byte> raw)
return
file.EndsWith(".bcett.byml") ? _mapCompressor.Wrap(raw) :
file.EndsWith(".pack.zs") ? _packCompressor.Wrap(raw) :
file.EndsWith(".rsizetable.zs") ? _defaultCompressor.Wrap(raw) :
_commonCompressor.Wrap(raw);
}
}

0 comments on commit e58f37c

Please sign in to comment.