2018-08-16 23:47:36 +00:00
|
|
|
|
using Ryujinx.HLE.Exceptions;
|
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.Loaders.Npdm
|
|
|
|
|
{
|
|
|
|
|
class FsAccessHeader
|
|
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
|
public int Version { get; private set; }
|
|
|
|
|
public ulong PermissionsBitmask { get; private set; }
|
2018-08-16 23:47:36 +00:00
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
|
public FsAccessHeader(Stream Stream, int Offset, int Size)
|
2018-08-16 23:47:36 +00:00
|
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
|
Stream.Seek(Offset, SeekOrigin.Begin);
|
2018-08-16 23:47:36 +00:00
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
|
BinaryReader Reader = new BinaryReader(Stream);
|
2018-08-16 23:47:36 +00:00
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
|
Version = Reader.ReadInt32();
|
|
|
|
|
PermissionsBitmask = Reader.ReadUInt64();
|
2018-08-16 23:47:36 +00:00
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
|
int DataSize = Reader.ReadInt32();
|
2018-08-16 23:47:36 +00:00
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
|
if (DataSize != 0x1c)
|
2018-08-16 23:47:36 +00:00
|
|
|
|
{
|
|
|
|
|
throw new InvalidNpdmException("FsAccessHeader is corrupted!");
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
|
int ContentOwnerIdSize = Reader.ReadInt32();
|
|
|
|
|
int DataAndContentOwnerIdSize = Reader.ReadInt32();
|
2018-08-16 23:47:36 +00:00
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
|
if (DataAndContentOwnerIdSize != 0x1c)
|
2018-08-16 23:47:36 +00:00
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException("ContentOwnerId section is not implemented!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|