85dbb9559a
* Rename enum fields * Naming conventions * Remove unneeded ".this" * Remove unneeded semicolons * Remove unused Usings * Don't use var * Remove unneeded enum underlying types * Explicitly label class visibility * Remove unneeded @ prefixes * Remove unneeded commas * Remove unneeded if expressions * Method doesn't use unsafe code * Remove unneeded casts * Initialized objects don't need an empty constructor * Remove settings from DotSettings * Revert "Explicitly label class visibility" This reverts commit ad5eb5787cc5b27a4631cd46ef5f551c4ae95e51. * Small changes * Revert external enum renaming * Changes from feedback * Remove unneeded property setters
62 lines
2.2 KiB
C#
62 lines
2.2 KiB
C#
using Ryujinx.HLE.Exceptions;
|
|
using System.IO;
|
|
|
|
namespace Ryujinx.HLE.Loaders.Npdm
|
|
{
|
|
class Acid
|
|
{
|
|
private const int AcidMagic = 'A' << 0 | 'C' << 8 | 'I' << 16 | 'D' << 24;
|
|
|
|
public byte[] Rsa2048Signature { get; }
|
|
public byte[] Rsa2048Modulus { get; }
|
|
public int Unknown1 { get; }
|
|
public int Flags { get; }
|
|
|
|
public long TitleIdRangeMin { get; }
|
|
public long TitleIdRangeMax { get; }
|
|
|
|
public FsAccessControl FsAccessControl { get; }
|
|
public ServiceAccessControl ServiceAccessControl { get; }
|
|
public KernelAccessControl KernelAccessControl { get; }
|
|
|
|
public Acid(Stream stream, int offset)
|
|
{
|
|
stream.Seek(offset, SeekOrigin.Begin);
|
|
|
|
BinaryReader reader = new BinaryReader(stream);
|
|
|
|
Rsa2048Signature = reader.ReadBytes(0x100);
|
|
Rsa2048Modulus = reader.ReadBytes(0x100);
|
|
|
|
if (reader.ReadInt32() != AcidMagic)
|
|
{
|
|
throw new InvalidNpdmException("ACID Stream doesn't contain ACID section!");
|
|
}
|
|
|
|
//Size field used with the above signature (?).
|
|
Unknown1 = reader.ReadInt32();
|
|
|
|
reader.ReadInt32();
|
|
|
|
//Bit0 must be 1 on retail, on devunit 0 is also allowed. Bit1 is unknown.
|
|
Flags = reader.ReadInt32();
|
|
|
|
TitleIdRangeMin = reader.ReadInt64();
|
|
TitleIdRangeMax = reader.ReadInt64();
|
|
|
|
int fsAccessControlOffset = reader.ReadInt32();
|
|
int fsAccessControlSize = reader.ReadInt32();
|
|
int serviceAccessControlOffset = reader.ReadInt32();
|
|
int serviceAccessControlSize = reader.ReadInt32();
|
|
int kernelAccessControlOffset = reader.ReadInt32();
|
|
int kernelAccessControlSize = reader.ReadInt32();
|
|
|
|
FsAccessControl = new FsAccessControl(stream, offset + fsAccessControlOffset, fsAccessControlSize);
|
|
|
|
ServiceAccessControl = new ServiceAccessControl(stream, offset + serviceAccessControlOffset, serviceAccessControlSize);
|
|
|
|
KernelAccessControl = new KernelAccessControl(stream, offset + kernelAccessControlOffset, kernelAccessControlSize);
|
|
}
|
|
}
|
|
}
|