0
0
Fork 0
This repository has been archived on 2024-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
ryujinx-final/Ryujinx.HLE/Loaders/Npdm/ACI0.cs

54 lines
1.9 KiB
C#
Raw Normal View History

2018-11-29 02:01:19 +00:00
using Ryujinx.HLE.Exceptions;
using System.IO;
namespace Ryujinx.HLE.Loaders.Npdm
{
class Aci0
2018-11-29 02:01:19 +00:00
{
private const int Aci0Magic = 'A' << 0 | 'C' << 8 | 'I' << 16 | '0' << 24;
2018-11-29 02:01:19 +00:00
public long TitleId { get; private set; }
2018-11-29 02:01:19 +00:00
public int FsVersion { get; private set; }
public ulong FsPermissionsBitmask { get; private set; }
2018-11-29 02:01:19 +00:00
public ServiceAccessControl ServiceAccessControl { get; private set; }
public KernelAccessControl KernelAccessControl { get; private set; }
2018-11-29 02:01:19 +00:00
public Aci0(Stream stream, int offset)
2018-11-29 02:01:19 +00:00
{
stream.Seek(offset, SeekOrigin.Begin);
2018-11-29 02:01:19 +00:00
BinaryReader reader = new BinaryReader(stream);
2018-11-29 02:01:19 +00:00
if (reader.ReadInt32() != Aci0Magic)
2018-11-29 02:01:19 +00:00
{
throw new InvalidNpdmException("ACI0 Stream doesn't contain ACI0 section!");
}
stream.Seek(0xc, SeekOrigin.Current);
2018-11-29 02:01:19 +00:00
TitleId = reader.ReadInt64();
2018-11-29 02:01:19 +00:00
//Reserved.
stream.Seek(8, SeekOrigin.Current);
2018-11-29 02:01:19 +00:00
int fsAccessHeaderOffset = reader.ReadInt32();
int fsAccessHeaderSize = reader.ReadInt32();
int serviceAccessControlOffset = reader.ReadInt32();
int serviceAccessControlSize = reader.ReadInt32();
int kernelAccessControlOffset = reader.ReadInt32();
int kernelAccessControlSize = reader.ReadInt32();
2018-11-29 02:01:19 +00:00
FsAccessHeader fsAccessHeader = new FsAccessHeader(stream, offset + fsAccessHeaderOffset, fsAccessHeaderSize);
2018-11-29 02:01:19 +00:00
FsVersion = fsAccessHeader.Version;
FsPermissionsBitmask = fsAccessHeader.PermissionsBitmask;
2018-11-29 02:01:19 +00:00
ServiceAccessControl = new ServiceAccessControl(stream, offset + serviceAccessControlOffset, serviceAccessControlSize);
2018-11-29 02:01:19 +00:00
KernelAccessControl = new KernelAccessControl(stream, offset + kernelAccessControlOffset, kernelAccessControlSize);
2018-11-29 02:01:19 +00:00
}
}
}