FsAccessHeader.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using Ryujinx.HLE.Exceptions;
  2. using System;
  3. using System.IO;
  4. namespace Ryujinx.HLE.Loaders.Npdm
  5. {
  6. class FsAccessHeader
  7. {
  8. public int Version { get; private set; }
  9. public ulong PermissionsBitmask { get; private set; }
  10. public FsAccessHeader(Stream Stream, int Offset, int Size)
  11. {
  12. Stream.Seek(Offset, SeekOrigin.Begin);
  13. BinaryReader Reader = new BinaryReader(Stream);
  14. Version = Reader.ReadInt32();
  15. PermissionsBitmask = Reader.ReadUInt64();
  16. int DataSize = Reader.ReadInt32();
  17. if (DataSize != 0x1c)
  18. {
  19. throw new InvalidNpdmException("FsAccessHeader is corrupted!");
  20. }
  21. int ContentOwnerIdSize = Reader.ReadInt32();
  22. int DataAndContentOwnerIdSize = Reader.ReadInt32();
  23. if (DataAndContentOwnerIdSize != 0x1c)
  24. {
  25. throw new NotImplementedException("ContentOwnerId section is not implemented!");
  26. }
  27. }
  28. }
  29. }