aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Core/Loaders/Compression
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Core/Loaders/Compression')
-rw-r--r--Ryujinx.Core/Loaders/Compression/Lz4.cs78
1 files changed, 0 insertions, 78 deletions
diff --git a/Ryujinx.Core/Loaders/Compression/Lz4.cs b/Ryujinx.Core/Loaders/Compression/Lz4.cs
deleted file mode 100644
index eb1602a0..00000000
--- a/Ryujinx.Core/Loaders/Compression/Lz4.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-using System;
-
-namespace Ryujinx.Core.Loaders.Compression
-{
- static class Lz4
- {
- public static byte[] Decompress(byte[] Cmp, int DecLength)
- {
- byte[] Dec = new byte[DecLength];
-
- int CmpPos = 0;
- int DecPos = 0;
-
- int GetLength(int Length)
- {
- byte Sum;
-
- if (Length == 0xf)
- {
- do
- {
- Length += (Sum = Cmp[CmpPos++]);
- }
- while (Sum == 0xff);
- }
-
- return Length;
- }
-
- do
- {
- byte Token = Cmp[CmpPos++];
-
- int EncCount = (Token >> 0) & 0xf;
- int LitCount = (Token >> 4) & 0xf;
-
- //Copy literal chunck
- LitCount = GetLength(LitCount);
-
- Buffer.BlockCopy(Cmp, CmpPos, Dec, DecPos, LitCount);
-
- CmpPos += LitCount;
- DecPos += LitCount;
-
- if (CmpPos >= Cmp.Length)
- {
- break;
- }
-
- //Copy compressed chunck
- int Back = Cmp[CmpPos++] << 0 |
- Cmp[CmpPos++] << 8;
-
- EncCount = GetLength(EncCount) + 4;
-
- int EncPos = DecPos - Back;
-
- if (EncCount <= Back)
- {
- Buffer.BlockCopy(Dec, EncPos, Dec, DecPos, EncCount);
-
- DecPos += EncCount;
- }
- else
- {
- while (EncCount-- > 0)
- {
- Dec[DecPos++] = Dec[EncPos++];
- }
- }
- }
- while (CmpPos < Cmp.Length &&
- DecPos < Dec.Length);
-
- return Dec;
- }
- }
-} \ No newline at end of file