aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/Loaders/Executables/KipExecutable.cs
diff options
context:
space:
mode:
authorElise <elisezerotwo@gmail.com>2020-04-08 00:41:02 +0200
committerGitHub <noreply@github.com>2020-04-07 19:41:02 -0300
commitdc144d2e190e03729b16e402da9c36eec5aaf53f (patch)
tree00728f4639cc9642c25031aff6ae9a6d465f4fe7 /Ryujinx.HLE/Loaders/Executables/KipExecutable.cs
parent468d8f841ffcbebf4130371eb64ab04165bce3e9 (diff)
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
Diffstat (limited to 'Ryujinx.HLE/Loaders/Executables/KipExecutable.cs')
-rw-r--r--Ryujinx.HLE/Loaders/Executables/KipExecutable.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/Ryujinx.HLE/Loaders/Executables/KipExecutable.cs b/Ryujinx.HLE/Loaders/Executables/KipExecutable.cs
new file mode 100644
index 00000000..9f04cf4e
--- /dev/null
+++ b/Ryujinx.HLE/Loaders/Executables/KipExecutable.cs
@@ -0,0 +1,35 @@
+using LibHac;
+using LibHac.Fs;
+using System.IO;
+
+namespace Ryujinx.HLE.Loaders.Executables
+{
+ class KipExecutable : Kip, IExecutable
+ {
+ public byte[] Text { get; }
+ public byte[] Ro { get; }
+ public byte[] Data { get; }
+
+ public int TextOffset => Header.Sections[0].OutOffset;
+ public int RoOffset => Header.Sections[1].OutOffset;
+ public int DataOffset => Header.Sections[2].OutOffset;
+ public int BssOffset => Header.Sections[3].OutOffset;
+ public int BssSize => Header.Sections[3].DecompressedSize;
+
+ public int[] Capabilities { get; }
+
+ public KipExecutable(IStorage inStorage) : base(inStorage)
+ {
+ Capabilities = new int[32];
+
+ for (int index = 0; index < Capabilities.Length; index++)
+ {
+ Capabilities[index] = System.BitConverter.ToInt32(Header.Capabilities, index * 4);
+ }
+
+ Text = DecompressSection(0);
+ Ro = DecompressSection(1);
+ Data = DecompressSection(2);
+ }
+ }
+} \ No newline at end of file