aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Core/Loaders/Compression
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-06-10 21:46:42 -0300
committergdkchan <gab.dark.100@gmail.com>2018-06-10 21:46:42 -0300
commit76f3b1b3a4637ec72abfbb8cbc0679f2e0ca838f (patch)
tree0411b709de31c1c0517763512df8eeb9f7491bc9 /Ryujinx.Core/Loaders/Compression
parent518fe799da6dd4f12c58c9e6e174767effb0b868 (diff)
Rename Ryujinx.Core to Ryujinx.HLE and add a separate project for a future LLE implementation
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