aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/Loaders/Npdm/KernelAccessControl.cs
blob: 979c6f66902c3d0f9905c08e691d387cac4fa6ff (plain) (blame)
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
using System.IO;

namespace Ryujinx.HLE.Loaders.Npdm
{
    public class KernelAccessControl
    {
        public int[] Capabilities { get; private set; }

        /// <exception cref="System.ArgumentException">The stream does not support reading, is <see langword="null"/>, or is already closed.</exception>
        /// <exception cref="EndOfStreamException">The end of the stream is reached.</exception>
        /// <exception cref="System.ObjectDisposedException">The stream is closed.</exception>
        /// <exception cref="IOException">An I/O error occurred.</exception>
        public KernelAccessControl(Stream stream, int offset, int size)
        {
            stream.Seek(offset, SeekOrigin.Begin);

            Capabilities = new int[size / 4];

            BinaryReader reader = new(stream);

            for (int index = 0; index < Capabilities.Length; index++)
            {
                Capabilities[index] = reader.ReadInt32();
            }
        }
    }
}