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. }