mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
remove Ncaheader.Read()
This commit is contained in:
parent
5b009ae30e
commit
41a9b78b1e
2 changed files with 20 additions and 23 deletions
|
@ -191,7 +191,7 @@ namespace LibHac
|
||||||
|
|
||||||
using (var reader = new BinaryReader(new MemoryStream(headerBytes)))
|
using (var reader = new BinaryReader(new MemoryStream(headerBytes)))
|
||||||
{
|
{
|
||||||
Header = NcaHeader.Read(reader);
|
Header = new NcaHeader(reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,50 +25,47 @@ namespace LibHac
|
||||||
|
|
||||||
public NcaFsHeader[] FsHeaders = new NcaFsHeader[4];
|
public NcaFsHeader[] FsHeaders = new NcaFsHeader[4];
|
||||||
|
|
||||||
public static NcaHeader Read(BinaryReader reader)
|
public NcaHeader(BinaryReader reader)
|
||||||
{
|
{
|
||||||
var head = new NcaHeader();
|
Signature1 = reader.ReadBytes(0x100);
|
||||||
|
Signature2 = reader.ReadBytes(0x100);
|
||||||
head.Signature1 = reader.ReadBytes(0x100);
|
Magic = reader.ReadAscii(4);
|
||||||
head.Signature2 = reader.ReadBytes(0x100);
|
if (Magic != "NCA3") throw new InvalidDataException("Not an NCA3 file");
|
||||||
head.Magic = reader.ReadAscii(4);
|
Distribution = (DistributionType)reader.ReadByte();
|
||||||
if (head.Magic != "NCA3") throw new InvalidDataException("Not an NCA3 file");
|
ContentType = (ContentType)reader.ReadByte();
|
||||||
head.Distribution = (DistributionType)reader.ReadByte();
|
CryptoType = reader.ReadByte();
|
||||||
head.ContentType = (ContentType)reader.ReadByte();
|
KaekInd = reader.ReadByte();
|
||||||
head.CryptoType = reader.ReadByte();
|
NcaSize = reader.ReadUInt64();
|
||||||
head.KaekInd = reader.ReadByte();
|
TitleId = reader.ReadUInt64();
|
||||||
head.NcaSize = reader.ReadUInt64();
|
|
||||||
head.TitleId = reader.ReadUInt64();
|
|
||||||
reader.BaseStream.Position += 4;
|
reader.BaseStream.Position += 4;
|
||||||
|
|
||||||
head.SdkVersion = new TitleVersion(reader.ReadUInt32());
|
SdkVersion = new TitleVersion(reader.ReadUInt32());
|
||||||
head.CryptoType2 = reader.ReadByte();
|
CryptoType2 = reader.ReadByte();
|
||||||
reader.BaseStream.Position += 0xF;
|
reader.BaseStream.Position += 0xF;
|
||||||
|
|
||||||
head.RightsId = reader.ReadBytes(0x10);
|
RightsId = reader.ReadBytes(0x10);
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
head.SectionEntries[i] = new NcaSectionEntry(reader);
|
SectionEntries[i] = new NcaSectionEntry(reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
head.SectionHashes[i] = reader.ReadBytes(0x20);
|
SectionHashes[i] = reader.ReadBytes(0x20);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
head.EncryptedKeys[i] = reader.ReadBytes(0x10);
|
EncryptedKeys[i] = reader.ReadBytes(0x10);
|
||||||
}
|
}
|
||||||
|
|
||||||
reader.BaseStream.Position += 0xC0;
|
reader.BaseStream.Position += 0xC0;
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
head.FsHeaders[i] = new NcaFsHeader(reader);
|
FsHeaders[i] = new NcaFsHeader(reader);
|
||||||
}
|
}
|
||||||
return head;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue