diff --git a/SabreTools.Serialization/Models/N3DS/ARM11KernelCapabilities.cs b/SabreTools.Serialization/Models/N3DS/ARM11KernelCapabilities.cs
index 2a5769f1..048d93fc 100644
--- a/SabreTools.Serialization/Models/N3DS/ARM11KernelCapabilities.cs
+++ b/SabreTools.Serialization/Models/N3DS/ARM11KernelCapabilities.cs
@@ -39,7 +39,7 @@ namespace SabreTools.Data.Models.N3DS
/// TODO: Make enum for flag values
/// 28 entries
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)]
- public uint[]? Descriptors;
+ public uint[] Descriptors;
///
/// Reserved
diff --git a/SabreTools.Serialization/Models/N3DS/ARM11LocalSystemCapabilities.cs b/SabreTools.Serialization/Models/N3DS/ARM11LocalSystemCapabilities.cs
index 3e284237..02931dfd 100644
--- a/SabreTools.Serialization/Models/N3DS/ARM11LocalSystemCapabilities.cs
+++ b/SabreTools.Serialization/Models/N3DS/ARM11LocalSystemCapabilities.cs
@@ -44,26 +44,26 @@ namespace SabreTools.Data.Models.N3DS
///
/// 16 entries
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
- public ushort[]? ResourceLimitDescriptors;
+ public ushort[] ResourceLimitDescriptors = new ushort[16];
///
/// Storage info
///
- public StorageInfo? StorageInfo;
+ public StorageInfo StorageInfo;
///
/// Service access control
///
/// 32 entries
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
- public ulong[]? ServiceAccessControl;
+ public ulong[] ServiceAccessControl = new ulong[32];
///
/// Extended service access control, support for this was implemented with 9.3.0-X.
///
/// 2 entries
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
- public ulong[]? ExtendedServiceAccessControl;
+ public ulong[] ExtendedServiceAccessControl = new ulong[2];
///
/// Reserved
diff --git a/SabreTools.Serialization/Models/N3DS/ARM9AccessControl.cs b/SabreTools.Serialization/Models/N3DS/ARM9AccessControl.cs
index 13f372c1..a71febd8 100644
--- a/SabreTools.Serialization/Models/N3DS/ARM9AccessControl.cs
+++ b/SabreTools.Serialization/Models/N3DS/ARM9AccessControl.cs
@@ -11,7 +11,7 @@ namespace SabreTools.Data.Models.N3DS
///
/// 15 bytes
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)]
- public ARM9AccessControlDescriptors[]? Descriptors;
+ public ARM9AccessControlDescriptors[] Descriptors;
///
/// ARM9 Descriptor Version. Originally this value had to be ≥ 2.
diff --git a/SabreTools.Serialization/Models/N3DS/AccessControlInfo.cs b/SabreTools.Serialization/Models/N3DS/AccessControlInfo.cs
index 4330e0fe..4ed43424 100644
--- a/SabreTools.Serialization/Models/N3DS/AccessControlInfo.cs
+++ b/SabreTools.Serialization/Models/N3DS/AccessControlInfo.cs
@@ -9,17 +9,17 @@ namespace SabreTools.Data.Models.N3DS
///
/// ARM11 local system capabilities
///
- public ARM11LocalSystemCapabilities? ARM11LocalSystemCapabilities;
+ public ARM11LocalSystemCapabilities ARM11LocalSystemCapabilities;
///
/// ARM11 kernel capabilities
///
- public ARM11KernelCapabilities? ARM11KernelCapabilities;
+ public ARM11KernelCapabilities ARM11KernelCapabilities;
///
/// ARM9 access control
///
/// TODO: Fix serialization issue with this type
- public ARM9AccessControl? ARM9AccessControl;
+ public ARM9AccessControl ARM9AccessControl;
}
}
diff --git a/SabreTools.Serialization/Models/N3DS/CIA.cs b/SabreTools.Serialization/Models/N3DS/CIA.cs
index 8c86955a..198ace28 100644
--- a/SabreTools.Serialization/Models/N3DS/CIA.cs
+++ b/SabreTools.Serialization/Models/N3DS/CIA.cs
@@ -17,7 +17,7 @@ namespace SabreTools.Data.Models.N3DS
///
/// CIA header
///
- public CIAHeader? Header { get; set; }
+ public CIAHeader Header { get; set; }
///
/// Certificate chain
@@ -25,22 +25,22 @@ namespace SabreTools.Data.Models.N3DS
///
/// https://www.3dbrew.org/wiki/CIA#Certificate_Chain
///
- public Certificate[]? CertificateChain { get; set; }
+ public Certificate[] CertificateChain { get; set; }
///
/// Ticket
///
- public Ticket? Ticket { get; set; }
+ public Ticket Ticket { get; set; }
///
/// TMD file data
///
- public TitleMetadata? TMDFileData { get; set; }
+ public TitleMetadata TMDFileData { get; set; }
///
/// Content file data
///
- public NCCHHeader[]? Partitions { get; set; }
+ public NCCHHeader[] Partitions { get; set; }
///
/// Content file data
@@ -51,6 +51,6 @@ namespace SabreTools.Data.Models.N3DS
///
/// Meta file data (Not a necessary component)
///
- public MetaData? MetaData { get; set; }
+ public MetaData MetaData { get; set; }
}
}
diff --git a/SabreTools.Serialization/Models/N3DS/CardInfoHeader.cs b/SabreTools.Serialization/Models/N3DS/CardInfoHeader.cs
index 24ffcf2c..337a03c0 100644
--- a/SabreTools.Serialization/Models/N3DS/CardInfoHeader.cs
+++ b/SabreTools.Serialization/Models/N3DS/CardInfoHeader.cs
@@ -74,6 +74,6 @@ namespace SabreTools.Data.Models.N3DS
///
/// This data is returned by 16-byte cartridge command 0x82.
///
- public InitialData? InitialData;
+ public InitialData InitialData;
}
}
diff --git a/SabreTools.Serialization/Models/N3DS/Cart.cs b/SabreTools.Serialization/Models/N3DS/Cart.cs
index 14e1f244..cddbba28 100644
--- a/SabreTools.Serialization/Models/N3DS/Cart.cs
+++ b/SabreTools.Serialization/Models/N3DS/Cart.cs
@@ -8,36 +8,36 @@ namespace SabreTools.Data.Models.N3DS
///
/// 3DS cart header
///
- public NCSDHeader? Header { get; set; }
+ public NCSDHeader Header { get; set; }
///
/// 3DS card info header
///
- public CardInfoHeader? CardInfoHeader { get; set; }
+ public CardInfoHeader CardInfoHeader { get; set; }
///
/// 3DS development card info header
///
- public DevelopmentCardInfoHeader? DevelopmentCardInfoHeader { get; set; }
+ public DevelopmentCardInfoHeader DevelopmentCardInfoHeader { get; set; }
///
/// NCCH partitions
///
- public NCCHHeader[]? Partitions { get; set; }
+ public NCCHHeader[] Partitions { get; set; }
///
/// NCCH extended headers
///
- public NCCHExtendedHeader[]? ExtendedHeaders { get; set; }
+ public NCCHExtendedHeader[] ExtendedHeaders { get; set; }
///
/// ExeFS headers associated with each partition
///
- public ExeFSHeader[]? ExeFSHeaders { get; set; }
+ public ExeFSHeader[] ExeFSHeaders { get; set; }
///
/// RomFS headers associated with each partition
///
- public RomFSHeader[]? RomFSHeaders { get; set; }
+ public RomFSHeader[] RomFSHeaders { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/SabreTools.Serialization/Models/N3DS/Certificate.cs b/SabreTools.Serialization/Models/N3DS/Certificate.cs
index 17923e19..b5168a8f 100644
--- a/SabreTools.Serialization/Models/N3DS/Certificate.cs
+++ b/SabreTools.Serialization/Models/N3DS/Certificate.cs
@@ -37,7 +37,7 @@ namespace SabreTools.Data.Models.N3DS
///
/// Issuer
///
- public string? Issuer { get; set; }
+ public string Issuer { get; set; }
///
/// Key Type
@@ -47,7 +47,7 @@ namespace SabreTools.Data.Models.N3DS
///
/// Name
///
- public string? Name { get; set; }
+ public string Name { get; set; }
///
/// Expiration time as UNIX Timestamp, used at least for CTCert
diff --git a/SabreTools.Serialization/Models/N3DS/DevelopmentCardInfoHeader.cs b/SabreTools.Serialization/Models/N3DS/DevelopmentCardInfoHeader.cs
index 549133ea..0d8251e9 100644
--- a/SabreTools.Serialization/Models/N3DS/DevelopmentCardInfoHeader.cs
+++ b/SabreTools.Serialization/Models/N3DS/DevelopmentCardInfoHeader.cs
@@ -30,6 +30,6 @@ namespace SabreTools.Data.Models.N3DS
///
/// TestData
///
- public TestData? TestData;
+ public TestData TestData;
}
}
diff --git a/SabreTools.Serialization/Models/N3DS/Enums.cs b/SabreTools.Serialization/Models/N3DS/Enums.cs
index 7fb877d3..a5bac17d 100644
--- a/SabreTools.Serialization/Models/N3DS/Enums.cs
+++ b/SabreTools.Serialization/Models/N3DS/Enums.cs
@@ -21,7 +21,7 @@ namespace SabreTools.Data.Models.N3DS
public enum ARM11LSCFlag0 : byte
{
IdealProcessor = 0x01 | 0x02,
-
+
AffinityMask = 0x04 | 0x08,
///
diff --git a/SabreTools.Serialization/Models/N3DS/ExeFSFileHeader.cs b/SabreTools.Serialization/Models/N3DS/ExeFSFileHeader.cs
index 2874bd46..0a3e78e8 100644
--- a/SabreTools.Serialization/Models/N3DS/ExeFSFileHeader.cs
+++ b/SabreTools.Serialization/Models/N3DS/ExeFSFileHeader.cs
@@ -18,7 +18,7 @@ namespace SabreTools.Data.Models.N3DS
///
/// 8 bytes
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
- public string? FileName;
+ public string FileName;
///
/// File offset
diff --git a/SabreTools.Serialization/Models/N3DS/ExeFSHeader.cs b/SabreTools.Serialization/Models/N3DS/ExeFSHeader.cs
index 90152ef4..39c2922c 100644
--- a/SabreTools.Serialization/Models/N3DS/ExeFSHeader.cs
+++ b/SabreTools.Serialization/Models/N3DS/ExeFSHeader.cs
@@ -16,7 +16,7 @@
///
/// File headers (10 headers maximum, 16 bytes each)
///
- public ExeFSFileHeader[]? FileHeaders { get; set; }
+ public ExeFSFileHeader[] FileHeaders { get; set; }
///
/// Reserved
@@ -28,6 +28,6 @@
/// File hashes (10 hashes maximum, 32 bytes each, one for each header)
///
/// SHA-256 hashes
- public byte[][]? FileHashes { get; set; }
+ public byte[][] FileHashes { get; set; }
}
}
diff --git a/SabreTools.Serialization/Models/N3DS/InitialData.cs b/SabreTools.Serialization/Models/N3DS/InitialData.cs
index efd9cd0f..c08778b6 100644
--- a/SabreTools.Serialization/Models/N3DS/InitialData.cs
+++ b/SabreTools.Serialization/Models/N3DS/InitialData.cs
@@ -44,6 +44,6 @@ namespace SabreTools.Data.Models.N3DS
///
/// Copy of first NCCH header (excluding RSA signature)
///
- public NCCHHeader? BackupHeader;
+ public NCCHHeader BackupHeader;
}
}
diff --git a/SabreTools.Serialization/Models/N3DS/NCCHExtendedHeader.cs b/SabreTools.Serialization/Models/N3DS/NCCHExtendedHeader.cs
index 1282ae8c..bea3397b 100644
--- a/SabreTools.Serialization/Models/N3DS/NCCHExtendedHeader.cs
+++ b/SabreTools.Serialization/Models/N3DS/NCCHExtendedHeader.cs
@@ -14,12 +14,12 @@ namespace SabreTools.Data.Models.N3DS
///
/// SCI
///
- public SystemControlInfo? SCI;
+ public SystemControlInfo SCI;
///
/// ACI
///
- public AccessControlInfo? ACI;
+ public AccessControlInfo ACI;
///
/// AccessDesc signature (RSA-2048-SHA256)
@@ -38,6 +38,6 @@ namespace SabreTools.Data.Models.N3DS
///
/// ACI (for limitation of first ACI)
///
- public AccessControlInfo? ACIForLimitations;
+ public AccessControlInfo ACIForLimitations;
}
}
diff --git a/SabreTools.Serialization/Models/N3DS/NCCHHeader.cs b/SabreTools.Serialization/Models/N3DS/NCCHHeader.cs
index 88108ec5..9dd26e42 100644
--- a/SabreTools.Serialization/Models/N3DS/NCCHHeader.cs
+++ b/SabreTools.Serialization/Models/N3DS/NCCHHeader.cs
@@ -18,7 +18,7 @@ namespace SabreTools.Data.Models.N3DS
///
/// 4 bytes
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
- public string? MagicID;
+ public string MagicID;
///
/// Content size, in media units (1 media unit = 0x200 bytes)
@@ -74,7 +74,7 @@ namespace SabreTools.Data.Models.N3DS
///
/// 0x10 bytes
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x10)]
- public string? ProductCode;
+ public string ProductCode;
///
/// Extended header SHA-256 hash (SHA256 of 2x Alignment Size, beginning at 0x0 of ExHeader)
@@ -96,7 +96,7 @@ namespace SabreTools.Data.Models.N3DS
///
/// Flags
///
- public NCCHHeaderFlags? Flags;
+ public NCCHHeaderFlags Flags;
///
/// Plain region offset, in media units
diff --git a/SabreTools.Serialization/Models/N3DS/NCSDHeader.cs b/SabreTools.Serialization/Models/N3DS/NCSDHeader.cs
index 7428d201..cc2494e4 100644
--- a/SabreTools.Serialization/Models/N3DS/NCSDHeader.cs
+++ b/SabreTools.Serialization/Models/N3DS/NCSDHeader.cs
@@ -22,7 +22,7 @@
///
/// Magic Number 'NCSD'
///
- public string? MagicNumber { get; set; }
+ public string MagicNumber { get; set; }
///
/// Size of the NCSD image, in media units (1 media unit = 0x200 bytes)
@@ -49,7 +49,7 @@
///
/// Offset & Length partition table, in media units
///
- public PartitionTableEntry[]? PartitionsTable { get; set; }
+ public PartitionTableEntry[] PartitionsTable { get; set; }
#endregion
diff --git a/SabreTools.Serialization/Models/N3DS/RomFSHeader.cs b/SabreTools.Serialization/Models/N3DS/RomFSHeader.cs
index 2019d1e0..816dd602 100644
--- a/SabreTools.Serialization/Models/N3DS/RomFSHeader.cs
+++ b/SabreTools.Serialization/Models/N3DS/RomFSHeader.cs
@@ -16,7 +16,7 @@ namespace SabreTools.Data.Models.N3DS
/// Magic "IVFC"
///
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
- public string? MagicString;
+ public string MagicString;
///
/// Magic number 0x10000
diff --git a/SabreTools.Serialization/Models/N3DS/SystemControlInfo.cs b/SabreTools.Serialization/Models/N3DS/SystemControlInfo.cs
index 01b69fb5..81ed1ecf 100644
--- a/SabreTools.Serialization/Models/N3DS/SystemControlInfo.cs
+++ b/SabreTools.Serialization/Models/N3DS/SystemControlInfo.cs
@@ -11,7 +11,7 @@ namespace SabreTools.Data.Models.N3DS
///
/// 8 bytes
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
- public string? ApplicationTitle;
+ public string ApplicationTitle;
///
/// Reserved
@@ -33,7 +33,7 @@ namespace SabreTools.Data.Models.N3DS
///
/// Text code set info
///
- public CodeSetInfo? TextCodeSetInfo;
+ public CodeSetInfo TextCodeSetInfo;
///
/// Stack size
@@ -43,7 +43,7 @@ namespace SabreTools.Data.Models.N3DS
///
/// Read-only code set info
///
- public CodeSetInfo? ReadOnlyCodeSetInfo;
+ public CodeSetInfo ReadOnlyCodeSetInfo;
///
/// Reserved
@@ -53,7 +53,7 @@ namespace SabreTools.Data.Models.N3DS
///
/// Data code set info
///
- public CodeSetInfo? DataCodeSetInfo;
+ public CodeSetInfo DataCodeSetInfo;
///
/// BSS size
@@ -70,6 +70,6 @@ namespace SabreTools.Data.Models.N3DS
///
/// SystemInfo
///
- public SystemInfo? SystemInfo;
+ public SystemInfo SystemInfo;
}
}
diff --git a/SabreTools.Serialization/Models/N3DS/Ticket.cs b/SabreTools.Serialization/Models/N3DS/Ticket.cs
index bfb90aea..7c0b627c 100644
--- a/SabreTools.Serialization/Models/N3DS/Ticket.cs
+++ b/SabreTools.Serialization/Models/N3DS/Ticket.cs
@@ -160,7 +160,7 @@ namespace SabreTools.Data.Models.N3DS
///
/// In demos, the first u32 in the "Limits" section is 0x4, then the second u32 is the max-playcount.
///
- public uint[]? Limits { get; set; }
+ public uint[] Limits { get; set; }
///
/// The Content Index of a ticket has its own size defined within itself,
@@ -180,6 +180,6 @@ namespace SabreTools.Data.Models.N3DS
///
/// https://www.3dbrew.org/wiki/Ticket#Certificate_Chain
///
- public Certificate[]? CertificateChain { get; set; }
+ public Certificate[] CertificateChain { get; set; }
}
}
diff --git a/SabreTools.Serialization/Models/N3DS/TitleMetadata.cs b/SabreTools.Serialization/Models/N3DS/TitleMetadata.cs
index 67612403..e5a5075f 100644
--- a/SabreTools.Serialization/Models/N3DS/TitleMetadata.cs
+++ b/SabreTools.Serialization/Models/N3DS/TitleMetadata.cs
@@ -36,7 +36,7 @@ namespace SabreTools.Data.Models.N3DS
///
/// Signature Issuer
///
- public string? Issuer { get; set; }
+ public string Issuer { get; set; }
///
/// Version
@@ -140,13 +140,13 @@ namespace SabreTools.Data.Models.N3DS
///
/// There are 64 of these records, usually only the first is used.
///
- public ContentInfoRecord[]? ContentInfoRecords { get; set; }
+ public ContentInfoRecord[] ContentInfoRecords { get; set; }
///
/// There is one of these for each content contained in this title.
/// (Determined by "Content Count" in the TMD Header).
///
- public ContentChunkRecord[]? ContentChunkRecords { get; set; }
+ public ContentChunkRecord[] ContentChunkRecords { get; set; }
///
/// Certificate chain
@@ -154,6 +154,6 @@ namespace SabreTools.Data.Models.N3DS
///
/// https://www.3dbrew.org/wiki/Title_metadata#Certificate_Chain
///
- public Certificate[]? CertificateChain { get; set; }
+ public Certificate[] CertificateChain { get; set; }
}
}
diff --git a/SabreTools.Serialization/Readers/N3DS.cs b/SabreTools.Serialization/Readers/N3DS.cs
index 6010441b..82ca6581 100644
--- a/SabreTools.Serialization/Readers/N3DS.cs
+++ b/SabreTools.Serialization/Readers/N3DS.cs
@@ -67,7 +67,7 @@ namespace SabreTools.Serialization.Readers
for (int i = 0; i < 8; i++)
{
// Find the offset to the partition
- long partitionOffset = initialOffset + cart.Header.PartitionsTable?[i]?.Offset ?? 0;
+ long partitionOffset = initialOffset + cart.Header.PartitionsTable[i].Offset;
partitionOffset *= mediaUnitSize;
if (partitionOffset <= initialOffset)
continue;
diff --git a/SabreTools.Serialization/Wrappers/CIA.Printing.cs b/SabreTools.Serialization/Wrappers/CIA.Printing.cs
index df91a5b7..0e6ba402 100644
--- a/SabreTools.Serialization/Wrappers/CIA.Printing.cs
+++ b/SabreTools.Serialization/Wrappers/CIA.Printing.cs
@@ -26,17 +26,10 @@ namespace SabreTools.Serialization.Wrappers
Print(builder, Model.MetaData);
}
- private static void Print(StringBuilder builder, CIAHeader? header)
+ private static void Print(StringBuilder builder, CIAHeader header)
{
builder.AppendLine(" CIA Header Information:");
builder.AppendLine(" -------------------------");
- if (header == null)
- {
- builder.AppendLine(" No CIA header");
- builder.AppendLine();
- return;
- }
-
builder.AppendLine(header.HeaderSize, " Header size");
builder.AppendLine(header.Type, " Type");
builder.AppendLine(header.Version, " Version");
@@ -49,11 +42,11 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine();
}
- private static void Print(StringBuilder builder, Certificate[]? certificateChain)
+ private static void Print(StringBuilder builder, Certificate[] certificateChain)
{
builder.AppendLine(" Certificate Chain Information:");
builder.AppendLine(" -------------------------");
- if (certificateChain == null || certificateChain.Length == 0)
+ if (certificateChain.Length == 0)
{
builder.AppendLine(" No certificates, expected 3");
builder.AppendLine();
@@ -100,17 +93,10 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine();
}
- private static void Print(StringBuilder builder, Ticket? ticket)
+ private static void Print(StringBuilder builder, Ticket ticket)
{
builder.AppendLine(" Ticket Information:");
builder.AppendLine(" -------------------------");
- if (ticket == null)
- {
- builder.AppendLine(" No ticket");
- builder.AppendLine();
- return;
- }
-
builder.AppendLine($" Signature type: {ticket.SignatureType} (0x{ticket.SignatureType:X})");
builder.AppendLine(ticket.SignatureSize, " Signature size");
builder.AppendLine(ticket.PaddingSize, " Padding size");
@@ -137,7 +123,7 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine(ticket.Audit, " Audit");
builder.AppendLine(ticket.Reserved6, " Reserved 6");
builder.AppendLine(" Limits:");
- if (ticket.Limits == null || ticket.Limits.Length == 0)
+ if (ticket.Limits.Length == 0)
{
builder.AppendLine(" No limits");
}
@@ -154,7 +140,7 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine(" Ticket Certificate Chain Information:");
builder.AppendLine(" -------------------------");
- if (ticket.CertificateChain == null || ticket.CertificateChain.Length == 0)
+ if (ticket.CertificateChain.Length == 0)
{
builder.AppendLine(" No certificates, expected 2");
}
@@ -200,17 +186,10 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine();
}
- private static void Print(StringBuilder builder, TitleMetadata? tmd)
+ private static void Print(StringBuilder builder, TitleMetadata tmd)
{
builder.AppendLine(" Title Metadata Information:");
builder.AppendLine(" -------------------------");
- if (tmd == null)
- {
- builder.AppendLine(" No title metadata");
- builder.AppendLine();
- return;
- }
-
builder.AppendLine($" Signature type: {tmd.SignatureType} (0x{tmd.SignatureType:X})");
builder.AppendLine(tmd.SignatureSize, " Signature size");
builder.AppendLine(tmd.PaddingSize, " Padding size");
@@ -240,7 +219,7 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine(" Ticket Content Info Records Information:");
builder.AppendLine(" -------------------------");
- if (tmd.ContentInfoRecords == null || tmd.ContentInfoRecords.Length == 0)
+ if (tmd.ContentInfoRecords.Length == 0)
{
builder.AppendLine(" No content info records, expected 64");
}
@@ -261,7 +240,7 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine(" Ticket Content Chunk Records Information:");
builder.AppendLine(" -------------------------");
- if (tmd.ContentChunkRecords == null || tmd.ContentChunkRecords.Length == 0)
+ if (tmd.ContentChunkRecords.Length == 0)
{
builder.AppendLine($" No content chunk records, expected {tmd.ContentCount}");
}
@@ -284,7 +263,7 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine(" Ticket Certificate Chain Information:");
builder.AppendLine(" -------------------------");
- if (tmd.CertificateChain == null || tmd.CertificateChain.Length == 0)
+ if (tmd.CertificateChain.Length == 0)
{
builder.AppendLine(" No certificates, expected 2");
}
@@ -330,11 +309,11 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine();
}
- private static void Print(StringBuilder builder, NCCHHeader[]? partitions)
+ private static void Print(StringBuilder builder, NCCHHeader[] partitions)
{
builder.AppendLine(" NCCH Partition Header Information:");
builder.AppendLine(" -------------------------");
- if (partitions == null || partitions.Length == 0)
+ if (partitions.Length == 0)
{
builder.AppendLine(" No NCCH partition headers");
builder.AppendLine();
@@ -371,22 +350,17 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine(partitionHeader.ExtendedHeaderHash, " Extended header SHA-256 hash");
builder.AppendLine(partitionHeader.ExtendedHeaderSizeInBytes, " Extended header size in bytes");
builder.AppendLine(partitionHeader.Reserved2, " Reserved 2");
+
builder.AppendLine(" Flags:");
- if (partitionHeader.Flags == null)
- {
- builder.AppendLine(" [NULL]");
- }
- else
- {
- builder.AppendLine(partitionHeader.Flags.Reserved0, " Reserved 0");
- builder.AppendLine(partitionHeader.Flags.Reserved1, " Reserved 1");
- builder.AppendLine(partitionHeader.Flags.Reserved2, " Reserved 2");
- builder.AppendLine($" Crypto method: {partitionHeader.Flags.CryptoMethod} (0x{partitionHeader.Flags.CryptoMethod:X})");
- builder.AppendLine($" Content platform: {partitionHeader.Flags.ContentPlatform} (0x{partitionHeader.Flags.ContentPlatform:X})");
- builder.AppendLine($" Content type: {partitionHeader.Flags.MediaPlatformIndex} (0x{partitionHeader.Flags.MediaPlatformIndex:X})");
- builder.AppendLine(partitionHeader.Flags.ContentUnitSize, " Content unit size");
- builder.AppendLine($" Bitmasks: {partitionHeader.Flags.BitMasks} (0x{partitionHeader.Flags.BitMasks:X})");
- }
+ builder.AppendLine(partitionHeader.Flags.Reserved0, " Reserved 0");
+ builder.AppendLine(partitionHeader.Flags.Reserved1, " Reserved 1");
+ builder.AppendLine(partitionHeader.Flags.Reserved2, " Reserved 2");
+ builder.AppendLine($" Crypto method: {partitionHeader.Flags.CryptoMethod} (0x{partitionHeader.Flags.CryptoMethod:X})");
+ builder.AppendLine($" Content platform: {partitionHeader.Flags.ContentPlatform} (0x{partitionHeader.Flags.ContentPlatform:X})");
+ builder.AppendLine($" Content type: {partitionHeader.Flags.MediaPlatformIndex} (0x{partitionHeader.Flags.MediaPlatformIndex:X})");
+ builder.AppendLine(partitionHeader.Flags.ContentUnitSize, " Content unit size");
+ builder.AppendLine($" Bitmasks: {partitionHeader.Flags.BitMasks} (0x{partitionHeader.Flags.BitMasks:X})");
+
builder.AppendLine(partitionHeader.PlainRegionOffsetInMediaUnits, " Plain region offset, in media units");
builder.AppendLine(partitionHeader.PlainRegionSizeInMediaUnits, " Plain region size, in media units");
builder.AppendLine(partitionHeader.LogoRegionOffsetInMediaUnits, " Logo region offset, in media units");
@@ -406,17 +380,10 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine();
}
- private static void Print(StringBuilder builder, MetaData? metaData)
+ private static void Print(StringBuilder builder, MetaData metaData)
{
builder.AppendLine(" Meta Data Information:");
builder.AppendLine(" -------------------------");
- if (metaData == null)
- {
- builder.AppendLine(" No meta file data");
- builder.AppendLine();
- return;
- }
-
builder.AppendLine(metaData.TitleIDDependencyList, " Title ID dependency list");
builder.AppendLine(metaData.Reserved1, " Reserved 1");
builder.AppendLine(metaData.CoreVersion, " Core version");
diff --git a/SabreTools.Serialization/Wrappers/N3DS.Printing.cs b/SabreTools.Serialization/Wrappers/N3DS.Printing.cs
index a5410554..6c572566 100644
--- a/SabreTools.Serialization/Wrappers/N3DS.Printing.cs
+++ b/SabreTools.Serialization/Wrappers/N3DS.Printing.cs
@@ -28,17 +28,10 @@ namespace SabreTools.Serialization.Wrappers
Print(builder, Model.RomFSHeaders);
}
- private static void Print(StringBuilder builder, NCSDHeader? header)
+ private static void Print(StringBuilder builder, NCSDHeader header)
{
builder.AppendLine(" NCSD Header Information:");
builder.AppendLine(" -------------------------");
- if (header == null)
- {
- builder.AppendLine(" No NCSD header");
- builder.AppendLine();
- return;
- }
-
builder.AppendLine(header.RSA2048Signature, " RSA-2048 SHA-256 signature");
builder.AppendLine(header.MagicNumber, " Magic number");
builder.AppendLine(header.ImageSizeInMediaUnits, " Image size in media units");
@@ -49,7 +42,7 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine(" Partition table:");
builder.AppendLine(" -------------------------");
- if (header.PartitionsTable == null || header.PartitionsTable.Length == 0)
+ if (header.PartitionsTable.Length == 0)
{
builder.AppendLine(" No partition table entries");
}
@@ -108,17 +101,10 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine();
}
- private static void Print(StringBuilder builder, CardInfoHeader? header)
+ private static void Print(StringBuilder builder, CardInfoHeader header)
{
builder.AppendLine(" Card Info Header Information:");
builder.AppendLine(" -------------------------");
- if (header == null)
- {
- builder.AppendLine(" No card info header");
- builder.AppendLine();
- return;
- }
-
builder.AppendLine(header.WritableAddressMediaUnits, " Writable address in media units");
builder.AppendLine(header.CardInfoBitmask, " Card info bitmask");
builder.AppendLine(header.Reserved1, " Reserved 1");
@@ -135,17 +121,10 @@ namespace SabreTools.Serialization.Wrappers
Print(builder, header.InitialData);
}
- private static void Print(StringBuilder builder, DevelopmentCardInfoHeader? header)
+ private static void Print(StringBuilder builder, DevelopmentCardInfoHeader header)
{
builder.AppendLine(" Development Card Info Header Information:");
builder.AppendLine(" -------------------------");
- if (header == null)
- {
- builder.AppendLine(" No development card info header");
- builder.AppendLine();
- return;
- }
-
builder.AppendLine(header.CardDeviceReserved1, " Card device reserved 1");
builder.AppendLine(header.TitleKey, " Title key");
builder.AppendLine(header.CardDeviceReserved2, " Card device reserved 2");
@@ -153,38 +132,24 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine(" Test Data:");
builder.AppendLine(" -------------------------");
- if (header.TestData == null)
- {
- builder.AppendLine(" No test data");
- }
- else
- {
- builder.AppendLine(header.TestData.Signature, " Signature");
- builder.AppendLine(header.TestData.AscendingByteSequence, " Ascending byte sequence");
- builder.AppendLine(header.TestData.DescendingByteSequence, " Descending byte sequence");
- builder.AppendLine(header.TestData.Filled00, " Filled with 00");
- builder.AppendLine(header.TestData.FilledFF, " Filled with FF");
- builder.AppendLine(header.TestData.Filled0F, " Filled with 0F");
- builder.AppendLine(header.TestData.FilledF0, " Filled with F0");
- builder.AppendLine(header.TestData.Filled55, " Filled with 55");
- builder.AppendLine(header.TestData.FilledAA, " Filled with AA");
- builder.AppendLine(header.TestData.FinalByte, " Final byte");
- }
+ builder.AppendLine(header.TestData.Signature, " Signature");
+ builder.AppendLine(header.TestData.AscendingByteSequence, " Ascending byte sequence");
+ builder.AppendLine(header.TestData.DescendingByteSequence, " Descending byte sequence");
+ builder.AppendLine(header.TestData.Filled00, " Filled with 00");
+ builder.AppendLine(header.TestData.FilledFF, " Filled with FF");
+ builder.AppendLine(header.TestData.Filled0F, " Filled with 0F");
+ builder.AppendLine(header.TestData.FilledF0, " Filled with F0");
+ builder.AppendLine(header.TestData.Filled55, " Filled with 55");
+ builder.AppendLine(header.TestData.FilledAA, " Filled with AA");
+ builder.AppendLine(header.TestData.FinalByte, " Final byte");
builder.AppendLine();
}
- private static void Print(StringBuilder builder, InitialData? id)
+ private static void Print(StringBuilder builder, InitialData id)
{
builder.AppendLine(" Initial Data Information:");
builder.AppendLine(" -------------------------");
- if (id == null)
- {
- builder.AppendLine(" No initial data");
- builder.AppendLine();
- return;
- }
-
builder.AppendLine(id.CardSeedKeyY, " Card seed KeyY");
builder.AppendLine(id.EncryptedCardSeed, " Encrypted card seed");
builder.AppendLine(id.CardSeedAESMAC, " Card seed AES-MAC");
@@ -195,17 +160,10 @@ namespace SabreTools.Serialization.Wrappers
PrintBackup(builder, id.BackupHeader);
}
- private static void PrintBackup(StringBuilder builder, NCCHHeader? header)
+ private static void PrintBackup(StringBuilder builder, NCCHHeader header)
{
builder.AppendLine(" Backup NCCH Header Information:");
builder.AppendLine(" -------------------------");
- if (header == null)
- {
- builder.AppendLine(" No backup NCCH header");
- builder.AppendLine();
- return;
- }
-
if (header.MagicID == string.Empty)
{
builder.AppendLine(" Empty backup header, no data can be parsed");
@@ -233,22 +191,17 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine(header.ExtendedHeaderHash, " Extended header SHA-256 hash");
builder.AppendLine(header.ExtendedHeaderSizeInBytes, " Extended header size in bytes");
builder.AppendLine(header.Reserved2, " Reserved 2");
+
builder.AppendLine(" Flags:");
- if (header.Flags == null)
- {
- builder.AppendLine(" [NULL]");
- }
- else
- {
- builder.AppendLine(header.Flags.Reserved0, " Reserved 0");
- builder.AppendLine(header.Flags.Reserved1, " Reserved 1");
- builder.AppendLine(header.Flags.Reserved2, " Reserved 2");
- builder.AppendLine($" Crypto method: {header.Flags.CryptoMethod} (0x{header.Flags.CryptoMethod:X})");
- builder.AppendLine($" Content platform: {header.Flags.ContentPlatform} (0x{header.Flags.ContentPlatform:X})");
- builder.AppendLine($" Content type: {header.Flags.MediaPlatformIndex} (0x{header.Flags.MediaPlatformIndex:X})");
- builder.AppendLine(header.Flags.ContentUnitSize, " Content unit size");
- builder.AppendLine($" Bitmasks: {header.Flags.BitMasks} (0x{header.Flags.BitMasks:X})");
- }
+ builder.AppendLine(header.Flags.Reserved0, " Reserved 0");
+ builder.AppendLine(header.Flags.Reserved1, " Reserved 1");
+ builder.AppendLine(header.Flags.Reserved2, " Reserved 2");
+ builder.AppendLine($" Crypto method: {header.Flags.CryptoMethod} (0x{header.Flags.CryptoMethod:X})");
+ builder.AppendLine($" Content platform: {header.Flags.ContentPlatform} (0x{header.Flags.ContentPlatform:X})");
+ builder.AppendLine($" Content type: {header.Flags.MediaPlatformIndex} (0x{header.Flags.MediaPlatformIndex:X})");
+ builder.AppendLine(header.Flags.ContentUnitSize, " Content unit size");
+ builder.AppendLine($" Bitmasks: {header.Flags.BitMasks} (0x{header.Flags.BitMasks:X})");
+
builder.AppendLine(header.PlainRegionOffsetInMediaUnits, " Plain region offset, in media units");
builder.AppendLine(header.PlainRegionSizeInMediaUnits, " Plain region size, in media units");
builder.AppendLine(header.LogoRegionOffsetInMediaUnits, " Logo region offset, in media units");
@@ -266,11 +219,11 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine();
}
- private static void Print(StringBuilder builder, NCCHHeader[]? entries)
+ private static void Print(StringBuilder builder, NCCHHeader[] entries)
{
builder.AppendLine(" NCCH Partition Header Information:");
builder.AppendLine(" -------------------------");
- if (entries == null || entries.Length == 0)
+ if (entries.Length == 0)
{
builder.AppendLine(" No NCCH partition headers");
builder.AppendLine();
@@ -344,11 +297,11 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine();
}
- private static void Print(StringBuilder builder, NCCHExtendedHeader[]? entries)
+ private static void Print(StringBuilder builder, NCCHExtendedHeader[] entries)
{
builder.AppendLine(" NCCH Extended Header Information:");
builder.AppendLine(" -------------------------");
- if (entries == null || entries.Length == 0)
+ if (entries.Length == 0)
{
builder.AppendLine(" No NCCH extended headers");
builder.AppendLine();
@@ -360,226 +313,115 @@ namespace SabreTools.Serialization.Wrappers
var entry = entries[i];
builder.AppendLine($" NCCH Extended Header {i}");
+
builder.AppendLine(" System control info:");
- if (entry.SCI == null)
- {
- builder.AppendLine(" [NULL]");
- }
- else
- {
- builder.AppendLine(entry.SCI.ApplicationTitle, " Application title");
- builder.AppendLine(entry.SCI.Reserved1, " Reserved 1");
- builder.AppendLine(entry.SCI.Flag, " Flag");
- builder.AppendLine(entry.SCI.RemasterVersion, " Remaster version");
+ builder.AppendLine(entry.SCI.ApplicationTitle, " Application title");
+ builder.AppendLine(entry.SCI.Reserved1, " Reserved 1");
+ builder.AppendLine(entry.SCI.Flag, " Flag");
+ builder.AppendLine(entry.SCI.RemasterVersion, " Remaster version");
- builder.AppendLine(" Text code set info:");
- if (entry.SCI.TextCodeSetInfo == null)
- {
- builder.AppendLine(" [NULL]");
- }
- else
- {
- builder.AppendLine(entry.SCI.TextCodeSetInfo.Address, " Address");
- builder.AppendLine(entry.SCI.TextCodeSetInfo.PhysicalRegionSizeInPages, " Physical region size (in page-multiples)");
- builder.AppendLine(entry.SCI.TextCodeSetInfo.SizeInBytes, " Size (in bytes)");
- }
+ builder.AppendLine(" Text code set info:");
+ builder.AppendLine(entry.SCI.TextCodeSetInfo.Address, " Address");
+ builder.AppendLine(entry.SCI.TextCodeSetInfo.PhysicalRegionSizeInPages, " Physical region size (in page-multiples)");
+ builder.AppendLine(entry.SCI.TextCodeSetInfo.SizeInBytes, " Size (in bytes)");
- builder.AppendLine(entry.SCI.StackSize, " Stack size");
+ builder.AppendLine(entry.SCI.StackSize, " Stack size");
- builder.AppendLine(" Read-only code set info:");
- if (entry.SCI.ReadOnlyCodeSetInfo == null)
- {
- builder.AppendLine(" [NULL]");
- }
- else
- {
- builder.AppendLine(entry.SCI.ReadOnlyCodeSetInfo.Address, " Address");
- builder.AppendLine(entry.SCI.ReadOnlyCodeSetInfo.PhysicalRegionSizeInPages, " Physical region size (in page-multiples)");
- builder.AppendLine(entry.SCI.ReadOnlyCodeSetInfo.SizeInBytes, " Size (in bytes)");
- }
+ builder.AppendLine(" Read-only code set info:");
+ builder.AppendLine(entry.SCI.ReadOnlyCodeSetInfo.Address, " Address");
+ builder.AppendLine(entry.SCI.ReadOnlyCodeSetInfo.PhysicalRegionSizeInPages, " Physical region size (in page-multiples)");
+ builder.AppendLine(entry.SCI.ReadOnlyCodeSetInfo.SizeInBytes, " Size (in bytes)");
- builder.AppendLine(entry.SCI.Reserved2, " Reserved 2");
+ builder.AppendLine(entry.SCI.Reserved2, " Reserved 2");
- builder.AppendLine(" Data code set info:");
- if (entry.SCI.DataCodeSetInfo == null)
- {
- builder.AppendLine(" [NULL]");
- }
- else
- {
- builder.AppendLine(entry.SCI.DataCodeSetInfo.Address, " Address");
- builder.AppendLine(entry.SCI.DataCodeSetInfo.PhysicalRegionSizeInPages, " Physical region size (in page-multiples)");
- builder.AppendLine(entry.SCI.DataCodeSetInfo.SizeInBytes, " Size (in bytes)");
- }
+ builder.AppendLine(" Data code set info:");
+ builder.AppendLine(entry.SCI.DataCodeSetInfo.Address, " Address");
+ builder.AppendLine(entry.SCI.DataCodeSetInfo.PhysicalRegionSizeInPages, " Physical region size (in page-multiples)");
+ builder.AppendLine(entry.SCI.DataCodeSetInfo.SizeInBytes, " Size (in bytes)");
- builder.AppendLine(entry.SCI.BSSSize, " BSS size");
- builder.AppendLine(entry.SCI.DependencyModuleList, " Dependency module list");
+ builder.AppendLine(entry.SCI.BSSSize, " BSS size");
+ builder.AppendLine(entry.SCI.DependencyModuleList, " Dependency module list");
- builder.AppendLine(" System info:");
- if (entry.SCI.SystemInfo == null)
- {
- builder.AppendLine(" [NULL]");
- }
- else
- {
- builder.AppendLine(entry.SCI.SystemInfo.SaveDataSize, " SaveData size");
- builder.AppendLine(entry.SCI.SystemInfo.JumpID, " Jump ID");
- builder.AppendLine(entry.SCI.SystemInfo.Reserved, " Reserved");
- }
- }
+ builder.AppendLine(" System info:");
+ builder.AppendLine(entry.SCI.SystemInfo.SaveDataSize, " SaveData size");
+ builder.AppendLine(entry.SCI.SystemInfo.JumpID, " Jump ID");
+ builder.AppendLine(entry.SCI.SystemInfo.Reserved, " Reserved");
builder.AppendLine(" Access control info:");
- if (entry.ACI == null)
- {
- builder.AppendLine(" [NULL]");
- }
- else
- {
- builder.AppendLine(" ARM11 local system capabilities:");
- if (entry.ACI.ARM11LocalSystemCapabilities == null)
- {
- builder.AppendLine(" [NULL]");
- }
- else
- {
- builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.ProgramID, " Program ID");
- builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.CoreVersion, " Core version");
- builder.AppendLine($" Flag 1: {entry.ACI.ARM11LocalSystemCapabilities.Flag1} (0x{entry.ACI.ARM11LocalSystemCapabilities.Flag1:X})");
- builder.AppendLine($" Flag 2: {entry.ACI.ARM11LocalSystemCapabilities.Flag2} (0x{entry.ACI.ARM11LocalSystemCapabilities.Flag2:X})");
- builder.AppendLine($" Flag 0: {entry.ACI.ARM11LocalSystemCapabilities.Flag0} (0x{entry.ACI.ARM11LocalSystemCapabilities.Flag0:X})");
- builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.Priority, " Priority");
- builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.ResourceLimitDescriptors, " Resource limit descriptors");
- builder.AppendLine(" Storage info:");
- if (entry.ACI.ARM11LocalSystemCapabilities.StorageInfo == null)
- {
- builder.AppendLine(" [NULL]");
- }
- else
- {
- builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.StorageInfo.ExtdataID, " Extdata ID");
- builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.StorageInfo.SystemSavedataIDs, " System savedata IDs");
- builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.StorageInfo.StorageAccessibleUniqueIDs, " Storage accessible unique IDs");
- builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.StorageInfo.FileSystemAccessInfo, " File system access info");
- builder.AppendLine($" Other attributes: {entry.ACI.ARM11LocalSystemCapabilities.StorageInfo.OtherAttributes} (0x{entry.ACI.ARM11LocalSystemCapabilities.StorageInfo.OtherAttributes:X})");
- }
+ builder.AppendLine(" ARM11 local system capabilities:");
+ builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.ProgramID, " Program ID");
+ builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.CoreVersion, " Core version");
+ builder.AppendLine($" Flag 1: {entry.ACI.ARM11LocalSystemCapabilities.Flag1} (0x{entry.ACI.ARM11LocalSystemCapabilities.Flag1:X})");
+ builder.AppendLine($" Flag 2: {entry.ACI.ARM11LocalSystemCapabilities.Flag2} (0x{entry.ACI.ARM11LocalSystemCapabilities.Flag2:X})");
+ builder.AppendLine($" Flag 0: {entry.ACI.ARM11LocalSystemCapabilities.Flag0} (0x{entry.ACI.ARM11LocalSystemCapabilities.Flag0:X})");
+ builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.Priority, " Priority");
+ builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.ResourceLimitDescriptors, " Resource limit descriptors");
- builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.ServiceAccessControl, " Service access control");
- builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.ExtendedServiceAccessControl, " Extended service access control");
- builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.Reserved, " Reserved");
- builder.AppendLine($" Resource limit cateogry: {entry.ACI.ARM11LocalSystemCapabilities.ResourceLimitCategory} (0x{entry.ACI.ARM11LocalSystemCapabilities.ResourceLimitCategory:X})");
- }
+ builder.AppendLine(" Storage info:");
+ builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.StorageInfo.ExtdataID, " Extdata ID");
+ builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.StorageInfo.SystemSavedataIDs, " System savedata IDs");
+ builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.StorageInfo.StorageAccessibleUniqueIDs, " Storage accessible unique IDs");
+ builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.StorageInfo.FileSystemAccessInfo, " File system access info");
+ builder.AppendLine($" Other attributes: {entry.ACI.ARM11LocalSystemCapabilities.StorageInfo.OtherAttributes} (0x{entry.ACI.ARM11LocalSystemCapabilities.StorageInfo.OtherAttributes:X})");
- builder.AppendLine(" ARM11 kernel capabilities:");
- if (entry.ACI.ARM11KernelCapabilities == null)
- {
- builder.AppendLine(" [NULL]");
- }
- else
- {
- builder.AppendLine(entry.ACI.ARM11KernelCapabilities.Descriptors, " Descriptors");
- builder.AppendLine(entry.ACI.ARM11KernelCapabilities.Reserved, " Reserved");
- }
+ builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.ServiceAccessControl, " Service access control");
+ builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.ExtendedServiceAccessControl, " Extended service access control");
+ builder.AppendLine(entry.ACI.ARM11LocalSystemCapabilities.Reserved, " Reserved");
+ builder.AppendLine($" Resource limit cateogry: {entry.ACI.ARM11LocalSystemCapabilities.ResourceLimitCategory} (0x{entry.ACI.ARM11LocalSystemCapabilities.ResourceLimitCategory:X})");
- builder.AppendLine(" ARM9 access control:");
- if (entry.ACI.ARM9AccessControl == null)
- {
- builder.AppendLine(" [NULL]");
- }
- else
- {
- string descriptorsStr = "[NULL]";
- if (entry.ACI.ARM9AccessControl.Descriptors != null)
- {
- var descriptors = Array.ConvertAll(entry.ACI.ARM9AccessControl.Descriptors, d => d.ToString());
- descriptorsStr = string.Join(", ", descriptors);
- }
- builder.AppendLine(descriptorsStr, " Descriptors");
- builder.AppendLine(entry.ACI.ARM9AccessControl.DescriptorVersion, " Descriptor version");
- }
- }
+ builder.AppendLine(" ARM11 kernel capabilities:");
+ builder.AppendLine(entry.ACI.ARM11KernelCapabilities.Descriptors, " Descriptors");
+ builder.AppendLine(entry.ACI.ARM11KernelCapabilities.Reserved, " Reserved");
+
+ builder.AppendLine(" ARM9 access control:");
+ var descriptors = Array.ConvertAll(entry.ACI.ARM9AccessControl.Descriptors, d => d.ToString());
+ string descriptorsStr = string.Join(", ", descriptors);
+ builder.AppendLine(descriptorsStr, " Descriptors");
+ builder.AppendLine(entry.ACI.ARM9AccessControl.DescriptorVersion, " Descriptor version");
builder.AppendLine(entry.AccessDescSignature, " AccessDec signature (RSA-2048-SHA256)");
builder.AppendLine(entry.NCCHHDRPublicKey, " NCCH HDR RSA-2048 public key");
builder.AppendLine(" Access control info (for limitations of first ACI):");
- if (entry.ACIForLimitations == null)
- {
- builder.AppendLine(" [NULL]");
- }
- else
- {
- builder.AppendLine(" ARM11 local system capabilities:");
- if (entry.ACIForLimitations.ARM11LocalSystemCapabilities == null)
- {
- builder.AppendLine(" [NULL]");
- }
- else
- {
- builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.ProgramID, " Program ID");
- builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.CoreVersion, " Core version");
- builder.AppendLine($" Flag 1: {entry.ACIForLimitations.ARM11LocalSystemCapabilities.Flag1} (0x{entry.ACIForLimitations.ARM11LocalSystemCapabilities.Flag1:X})");
- builder.AppendLine($" Flag 2: {entry.ACIForLimitations.ARM11LocalSystemCapabilities.Flag2} (0x{entry.ACIForLimitations.ARM11LocalSystemCapabilities.Flag2:X})");
- builder.AppendLine($" Flag 0: {entry.ACIForLimitations.ARM11LocalSystemCapabilities.Flag0} (0x{entry.ACIForLimitations.ARM11LocalSystemCapabilities.Flag0:X})");
- builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.Priority, " Priority");
- builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.ResourceLimitDescriptors, " Resource limit descriptors");
+ builder.AppendLine(" ARM11 local system capabilities:");
+ builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.ProgramID, " Program ID");
+ builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.CoreVersion, " Core version");
+ builder.AppendLine($" Flag 1: {entry.ACIForLimitations.ARM11LocalSystemCapabilities.Flag1} (0x{entry.ACIForLimitations.ARM11LocalSystemCapabilities.Flag1:X})");
+ builder.AppendLine($" Flag 2: {entry.ACIForLimitations.ARM11LocalSystemCapabilities.Flag2} (0x{entry.ACIForLimitations.ARM11LocalSystemCapabilities.Flag2:X})");
+ builder.AppendLine($" Flag 0: {entry.ACIForLimitations.ARM11LocalSystemCapabilities.Flag0} (0x{entry.ACIForLimitations.ARM11LocalSystemCapabilities.Flag0:X})");
+ builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.Priority, " Priority");
+ builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.ResourceLimitDescriptors, " Resource limit descriptors");
- builder.AppendLine(" Storage info:");
- if (entry.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo == null)
- {
- builder.AppendLine(" [NULL]");
- }
- else
- {
- builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.ExtdataID, " Extdata ID");
- builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.SystemSavedataIDs, " System savedata IDs");
- builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.StorageAccessibleUniqueIDs, " Storage accessible unique IDs");
- builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.FileSystemAccessInfo, " File system access info");
- builder.AppendLine($" Other attributes: {entry.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.OtherAttributes} (0x{entry.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.OtherAttributes:X})");
- }
+ builder.AppendLine(" Storage info:");
+ builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.ExtdataID, " Extdata ID");
+ builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.SystemSavedataIDs, " System savedata IDs");
+ builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.StorageAccessibleUniqueIDs, " Storage accessible unique IDs");
+ builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.FileSystemAccessInfo, " File system access info");
+ builder.AppendLine($" Other attributes: {entry.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.OtherAttributes} (0x{entry.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.OtherAttributes:X})");
- builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.ServiceAccessControl, " Service access control");
- builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.ExtendedServiceAccessControl, " Extended service access control");
- builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.Reserved, " Reserved");
- builder.AppendLine($" Resource limit cateogry: {entry.ACIForLimitations.ARM11LocalSystemCapabilities.ResourceLimitCategory} (0x{entry.ACIForLimitations.ARM11LocalSystemCapabilities.ResourceLimitCategory:X})");
- }
+ builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.ServiceAccessControl, " Service access control");
+ builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.ExtendedServiceAccessControl, " Extended service access control");
+ builder.AppendLine(entry.ACIForLimitations.ARM11LocalSystemCapabilities.Reserved, " Reserved");
+ builder.AppendLine($" Resource limit cateogry: {entry.ACIForLimitations.ARM11LocalSystemCapabilities.ResourceLimitCategory} (0x{entry.ACIForLimitations.ARM11LocalSystemCapabilities.ResourceLimitCategory:X})");
- builder.AppendLine(" ARM11 kernel capabilities:");
- if (entry.ACIForLimitations.ARM11KernelCapabilities == null)
- {
- builder.AppendLine(" [NULL]");
- }
- else
- {
- builder.AppendLine(entry.ACIForLimitations.ARM11KernelCapabilities.Descriptors, " Descriptors");
- builder.AppendLine(entry.ACIForLimitations.ARM11KernelCapabilities.Reserved, " Reserved");
- }
+ builder.AppendLine(" ARM11 kernel capabilities:");
+ builder.AppendLine(entry.ACIForLimitations.ARM11KernelCapabilities.Descriptors, " Descriptors");
+ builder.AppendLine(entry.ACIForLimitations.ARM11KernelCapabilities.Reserved, " Reserved");
- builder.AppendLine(" ARM9 access control:");
- if (entry.ACIForLimitations.ARM9AccessControl == null)
- {
- builder.AppendLine(" [NULL]");
- }
- else
- {
- string descriptorsStr = "[NULL]";
- if (entry.ACIForLimitations.ARM9AccessControl.Descriptors != null)
- {
- var descriptors = Array.ConvertAll(entry.ACIForLimitations.ARM9AccessControl.Descriptors, d => d.ToString());
- descriptorsStr = string.Join(", ", descriptors);
- }
- builder.AppendLine(descriptorsStr, " Descriptors");
- builder.AppendLine(entry.ACIForLimitations.ARM9AccessControl.DescriptorVersion, " Descriptor version");
- }
- }
+ builder.AppendLine(" ARM9 access control:");
+ descriptors = Array.ConvertAll(entry.ACIForLimitations.ARM9AccessControl.Descriptors, d => d.ToString());
+ descriptorsStr = string.Join(", ", descriptors);
+ builder.AppendLine(descriptorsStr, " Descriptors");
+ builder.AppendLine(entry.ACIForLimitations.ARM9AccessControl.DescriptorVersion, " Descriptor version");
}
builder.AppendLine();
}
- private static void Print(StringBuilder builder, ExeFSHeader[]? entries)
+ private static void Print(StringBuilder builder, ExeFSHeader[] entries)
{
builder.AppendLine(" ExeFS Header Information:");
builder.AppendLine(" -------------------------");
- if (entries == null || entries.Length == 0)
+ if (entries.Length == 0)
{
builder.AppendLine(" No ExeFS headers");
builder.AppendLine();
@@ -595,7 +437,7 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine(entry.Reserved, " Reserved");
builder.AppendLine(" File hashes:");
- if (entry.FileHashes == null || entry.FileHashes.Length == 0)
+ if (entry.FileHashes.Length == 0)
{
builder.AppendLine(" No file hashes");
}
@@ -614,10 +456,10 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine();
}
- private static void Print(StringBuilder builder, ExeFSFileHeader[]? entries)
+ private static void Print(StringBuilder builder, ExeFSFileHeader[] entries)
{
builder.AppendLine(" File headers:");
- if (entries == null || entries.Length == 0)
+ if (entries.Length == 0)
{
builder.AppendLine(" No file headers");
return;
@@ -634,11 +476,11 @@ namespace SabreTools.Serialization.Wrappers
}
}
- private static void Print(StringBuilder builder, RomFSHeader[]? entries)
+ private static void Print(StringBuilder builder, RomFSHeader[] entries)
{
builder.AppendLine(" RomFS Header Information:");
builder.AppendLine(" -------------------------");
- if (entries == null || entries.Length == 0)
+ if (entries.Length == 0)
{
builder.AppendLine(" No RomFS headers");
builder.AppendLine();
diff --git a/SabreTools.Serialization/Wrappers/N3DS.cs b/SabreTools.Serialization/Wrappers/N3DS.cs
index 635216c1..14566f4d 100644
--- a/SabreTools.Serialization/Wrappers/N3DS.cs
+++ b/SabreTools.Serialization/Wrappers/N3DS.cs
@@ -19,12 +19,12 @@ namespace SabreTools.Serialization.Wrappers
///
/// Backup header
///
- public NCCHHeader? BackupHeader => Model.CardInfoHeader?.InitialData?.BackupHeader;
+ public NCCHHeader BackupHeader => Model.CardInfoHeader.InitialData.BackupHeader;
///
/// ExeFS headers
///
- public ExeFSHeader[] ExeFSHeaders => Model.ExeFSHeaders ?? [];
+ public ExeFSHeader[] ExeFSHeaders => Model.ExeFSHeaders;
///
/// Media unit size in bytes
@@ -33,9 +33,6 @@ namespace SabreTools.Serialization.Wrappers
{
get
{
- if (Model.Header?.PartitionFlags == null)
- return default;
-
return (uint)(0x200 * Math.Pow(2, Model.Header.PartitionFlags[(int)NCSDFlags.MediaUnitSize]));
}
}
@@ -43,12 +40,12 @@ namespace SabreTools.Serialization.Wrappers
///
/// Partitions data table
///
- public NCCHHeader[] Partitions => Model.Partitions ?? [];
+ public NCCHHeader[] Partitions => Model.Partitions;
///
/// Partitions header table
///
- public PartitionTableEntry[] PartitionsTable => Model.Header?.PartitionsTable ?? [];
+ public PartitionTableEntry[] PartitionsTable => Model.Header.PartitionsTable;
#region Named Partition Entries
@@ -59,7 +56,7 @@ namespace SabreTools.Serialization.Wrappers
{
get
{
- if (PartitionsTable == null || PartitionsTable.Length == 0)
+ if (PartitionsTable.Length == 0)
return null;
return PartitionsTable[0];
@@ -73,7 +70,7 @@ namespace SabreTools.Serialization.Wrappers
{
get
{
- if (PartitionsTable == null || PartitionsTable.Length == 0)
+ if (PartitionsTable.Length == 0)
return null;
return PartitionsTable[1];
@@ -87,7 +84,7 @@ namespace SabreTools.Serialization.Wrappers
{
get
{
- if (PartitionsTable == null || PartitionsTable.Length == 0)
+ if (PartitionsTable.Length == 0)
return null;
return PartitionsTable[2];
@@ -101,7 +98,7 @@ namespace SabreTools.Serialization.Wrappers
{
get
{
- if (PartitionsTable == null || PartitionsTable.Length == 0)
+ if (PartitionsTable.Length == 0)
return null;
return PartitionsTable[6];
@@ -115,7 +112,7 @@ namespace SabreTools.Serialization.Wrappers
{
get
{
- if (PartitionsTable == null || PartitionsTable.Length == 0)
+ if (PartitionsTable.Length == 0)
return null;
return PartitionsTable[7];
@@ -127,7 +124,7 @@ namespace SabreTools.Serialization.Wrappers
///
/// Partitions flags
///
- public byte[] PartitionFlags => Model.Header?.PartitionFlags ?? [];
+ public byte[] PartitionFlags => Model.Header.PartitionFlags;
#region Partition Flags
@@ -139,7 +136,7 @@ namespace SabreTools.Serialization.Wrappers
{
get
{
- if (PartitionFlags == null || PartitionFlags.Length == 0)
+ if (PartitionFlags.Length == 0)
return default;
return PartitionFlags[(int)NCSDFlags.BackupWriteWaitTime];
@@ -153,7 +150,7 @@ namespace SabreTools.Serialization.Wrappers
{
get
{
- if (PartitionFlags == null || PartitionFlags.Length == 0)
+ if (PartitionFlags.Length == 0)
return default;
return (MediaCardDeviceType)PartitionFlags[(int)NCSDFlags.MediaCardDevice2X];
@@ -167,7 +164,7 @@ namespace SabreTools.Serialization.Wrappers
{
get
{
- if (PartitionFlags == null || PartitionFlags.Length == 0)
+ if (PartitionFlags.Length == 0)
return default;
return (MediaCardDeviceType)PartitionFlags[(int)NCSDFlags.MediaCardDevice3X];
@@ -181,7 +178,7 @@ namespace SabreTools.Serialization.Wrappers
{
get
{
- if (PartitionFlags == null || PartitionFlags.Length == 0)
+ if (PartitionFlags.Length == 0)
return default;
return (MediaPlatformIndex)PartitionFlags[(int)NCSDFlags.MediaPlatformIndex];
@@ -195,7 +192,7 @@ namespace SabreTools.Serialization.Wrappers
{
get
{
- if (PartitionFlags == null || PartitionFlags.Length == 0)
+ if (PartitionFlags.Length == 0)
return default;
return (MediaTypeIndex)PartitionFlags[(int)NCSDFlags.MediaTypeIndex];