Ryujinx/Ryujinx.HLE/Loaders/Npdm/FSAccessHeader.cs
Ac_K 4e430760b4 Implement NPDM files parser (#169)
* Implement NPDM files parser

(Currently not used in Ryujinx)

* Add credits

* Add Swap32

* Update Npdm.cs

* Update ACI0.cs

* Update ACID.cs

* Update Npdm.cs

* Update EndianSwap.cs

* Update ACI0.cs

* Update ACID.cs

* Update KernelAccessControl.cs

* Update NpdmInfo.cs

* Update ServiceAccessControl.cs

* Update NpdmInfo.cs
2018-06-17 23:28:11 -03:00

37 lines
1.1 KiB
C#

using System.IO;
namespace Ryujinx.HLE.Loaders.Npdm
{
public class FSAccessHeader
{
public int Version;
public ulong PermissionsBitmask;
public int DataSize;
public int ContentOwnerIDSize;
public int DataAndContentOwnerIDSize;
public FSAccessHeader(Stream FSAccessHeaderStream, int Offset, int Size)
{
FSAccessHeaderStream.Seek(Offset, SeekOrigin.Begin);
BinaryReader Reader = new BinaryReader(FSAccessHeaderStream);
Version = Reader.ReadInt32();
PermissionsBitmask = Reader.ReadUInt64();
DataSize = Reader.ReadInt32();
if (DataSize != 0x1C)
{
throw new InvalidNpdmException("FSAccessHeader is corrupted!");
}
ContentOwnerIDSize = Reader.ReadInt32();
DataAndContentOwnerIDSize = Reader.ReadInt32();
if (DataAndContentOwnerIDSize != 0x1C)
{
throw new InvalidNpdmException("ContentOwnerID section is not implemented!");
}
}
}
}