diff --git a/SabreTools.Serialization/Models/Nitro/Cart.cs b/SabreTools.Serialization/Models/Nitro/Cart.cs
index c7861e6f..734ba95c 100644
--- a/SabreTools.Serialization/Models/Nitro/Cart.cs
+++ b/SabreTools.Serialization/Models/Nitro/Cart.cs
@@ -8,12 +8,12 @@ namespace SabreTools.Data.Models.Nitro
///
/// DS/DSi cart header
///
- public CommonHeader? CommonHeader { get; set; }
+ public CommonHeader CommonHeader { get; set; }
///
/// DSi extended cart header
///
- public ExtendedDSiHeader? ExtendedDSiHeader { get; set; }
+ public ExtendedDSiHeader ExtendedDSiHeader { get; set; }
///
/// Secure area, may be encrypted or decrypted
@@ -24,11 +24,11 @@ namespace SabreTools.Data.Models.Nitro
///
/// Name table (folder allocation table, name list)
///
- public NameTable? NameTable { get; set; }
+ public NameTable NameTable { get; set; }
///
/// File allocation table
///
- public FileAllocationTableEntry[]? FileAllocationTable { get; set; }
+ public FileAllocationTableEntry[] FileAllocationTable { get; set; }
}
}
diff --git a/SabreTools.Serialization/Models/Nitro/CommonHeader.cs b/SabreTools.Serialization/Models/Nitro/CommonHeader.cs
index 80dbc206..ac32df61 100644
--- a/SabreTools.Serialization/Models/Nitro/CommonHeader.cs
+++ b/SabreTools.Serialization/Models/Nitro/CommonHeader.cs
@@ -14,7 +14,7 @@ namespace SabreTools.Data.Models.Nitro
///
/// 12 bytes
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)]
- public string? GameTitle;
+ public string GameTitle;
///
/// Gamecode
@@ -26,7 +26,7 @@ namespace SabreTools.Data.Models.Nitro
///
/// 2 bytes
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)]
- public string? MakerCode;
+ public string MakerCode;
///
/// Unitcode
diff --git a/SabreTools.Serialization/Models/Nitro/Constants.cs b/SabreTools.Serialization/Models/Nitro/Constants.cs
index 204ee464..d36549e8 100644
--- a/SabreTools.Serialization/Models/Nitro/Constants.cs
+++ b/SabreTools.Serialization/Models/Nitro/Constants.cs
@@ -365,4 +365,4 @@ namespace SabreTools.Data.Models.Nitro
0x96,0xE7,0xC4,0x18,0x5F,0xAD,0xF5,0x19,
];
}
-}
\ No newline at end of file
+}
diff --git a/SabreTools.Serialization/Models/Nitro/Enums.cs b/SabreTools.Serialization/Models/Nitro/Enums.cs
index 7b329bda..6c8a9058 100644
--- a/SabreTools.Serialization/Models/Nitro/Enums.cs
+++ b/SabreTools.Serialization/Models/Nitro/Enums.cs
@@ -8,4 +8,4 @@ namespace SabreTools.Data.Models.Nitro
DSi = 0x03,
}
-}
\ No newline at end of file
+}
diff --git a/SabreTools.Serialization/Models/Nitro/ExtendedDSiHeader.cs b/SabreTools.Serialization/Models/Nitro/ExtendedDSiHeader.cs
index dd4016d4..3274ffe9 100644
--- a/SabreTools.Serialization/Models/Nitro/ExtendedDSiHeader.cs
+++ b/SabreTools.Serialization/Models/Nitro/ExtendedDSiHeader.cs
@@ -14,21 +14,21 @@ namespace SabreTools.Data.Models.Nitro
///
/// 5 entries
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
- public uint[]? GlobalMBK15Settings;
+ public uint[] GlobalMBK15Settings = new uint[5];
///
/// Local MBK6..MBK8 Settings for ARM9
///
/// 3 entries
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
- public uint[]? LocalMBK68SettingsARM9;
+ public uint[] LocalMBK68SettingsARM9 = new uint[3];
///
/// Local MBK6..MBK8 Settings for ARM7
///
/// 3 entries
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
- public uint[]? LocalMBK68SettingsARM7;
+ public uint[] LocalMBK68SettingsARM7 = new uint[3];
///
/// Global MBK9 Setting
diff --git a/SabreTools.Serialization/Models/Nitro/FileAllocationTableEntry.cs b/SabreTools.Serialization/Models/Nitro/FileAllocationTableEntry.cs
index c2e2faf2..5d1cb65d 100644
--- a/SabreTools.Serialization/Models/Nitro/FileAllocationTableEntry.cs
+++ b/SabreTools.Serialization/Models/Nitro/FileAllocationTableEntry.cs
@@ -20,4 +20,4 @@ namespace SabreTools.Data.Models.Nitro
///
public uint EndOffset;
}
-}
\ No newline at end of file
+}
diff --git a/SabreTools.Serialization/Models/Nitro/FolderAllocationTableEntry.cs b/SabreTools.Serialization/Models/Nitro/FolderAllocationTableEntry.cs
index 07913eeb..d51f1b62 100644
--- a/SabreTools.Serialization/Models/Nitro/FolderAllocationTableEntry.cs
+++ b/SabreTools.Serialization/Models/Nitro/FolderAllocationTableEntry.cs
@@ -33,4 +33,4 @@ namespace SabreTools.Data.Models.Nitro
///
public byte Unknown;
}
-}
\ No newline at end of file
+}
diff --git a/SabreTools.Serialization/Models/Nitro/NameListEntry.cs b/SabreTools.Serialization/Models/Nitro/NameListEntry.cs
index 47850320..daa9ba39 100644
--- a/SabreTools.Serialization/Models/Nitro/NameListEntry.cs
+++ b/SabreTools.Serialization/Models/Nitro/NameListEntry.cs
@@ -17,7 +17,7 @@ namespace SabreTools.Data.Models.Nitro
///
/// The variable length name (UTF-8)
///
- public string? Name { get; set; }
+ public string Name { get; set; }
///
/// Only there if it is a folder. Refers to the the index of it
@@ -26,4 +26,4 @@ namespace SabreTools.Data.Models.Nitro
///
public ushort Index { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/SabreTools.Serialization/Models/Nitro/NameTable.cs b/SabreTools.Serialization/Models/Nitro/NameTable.cs
index dae99db7..3ad76430 100644
--- a/SabreTools.Serialization/Models/Nitro/NameTable.cs
+++ b/SabreTools.Serialization/Models/Nitro/NameTable.cs
@@ -4,7 +4,7 @@ namespace SabreTools.Data.Models.Nitro
/// The name table stores the names of the files and the structure
/// of the file system. From the information stored, the index of the
/// file's entry in the File Allocation Table can be found.
- ///
+ ///
/// It is split into two parts:
/// - Folder Allocation Table
/// - Name List
@@ -15,11 +15,11 @@ namespace SabreTools.Data.Models.Nitro
///
/// Folder allocation table
///
- public FolderAllocationTableEntry[]? FolderAllocationTable { get; set; }
+ public FolderAllocationTableEntry[] FolderAllocationTable { get; set; }
///
/// Name list
///
- public NameListEntry[]? NameList { get; set; }
+ public NameListEntry[] NameList { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/SabreTools.Serialization/Wrappers/Nitro.Encryption.cs b/SabreTools.Serialization/Wrappers/Nitro.Encryption.cs
index 2f4773c5..f7ae2fac 100644
--- a/SabreTools.Serialization/Wrappers/Nitro.Encryption.cs
+++ b/SabreTools.Serialization/Wrappers/Nitro.Encryption.cs
@@ -56,10 +56,6 @@ namespace SabreTools.Serialization.Wrappers
/// Blowfish table data as a byte array
private void EncryptARM9(byte[] tableData)
{
- // If the secure area is invalid, nothing can be done
- if (SecureArea == null)
- return;
-
// Point to the beginning of the secure area
int readOffset = 0;
@@ -178,10 +174,6 @@ namespace SabreTools.Serialization.Wrappers
/// Blowfish table data as a byte array
private void DecryptARM9(byte[] tableData)
{
- // If the secure area is invalid, nothing can be done
- if (SecureArea == null)
- return;
-
// Point to the beginning of the secure area
int readOffset = 0;
int writeOffset = 0;
@@ -259,13 +251,6 @@ namespace SabreTools.Serialization.Wrappers
/// True if the file has known values for a decrypted file, null if it's empty, false otherwise
public bool? CheckIfDecrypted(out string? message)
{
- // Return empty if the secure area is undefined
- if (SecureArea == null)
- {
- message = "Secure area is undefined. Cannot be encrypted or decrypted.";
- return null;
- }
-
int offset = 0;
uint firstValue = SecureArea.ReadUInt32LittleEndian(ref offset);
uint secondValue = SecureArea.ReadUInt32LittleEndian(ref offset);
diff --git a/SabreTools.Serialization/Wrappers/Nitro.Printing.cs b/SabreTools.Serialization/Wrappers/Nitro.Printing.cs
index 4aa1454c..b918d11e 100644
--- a/SabreTools.Serialization/Wrappers/Nitro.Printing.cs
+++ b/SabreTools.Serialization/Wrappers/Nitro.Printing.cs
@@ -25,17 +25,10 @@ namespace SabreTools.Serialization.Wrappers
Print(builder, Model.FileAllocationTable);
}
- private static void Print(StringBuilder builder, CommonHeader? header)
+ private static void Print(StringBuilder builder, CommonHeader header)
{
builder.AppendLine(" Common Header Information:");
builder.AppendLine(" -------------------------");
- if (header == null)
- {
- builder.AppendLine(" No common header");
- builder.AppendLine();
- return;
- }
-
builder.AppendLine(header.GameTitle, " Game title");
builder.AppendLine(header.GameCode, " Game code");
builder.AppendLine(header.MakerCode, " Maker code");
@@ -79,17 +72,10 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine();
}
- private static void Print(StringBuilder builder, ExtendedDSiHeader? header)
+ private static void Print(StringBuilder builder, ExtendedDSiHeader header)
{
builder.AppendLine(" Extended DSi Header Information:");
builder.AppendLine(" -------------------------");
- if (header == null)
- {
- builder.AppendLine(" No extended DSi header");
- builder.AppendLine();
- return;
- }
-
builder.AppendLine(header.GlobalMBK15Settings, " Global MBK1..MBK5 settings");
builder.AppendLine(header.LocalMBK68SettingsARM9, " Local MBK6..MBK8 settings for ARM9");
builder.AppendLine(header.LocalMBK68SettingsARM7, " Local MBK6..MBK8 settings for ARM7");
@@ -141,7 +127,7 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine();
}
- private static void Print(StringBuilder builder, byte[]? secureArea)
+ private static void Print(StringBuilder builder, byte[] secureArea)
{
builder.AppendLine(" Secure Area Information:");
builder.AppendLine(" -------------------------");
@@ -149,27 +135,21 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine();
}
- private static void Print(StringBuilder builder, NameTable? table)
+ private static void Print(StringBuilder builder, NameTable table)
{
builder.AppendLine(" Name Table Information:");
builder.AppendLine(" -------------------------");
- if (table == null)
- {
- builder.AppendLine(" No name table");
- builder.AppendLine();
- return;
- }
-
builder.AppendLine();
+
Print(builder, table.FolderAllocationTable);
Print(builder, table.NameList);
}
- private static void Print(StringBuilder builder, FolderAllocationTableEntry[]? entries)
+ private static void Print(StringBuilder builder, FolderAllocationTableEntry[] entries)
{
builder.AppendLine(" Folder Allocation Table:");
builder.AppendLine(" -------------------------");
- if (entries == null || entries.Length == 0)
+ if (entries.Length == 0)
{
builder.AppendLine(" No folder allocation table entries");
builder.AppendLine();
@@ -198,11 +178,11 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine();
}
- private static void Print(StringBuilder builder, NameListEntry[]? entries)
+ private static void Print(StringBuilder builder, NameListEntry[] entries)
{
builder.AppendLine(" Name List:");
builder.AppendLine(" -------------------------");
- if (entries == null || entries.Length == 0)
+ if (entries.Length == 0)
{
builder.AppendLine(" No name list entries");
builder.AppendLine();
@@ -223,11 +203,11 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine();
}
- private static void Print(StringBuilder builder, FileAllocationTableEntry[]? entries)
+ private static void Print(StringBuilder builder, FileAllocationTableEntry[] entries)
{
builder.AppendLine(" File Allocation Table:");
builder.AppendLine(" -------------------------");
- if (entries == null || entries.Length == 0)
+ if (entries.Length == 0)
{
builder.AppendLine(" No file allocation table entries");
builder.AppendLine();
diff --git a/SabreTools.Serialization/Wrappers/Nitro.cs b/SabreTools.Serialization/Wrappers/Nitro.cs
index ca5bfed0..f99276a6 100644
--- a/SabreTools.Serialization/Wrappers/Nitro.cs
+++ b/SabreTools.Serialization/Wrappers/Nitro.cs
@@ -15,10 +15,10 @@ namespace SabreTools.Serialization.Wrappers
#region Extension Methods
///
- public CommonHeader? CommonHeader => Model.CommonHeader;
+ public CommonHeader CommonHeader => Model.CommonHeader;
///
- public uint GameCode => Model.CommonHeader?.GameCode ?? 0;
+ public uint GameCode => Model.CommonHeader.GameCode;
///
public byte[] SecureArea => Model.SecureArea;