From 7fbe044ab883b26fd4366dfc379e705d525705d1 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 28 Sep 2021 22:23:04 -0700 Subject: [PATCH] Read ContentIndex data, just in case --- NDecrypt/N3DS/Headers/CIAHeader.cs | 5 ++--- NDecrypt/N3DS/Headers/Ticket.cs | 7 ++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/NDecrypt/N3DS/Headers/CIAHeader.cs b/NDecrypt/N3DS/Headers/CIAHeader.cs index 0cb3933..e69a033 100644 --- a/NDecrypt/N3DS/Headers/CIAHeader.cs +++ b/NDecrypt/N3DS/Headers/CIAHeader.cs @@ -49,7 +49,7 @@ namespace NDecrypt.N3DS.Headers /// /// Content Index /// - 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); diff --git a/NDecrypt/N3DS/Headers/Ticket.cs b/NDecrypt/N3DS/Headers/Ticket.cs index 08fb501..0b3cd18 100644 --- a/NDecrypt/N3DS/Headers/Ticket.cs +++ b/NDecrypt/N3DS/Headers/Ticket.cs @@ -176,6 +176,11 @@ namespace NDecrypt.N3DS.Headers /// public int ContentIndexSize { get; private set; } + /// + /// Content Index + /// + public byte[] ContentIndex { get; private set; } + /// /// Certificate chain /// @@ -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);