using System.Runtime.InteropServices; namespace SabreTools.Data.Models.Nitro { /// /// Nintendo DS / DSi cartridge header /// /// [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public sealed class CommonHeader { /// /// Game Title /// /// 12 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)] public string GameTitle = string.Empty; /// /// Gamecode /// public uint GameCode; /// /// Makercode /// /// 2 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)] public string MakerCode = string.Empty; /// /// Unitcode /// [MarshalAs(UnmanagedType.U1)] public Unitcode UnitCode; /// /// Encryption seed select (device code. 0 = normal) /// public byte EncryptionSeedSelect; /// /// Devicecapacity /// public byte DeviceCapacity; /// /// Reserved /// /// 7 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] public byte[] Reserved1 = new byte[7]; /// /// Game Revision (used by DSi titles) /// public ushort GameRevision; /// /// ROM Version /// public byte RomVersion; /// /// Internal flags, (Bit2: Autostart) /// public byte InternalFlags; /// /// ARM9 rom offset /// public uint ARM9RomOffset; /// /// ARM9 entry address /// public uint ARM9EntryAddress; /// /// ARM9 load address /// public uint ARM9LoadAddress; /// /// ARM9 size /// public uint ARM9Size; /// /// ARM7 rom offset /// public uint ARM7RomOffset; /// /// ARM7 entry address /// public uint ARM7EntryAddress; /// /// ARM7 load address /// public uint ARM7LoadAddress; /// /// ARM7 size /// public uint ARM7Size; /// /// File Name Table (FNT) offset /// public uint FileNameTableOffset; /// /// File Name Table (FNT) length /// public uint FileNameTableLength; /// /// File Allocation Table (FNT) offset /// public uint FileAllocationTableOffset; /// /// File Allocation Table (FNT) length /// public uint FileAllocationTableLength; /// /// File Name Table (FNT) offset /// public uint ARM9OverlayOffset; /// /// File Name Table (FNT) length /// public uint ARM9OverlayLength; /// /// File Name Table (FNT) offset /// public uint ARM7OverlayOffset; /// /// File Name Table (FNT) length /// public uint ARM7OverlayLength; /// /// Normal card control register settings (0x00416657 for OneTimePROM) /// public uint NormalCardControlRegisterSettings; /// /// Secure card control register settings (0x081808F8 for OneTimePROM) /// public uint SecureCardControlRegisterSettings; /// /// Icon Banner offset (NDSi same as NDS, but with new extra entries) /// public uint IconBannerOffset; /// /// Secure area (2K) CRC /// public ushort SecureAreaCRC; /// /// Secure transfer timeout (0x0D7E for OneTimePROM) /// public ushort SecureTransferTimeout; /// /// ARM9 autoload /// public uint ARM9Autoload; /// /// ARM7 autoload /// public uint ARM7Autoload; /// /// Secure disable /// /// 8 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] SecureDisable = new byte[8]; /// /// NTR region ROM size (excluding DSi area) /// public uint NTRRegionRomSize; /// /// Header size /// public uint HeaderSize; /// /// Reserved (0x88, 0x8C, 0x90 = Unknown, used by DSi) /// /// 56 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 56)] public byte[] Reserved2 = new byte[56]; /// /// Nintendo Logo /// /// 156 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 156)] public byte[] NintendoLogo = new byte[156]; /// /// Nintendo Logo CRC /// public ushort NintendoLogoCRC; /// /// Header CRC /// public ushort HeaderCRC; /// /// Debugger reserved /// /// 0x20 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x20)] public byte[] DebuggerReserved = new byte[0x20]; } }