using System.Runtime.InteropServices; namespace SabreTools.Data.Models.Nitro { /// /// Nintendo DSi extended cart header /// /// [StructLayout(LayoutKind.Sequential)] public sealed class ExtendedDSiHeader { /// /// Global MBK1..MBK5 Settings /// /// 5 entries [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public uint[] GlobalMBK15Settings = new uint[5]; /// /// Local MBK6..MBK8 Settings for ARM9 /// /// 3 entries [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] LocalMBK68SettingsARM9 = new uint[3]; /// /// Local MBK6..MBK8 Settings for ARM7 /// /// 3 entries [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] LocalMBK68SettingsARM7 = new uint[3]; /// /// Global MBK9 Setting /// public uint GlobalMBK9Setting; /// /// Region Flags /// public uint RegionFlags; /// /// Access control /// public uint AccessControl; /// /// ARM7 SCFG EXT mask (controls which devices to enable) /// public uint ARM7SCFGEXTMask; /// /// Reserved/flags? When bit2 of byte 0x1bf is set, usage of banner.sav from the title data dir is enabled.(additional banner data) /// public uint ReservedFlags; /// /// ARM9i rom offset /// public uint ARM9iRomOffset; /// /// Reserved /// public uint Reserved3; /// /// ARM9i load address /// public uint ARM9iLoadAddress; /// /// ARM9i size; /// public uint ARM9iSize; /// /// ARM7i rom offset /// public uint ARM7iRomOffset; /// /// Pointer to base address where various structures and parameters are passed to the title - what is that??? /// public uint Reserved4; /// /// ARM7i load address /// public uint ARM7iLoadAddress; /// /// ARM7i size; /// public uint ARM7iSize; /// /// Digest NTR region offset /// public uint DigestNTRRegionOffset; /// /// Digest NTR region length /// public uint DigestNTRRegionLength; // /// Digest TWL region offset /// public uint DigestTWLRegionOffset; /// /// Digest TWL region length /// public uint DigestTWLRegionLength; // /// Digest Sector Hashtable region offset /// public uint DigestSectorHashtableRegionOffset; /// /// Digest Sector Hashtable region length /// public uint DigestSectorHashtableRegionLength; // /// Digest Block Hashtable region offset /// public uint DigestBlockHashtableRegionOffset; /// /// Digest Block Hashtable region length /// public uint DigestBlockHashtableRegionLength; /// /// Digest Sector size /// public uint DigestSectorSize; /// /// Digeset Block Sectorount /// public uint DigestBlockSectorCount; /// /// Icon Banner Size (usually 0x23C0) /// public uint IconBannerSize; /// /// Unknown (used by DSi) /// public uint Unknown1; /// /// NTR+TWL region ROM size (total size including DSi area) /// public uint NTRTWLRegionRomSize; /// /// Unknown (used by DSi) /// /// 12 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] Unknown2 = new byte[12]; /// /// Modcrypt area 1 offset /// public uint ModcryptArea1Offset; /// /// Modcrypt area 1 size /// public uint ModcryptArea1Size; /// /// Modcrypt area 2 offset /// public uint ModcryptArea2Offset; /// /// Modcrypt area 2 size /// public uint ModcryptArea2Size; /// /// Title ID /// /// 8 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] TitleID = new byte[8]; /// /// DSiWare: "public.sav" size /// public uint DSiWarePublicSavSize; /// /// DSiWare: "private.sav" size /// public uint DSiWarePrivateSavSize; /// /// Reserved (zero) /// /// 176 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 176)] public byte[] ReservedZero = new byte[176]; /// /// Unknown (used by DSi) /// /// 16 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] Unknown3 = new byte[16]; /// /// ARM9 (with encrypted secure area) SHA1 HMAC hash /// /// 20 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] ARM9WithSecureAreaSHA1HMACHash = new byte[20]; /// /// ARM7 SHA1 HMAC hash /// /// 20 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] ARM7SHA1HMACHash = new byte[20]; /// /// Digest master SHA1 HMAC hash /// /// 20 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] DigestMasterSHA1HMACHash = new byte[20]; /// /// Banner SHA1 HMAC hash /// /// 20 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] BannerSHA1HMACHash = new byte[20]; /// /// ARM9i (decrypted) SHA1 HMAC hash /// /// 20 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] ARM9iDecryptedSHA1HMACHash = new byte[20]; /// /// ARM7i (decrypted) SHA1 HMAC hash /// /// 20 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] ARM7iDecryptedSHA1HMACHash = new byte[20]; /// /// Reserved /// /// 40 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 40)] public byte[] Reserved5 = new byte[40]; /// /// ARM9 (without secure area) SHA1 HMAC hash /// /// 20 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] ARM9NoSecureAreaSHA1HMACHash = new byte[20]; /// /// Reserved /// /// 2636 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2636)] public byte[] Reserved6 = new byte[2636]; /// /// Reserved and unchecked region, always zero. Used for passing arguments in debug environment. /// /// 0x180 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x180)] public byte[] ReservedAndUnchecked = new byte[0x180]; /// /// RSA signature (the first 0xE00 bytes of the header are signed with an 1024-bit RSA signature). /// /// 0x80 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x80)] public byte[] RSASignature = new byte[0x80]; } }