From 9f5ffaf0359f59ccead428ecf06c7039fab41e79 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 14 Oct 2024 00:15:26 -0400 Subject: [PATCH] Move various extensions to Serialization --- NDecrypt.Core/N3DS/Extensions.cs | 139 +------------------------------ 1 file changed, 1 insertion(+), 138 deletions(-) diff --git a/NDecrypt.Core/N3DS/Extensions.cs b/NDecrypt.Core/N3DS/Extensions.cs index 31f20ae..02f33fc 100644 --- a/NDecrypt.Core/N3DS/Extensions.cs +++ b/NDecrypt.Core/N3DS/Extensions.cs @@ -128,107 +128,7 @@ namespace NDecrypt.N3DS #region NCSDHeader - /// - /// Partition table entry for Executable Content (CXI) - /// - public static PartitionTableEntry? ExecutableContent(this NCSDHeader? header) - { - if (header?.PartitionsTable == null) - return null; - - return header.PartitionsTable[0]; - } - - /// - /// Partition table entry for E-Manual (CFA) - /// - public static PartitionTableEntry? EManual(this 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(this NCSDHeader? header) - { - if (header?.PartitionsTable == null) - return null; - - return header.PartitionsTable[2]; - } - - /// - /// Partition table entry for New3DS Update Data (CFA) - /// - public static PartitionTableEntry? New3DSUpdateData(this NCSDHeader? header) - { - if (header?.PartitionsTable == null) - return null; - - return header.PartitionsTable[6]; - } - - /// - /// Partition table entry for Update Data (CFA) - /// - public static PartitionTableEntry? UpdateData(this 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(this 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(this NCSDHeader? header) - { - if (header?.PartitionFlags == null) - return default; - - return (MediaCardDeviceType)header.PartitionFlags[(int)NCSDFlags.MediaCardDevice3X]; - } - - /// - /// Media Platform Index (1 = CTR) - /// - public static MediaPlatformIndex MediaPlatformIndex(this 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(this 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(this Cart cart) @@ -247,43 +147,6 @@ namespace NDecrypt.N3DS 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(this NCSDHeader? header) - { - if (header?.PartitionFlags == null) - return default; - - return (MediaCardDeviceType)header.PartitionFlags[(int)NCSDFlags.MediaCardDevice2X]; - } - - #endregion - - #region Ticket - - /// - /// Denotes if the ticket denotes a demo or not - /// - public static bool IsDemo(this 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(this Ticket ticket) - { - if (ticket?.Limits == null || ticket.Limits.Length == 0) - return 0; - - return ticket.Limits[1]; - } - #endregion } } \ No newline at end of file