diff --git a/SabreTools.Serialization/Wrappers/CIA.cs b/SabreTools.Serialization/Wrappers/CIA.cs
index 0dbed92b..4dbe5dec 100644
--- a/SabreTools.Serialization/Wrappers/CIA.cs
+++ b/SabreTools.Serialization/Wrappers/CIA.cs
@@ -1,4 +1,5 @@
using System.IO;
+using SabreTools.Models.N3DS;
namespace SabreTools.Serialization.Wrappers
{
@@ -74,5 +75,36 @@ namespace SabreTools.Serialization.Wrappers
}
#endregion
+
+ // TODO: Hook these up for external use
+ #region Currently Unused Extensions
+
+ #region Ticket
+
+ ///
+ /// Denotes if the ticket denotes a demo or not
+ ///
+ public static bool IsDemo(Ticket? ticket)
+ {
+ if (ticket?.Limits == null || ticket.Limits.Length == 0)
+ return false;
+
+ return ticket.Limits[0] == 0x0004;
+ }
+
+ ///
+ /// Denotes if the max playcount for a demo
+ ///
+ public static uint PlayCount(Ticket ticket)
+ {
+ if (ticket?.Limits == null || ticket.Limits.Length == 0)
+ return 0;
+
+ return ticket.Limits[1];
+ }
+
+ #endregion
+
+ #endregion
}
}
\ No newline at end of file
diff --git a/SabreTools.Serialization/Wrappers/N3DS.cs b/SabreTools.Serialization/Wrappers/N3DS.cs
index 0aa10c54..7046f0ad 100644
--- a/SabreTools.Serialization/Wrappers/N3DS.cs
+++ b/SabreTools.Serialization/Wrappers/N3DS.cs
@@ -1,4 +1,6 @@
+using System;
using System.IO;
+using SabreTools.Models.N3DS;
namespace SabreTools.Serialization.Wrappers
{
@@ -74,5 +76,174 @@ namespace SabreTools.Serialization.Wrappers
}
#endregion
+
+ // TODO: Hook these up for external use
+ #region Currently Unused Extensions
+
+ #region ExeFSFileHeader
+
+ ///
+ /// Determines if a file header represents a CODE block
+ ///
+ public static bool IsCodeBinary(ExeFSFileHeader? header)
+ {
+ if (header == null)
+ return false;
+
+ return header.FileName == ".code\0\0\0";
+ }
+
+ #endregion
+
+ #region NCCHHeaderFlags
+
+ ///
+ /// Get if the NoCrypto bit is set
+ ///
+ public static bool PossblyDecrypted(NCCHHeaderFlags flags)
+ {
+ if (flags == null)
+ return false;
+
+ return flags.BitMasks.HasFlag(BitMasks.NoCrypto);
+ }
+
+ #endregion
+
+ #region NCSDHeader
+
+ ///
+ /// Partition table entry for Executable Content (CXI)
+ ///
+ public static PartitionTableEntry? ExecutableContent(NCSDHeader? header)
+ {
+ if (header?.PartitionsTable == null)
+ return null;
+
+ return header.PartitionsTable[0];
+ }
+
+ ///
+ /// Partition table entry for E-Manual (CFA)
+ ///
+ public static PartitionTableEntry? EManual(NCSDHeader? header)
+ {
+ if (header?.PartitionsTable == null)
+ return null;
+
+ return header.PartitionsTable[1];
+ }
+
+ ///
+ /// Partition table entry for Download Play Child container (CFA)
+ ///
+ public static PartitionTableEntry? DownloadPlayChildContainer(NCSDHeader? header)
+ {
+ if (header?.PartitionsTable == null)
+ return null;
+
+ return header.PartitionsTable[2];
+ }
+
+ ///
+ /// Partition table entry for New3DS Update Data (CFA)
+ ///
+ public static PartitionTableEntry? New3DSUpdateData(NCSDHeader? header)
+ {
+ if (header?.PartitionsTable == null)
+ return null;
+
+ return header.PartitionsTable[6];
+ }
+
+ ///
+ /// Partition table entry for Update Data (CFA)
+ ///
+ public static PartitionTableEntry? UpdateData(NCSDHeader? header)
+ {
+ if (header?.PartitionsTable == null)
+ return null;
+
+ return header.PartitionsTable[7];
+ }
+
+ ///
+ /// Backup Write Wait Time (The time to wait to write save to backup after the card is recognized (0-255
+ /// seconds)).NATIVE_FIRM loads this flag from the gamecard NCSD header starting with 6.0.0-11.
+ ///
+ public static byte BackupWriteWaitTime(NCSDHeader? header)
+ {
+ if (header?.PartitionFlags == null)
+ return default;
+
+ return header.PartitionFlags[(int)NCSDFlags.BackupWriteWaitTime];
+ }
+
+ ///
+ /// Media Card Device (1 = NOR Flash, 2 = None, 3 = BT) (SDK 3.X+)
+ ///
+ public static MediaCardDeviceType MediaCardDevice3X(NCSDHeader? header)
+ {
+ if (header?.PartitionFlags == null)
+ return default;
+
+ return (MediaCardDeviceType)header.PartitionFlags[(int)NCSDFlags.MediaCardDevice3X];
+ }
+
+ ///
+ /// Media Platform Index (1 = CTR)
+ ///
+ public static MediaPlatformIndex MediaPlatformIndex(NCSDHeader? header)
+ {
+ if (header?.PartitionFlags == null)
+ return default;
+
+ return (MediaPlatformIndex)header.PartitionFlags[(int)NCSDFlags.MediaPlatformIndex];
+ }
+
+ ///
+ /// Media Type Index (0 = Inner Device, 1 = Card1, 2 = Card2, 3 = Extended Device)
+ ///
+ public static MediaTypeIndex MediaTypeIndex(NCSDHeader? header)
+ {
+ if (header?.PartitionFlags == null)
+ return default;
+
+ return (MediaTypeIndex)header.PartitionFlags[(int)NCSDFlags.MediaTypeIndex];
+ }
+
+ ///
+ /// Media Unit Size i.e. u32 MediaUnitSize = 0x200*2^flags[6];
+ ///
+ public static uint MediaUnitSize(Cart cart)
+ {
+ return MediaUnitSize(cart.Header);
+ }
+
+ ///
+ /// Media Unit Size i.e. u32 MediaUnitSize = 0x200*2^flags[6];
+ ///
+ public static uint MediaUnitSize(NCSDHeader? header)
+ {
+ if (header?.PartitionFlags == null)
+ return default;
+
+ return (uint)(0x200 * Math.Pow(2, header.PartitionFlags[(int)NCSDFlags.MediaUnitSize]));
+ }
+
+ ///
+ /// Media Card Device (1 = NOR Flash, 2 = None, 3 = BT) (Only SDK 2.X)
+ ///
+ public static MediaCardDeviceType MediaCardDevice2X(NCSDHeader? header)
+ {
+ if (header?.PartitionFlags == null)
+ return default;
+
+ return (MediaCardDeviceType)header.PartitionFlags[(int)NCSDFlags.MediaCardDevice2X];
+ }
+
+ #endregion
+
+ #endregion
}
}
\ No newline at end of file