2018-08-17 01:47:36 +02:00
|
|
|
|
using Ryujinx.HLE.Exceptions;
|
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.Loaders.Npdm
|
|
|
|
|
{
|
2018-12-01 21:38:15 +01:00
|
|
|
|
internal class FsAccessHeader
|
2018-08-17 01:47:36 +02:00
|
|
|
|
{
|
|
|
|
|
public int Version { get; private set; }
|
|
|
|
|
public ulong PermissionsBitmask { get; private set; }
|
|
|
|
|
|
2018-12-01 21:01:59 +01:00
|
|
|
|
public FsAccessHeader(Stream stream, int offset, int size)
|
2018-08-17 01:47:36 +02:00
|
|
|
|
{
|
2018-12-01 21:01:59 +01:00
|
|
|
|
stream.Seek(offset, SeekOrigin.Begin);
|
2018-08-17 01:47:36 +02:00
|
|
|
|
|
2018-12-01 21:01:59 +01:00
|
|
|
|
BinaryReader reader = new BinaryReader(stream);
|
2018-08-17 01:47:36 +02:00
|
|
|
|
|
2018-12-01 21:01:59 +01:00
|
|
|
|
Version = reader.ReadInt32();
|
|
|
|
|
PermissionsBitmask = reader.ReadUInt64();
|
2018-08-17 01:47:36 +02:00
|
|
|
|
|
2018-12-01 21:01:59 +01:00
|
|
|
|
int dataSize = reader.ReadInt32();
|
2018-08-17 01:47:36 +02:00
|
|
|
|
|
2018-12-01 21:01:59 +01:00
|
|
|
|
if (dataSize != 0x1c)
|
2018-08-17 01:47:36 +02:00
|
|
|
|
{
|
|
|
|
|
throw new InvalidNpdmException("FsAccessHeader is corrupted!");
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-01 21:01:59 +01:00
|
|
|
|
int contentOwnerIdSize = reader.ReadInt32();
|
|
|
|
|
int dataAndContentOwnerIdSize = reader.ReadInt32();
|
2018-08-17 01:47:36 +02:00
|
|
|
|
|
2018-12-01 21:01:59 +01:00
|
|
|
|
if (dataAndContentOwnerIdSize != 0x1c)
|
2018-08-17 01:47:36 +02:00
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException("ContentOwnerId section is not implemented!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|