diff options
| author | TSR Berry <20988865+TSRBerry@users.noreply.github.com> | 2023-04-08 01:22:00 +0200 |
|---|---|---|
| committer | Mary <thog@protonmail.com> | 2023-04-27 23:51:14 +0200 |
| commit | cee712105850ac3385cd0091a923438167433f9f (patch) | |
| tree | 4a5274b21d8b7f938c0d0ce18736d3f2993b11b1 /Ryujinx.HLE/Loaders/Executables/KipExecutable.cs | |
| parent | cd124bda587ef09668a971fa1cac1c3f0cfc9f21 (diff) | |
Move solution and projects to src
Diffstat (limited to 'Ryujinx.HLE/Loaders/Executables/KipExecutable.cs')
| -rw-r--r-- | Ryujinx.HLE/Loaders/Executables/KipExecutable.cs | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/Ryujinx.HLE/Loaders/Executables/KipExecutable.cs b/Ryujinx.HLE/Loaders/Executables/KipExecutable.cs deleted file mode 100644 index ad2b681c..00000000 --- a/Ryujinx.HLE/Loaders/Executables/KipExecutable.cs +++ /dev/null @@ -1,86 +0,0 @@ -using LibHac.Common; -using LibHac.Fs; -using LibHac.Kernel; -using System; - -namespace Ryujinx.HLE.Loaders.Executables -{ - class KipExecutable : IExecutable - { - public byte[] Program { get; } - public Span<byte> Text => Program.AsSpan((int)TextOffset, (int)TextSize); - public Span<byte> Ro => Program.AsSpan((int)RoOffset, (int)RoSize); - public Span<byte> Data => Program.AsSpan((int)DataOffset, (int)DataSize); - - public uint TextOffset { get; } - public uint RoOffset { get; } - public uint DataOffset { get; } - public uint BssOffset { get; } - - public uint TextSize { get; } - public uint RoSize { get; } - public uint DataSize { get; } - public uint BssSize { get; } - - public uint[] Capabilities { get; } - public bool UsesSecureMemory { get; } - public bool Is64BitAddressSpace { get; } - public bool Is64Bit { get; } - public ulong ProgramId { get; } - public byte Priority { get; } - public int StackSize { get; } - public byte IdealCoreId { get; } - public int Version { get; } - public string Name { get; } - - public KipExecutable(in SharedRef<IStorage> inStorage) - { - KipReader reader = new KipReader(); - - reader.Initialize(in inStorage).ThrowIfFailure(); - - TextOffset = (uint)reader.Segments[0].MemoryOffset; - RoOffset = (uint)reader.Segments[1].MemoryOffset; - DataOffset = (uint)reader.Segments[2].MemoryOffset; - BssOffset = (uint)reader.Segments[3].MemoryOffset; - BssSize = (uint)reader.Segments[3].Size; - - StackSize = reader.StackSize; - - UsesSecureMemory = reader.UsesSecureMemory; - Is64BitAddressSpace = reader.Is64BitAddressSpace; - Is64Bit = reader.Is64Bit; - - ProgramId = reader.ProgramId; - Priority = reader.Priority; - IdealCoreId = reader.IdealCoreId; - Version = reader.Version; - Name = reader.Name.ToString(); - - Capabilities = new uint[32]; - - for (int index = 0; index < Capabilities.Length; index++) - { - Capabilities[index] = reader.Capabilities[index]; - } - - reader.GetSegmentSize(KipReader.SegmentType.Data, out int uncompressedSize).ThrowIfFailure(); - Program = new byte[DataOffset + uncompressedSize]; - - TextSize = DecompressSection(reader, KipReader.SegmentType.Text, TextOffset, Program); - RoSize = DecompressSection(reader, KipReader.SegmentType.Ro, RoOffset, Program); - DataSize = DecompressSection(reader, KipReader.SegmentType.Data, DataOffset, Program); - } - - private static uint DecompressSection(KipReader reader, KipReader.SegmentType segmentType, uint offset, byte[] program) - { - reader.GetSegmentSize(segmentType, out int uncompressedSize).ThrowIfFailure(); - - var span = program.AsSpan((int)offset, uncompressedSize); - - reader.ReadSegment(segmentType, span).ThrowIfFailure(); - - return (uint)uncompressedSize; - } - } -}
\ No newline at end of file |
