aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/Loaders/Executables/KipExecutable.cs
blob: 9f04cf4e4391d4f53663d4347f3a7b69b0155064 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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);
        }
    }
}