Read ContentIndex data, just in case

This commit is contained in:
Matt Nadareski
2021-09-28 22:23:04 -07:00
parent 7c9a035d7c
commit 7fbe044ab8
2 changed files with 8 additions and 4 deletions

View File

@@ -49,7 +49,7 @@ namespace NDecrypt.N3DS.Headers
/// <summary>
/// Content Index
/// </summary>
public int ContentIndex { get; private set; }
public byte[] ContentIndex { get; private set; }
#region Content Index
@@ -102,8 +102,7 @@ namespace NDecrypt.N3DS.Headers
header.TMDFileSize = reader.ReadInt32();
header.MetaSize = reader.ReadInt32();
header.ContentSize = reader.ReadInt64();
header.ContentIndex = reader.ReadInt32();
reader.ReadBytes(0x2000); // TODO: Not sure what's in the Content Index area
header.ContentIndex = reader.ReadBytes(0x2000);
if (reader.BaseStream.Position % 64 != 0)
reader.BaseStream.Seek(64 - (reader.BaseStream.Position % 64), SeekOrigin.Current);

View File

@@ -176,6 +176,11 @@ namespace NDecrypt.N3DS.Headers
/// </summary>
public int ContentIndexSize { get; private set; }
/// <summary>
/// Content Index
/// </summary>
public byte[] ContentIndex { get; private set; }
/// <summary>
/// Certificate chain
/// </summary>
@@ -252,7 +257,7 @@ namespace NDecrypt.N3DS.Headers
reader.ReadBytes(4); // Seek to size in Content Index
tk.ContentIndexSize = BitConverter.ToInt32(reader.ReadBytes(4).Reverse().ToArray(), 0);
reader.BaseStream.Seek(-8, SeekOrigin.Current);
reader.ReadBytes(tk.ContentIndexSize); // TODO: Not sure what's in the Content Index area
tk.ContentIndex = reader.ReadBytes(tk.ContentIndexSize);
if (reader.BaseStream.Position % 64 != 0)
reader.BaseStream.Seek(64 - (reader.BaseStream.Position % 64), SeekOrigin.Current);