From dc144d2e190e03729b16e402da9c36eec5aaf53f Mon Sep 17 00:00:00 2001 From: Elise Date: Wed, 8 Apr 2020 00:41:02 +0200 Subject: Use libhac for loading NSO and KIP (#1047) * Use libhac for loading NSOs and KIPs * Fix formatting * Refactor KIP and NSO executables for libhac * Fix up formatting * Remove Ryujinx.HLE.Loaders.Compression * Remove reference to Ryujinx.HLE.Loaders.Compression in NxStaticObject.cs * Remove reference to Ryujinx.HLE.Loaders.Compression in KernelInitialProcess.cs * Rename classes in Ryujinx.HLE.Loaders.Executables * Fix space alignment * Fix up formatting --- Ryujinx.HLE/Loaders/Compression/Lz4.cs | 78 ---------------------------------- 1 file changed, 78 deletions(-) delete mode 100644 Ryujinx.HLE/Loaders/Compression/Lz4.cs (limited to 'Ryujinx.HLE/Loaders/Compression/Lz4.cs') diff --git a/Ryujinx.HLE/Loaders/Compression/Lz4.cs b/Ryujinx.HLE/Loaders/Compression/Lz4.cs deleted file mode 100644 index 2001a8dc..00000000 --- a/Ryujinx.HLE/Loaders/Compression/Lz4.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; - -namespace Ryujinx.HLE.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 chunk - litCount = GetLength(litCount); - - Buffer.BlockCopy(cmp, cmpPos, dec, decPos, litCount); - - cmpPos += litCount; - decPos += litCount; - - if (cmpPos >= cmp.Length) - { - break; - } - - // Copy compressed chunk - 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 -- cgit v1.2.3