Files
BinaryObjectScanner/BinaryObjectScanner.Wrappers/Nitro.cs

665 lines
25 KiB
C#
Raw Normal View History

2023-09-15 00:47:44 -04:00
using System.IO;
2023-01-13 14:04:21 -08:00
using System.Text;
2023-01-06 23:39:32 -08:00
2023-03-07 16:59:14 -05:00
namespace BinaryObjectScanner.Wrappers
2023-01-06 23:39:32 -08:00
{
2023-09-11 23:25:09 -04:00
public class Nitro : WrapperBase<SabreTools.Models.Nitro.Cart>
2023-01-06 23:39:32 -08:00
{
2023-01-18 11:18:53 -08:00
#region Descriptive Properties
/// <inheritdoc/>
2023-09-11 23:25:09 -04:00
public override string DescriptionString => "Nintendo DS/DSi Cart Image";
2023-01-18 11:18:53 -08:00
#endregion
2023-01-06 23:39:32 -08:00
#region Pass-Through Properties
2023-01-06 23:48:26 -08:00
#region Common Header
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.GameTitle"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public string GameTitle => _model.CommonHeader.GameTitle;
2023-09-12 17:12:23 -04:00
#else
2023-09-13 00:08:11 -04:00
public string? GameTitle => _model.CommonHeader?.GameTitle;
2023-09-12 17:12:23 -04:00
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.GameCode"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint GameCode => _model.CommonHeader.GameCode;
2023-09-13 00:08:11 -04:00
#else
public uint? GameCode => _model.CommonHeader?.GameCode;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.MakerCode"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public string MakerCode => _model.CommonHeader.MakerCode;
2023-09-12 17:12:23 -04:00
#else
2023-09-13 00:08:11 -04:00
public string? MakerCode => _model.CommonHeader?.MakerCode;
2023-09-12 17:12:23 -04:00
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.UnitCode"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public SabreTools.Models.Nitro.Unitcode UnitCode => _model.CommonHeader.UnitCode;
2023-09-13 00:08:11 -04:00
#else
public SabreTools.Models.Nitro.Unitcode? UnitCode => _model.CommonHeader?.UnitCode;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.EncryptionSeedSelect"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte EncryptionSeedSelect => _model.CommonHeader.EncryptionSeedSelect;
2023-09-13 00:08:11 -04:00
#else
public byte? EncryptionSeedSelect => _model.CommonHeader?.EncryptionSeedSelect;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.DeviceCapacity"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte DeviceCapacity => _model.CommonHeader.DeviceCapacity;
2023-09-13 00:08:11 -04:00
#else
public byte? DeviceCapacity => _model.CommonHeader?.DeviceCapacity;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.Reserved1"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] Reserved1 => _model.CommonHeader.Reserved1;
2023-09-12 17:12:23 -04:00
#else
2023-09-13 00:08:11 -04:00
public byte[]? Reserved1 => _model.CommonHeader?.Reserved1;
2023-09-12 17:12:23 -04:00
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.GameRevision"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public ushort GameRevision => _model.CommonHeader.GameRevision;
2023-09-13 00:08:11 -04:00
#else
public ushort? GameRevision => _model.CommonHeader?.GameRevision;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.RomVersion"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte RomVersion => _model.CommonHeader.RomVersion;
2023-09-13 00:08:11 -04:00
#else
public byte? RomVersion => _model.CommonHeader?.RomVersion;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.InternalFlags"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte InternalFlags => _model.CommonHeader.InternalFlags;
2023-09-13 00:08:11 -04:00
#else
public byte? InternalFlags => _model.CommonHeader?.InternalFlags;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.ARM9RomOffset"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint ARM9RomOffset => _model.CommonHeader.ARM9RomOffset;
2023-09-13 00:08:11 -04:00
#else
public uint? ARM9RomOffset => _model.CommonHeader?.ARM9RomOffset;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.ARM9EntryAddress"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint ARM9EntryAddress => _model.CommonHeader.ARM9EntryAddress;
2023-09-13 00:08:11 -04:00
#else
public uint? ARM9EntryAddress => _model.CommonHeader?.ARM9EntryAddress;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.ARM9LoadAddress"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint ARM9LoadAddress => _model.CommonHeader.ARM9LoadAddress;
2023-09-13 00:08:11 -04:00
#else
public uint? ARM9LoadAddress => _model.CommonHeader?.ARM9LoadAddress;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.ARM9Size"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint ARM9Size => _model.CommonHeader.ARM9Size;
2023-09-13 00:08:11 -04:00
#else
public uint? ARM9Size => _model.CommonHeader?.ARM9Size;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.ARM7RomOffset"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint ARM7RomOffset => _model.CommonHeader.ARM7RomOffset;
2023-09-13 00:08:11 -04:00
#else
public uint? ARM7RomOffset => _model.CommonHeader?.ARM7RomOffset;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.ARM7EntryAddress"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint ARM7EntryAddress => _model.CommonHeader.ARM7EntryAddress;
2023-09-13 00:08:11 -04:00
#else
public uint? ARM7EntryAddress => _model.CommonHeader?.ARM7EntryAddress;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.ARM7LoadAddress"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint ARM7LoadAddress => _model.CommonHeader.ARM7LoadAddress;
2023-09-13 00:08:11 -04:00
#else
public uint? ARM7LoadAddress => _model.CommonHeader?.ARM7LoadAddress;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.ARM7Size"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint ARM7Size => _model.CommonHeader.ARM7Size;
2023-09-13 00:08:11 -04:00
#else
public uint? ARM7Size => _model.CommonHeader?.ARM7Size;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.FileNameTableOffset"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint FileNameTableOffset => _model.CommonHeader.FileNameTableOffset;
2023-09-13 00:08:11 -04:00
#else
public uint? FileNameTableOffset => _model.CommonHeader?.FileNameTableOffset;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.FileNameTableLength"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint FileNameTableLength => _model.CommonHeader.FileNameTableLength;
2023-09-13 00:08:11 -04:00
#else
public uint? FileNameTableLength => _model.CommonHeader?.FileNameTableLength;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.FileAllocationTableOffset"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint FileAllocationTableOffset => _model.CommonHeader.FileAllocationTableOffset;
2023-09-13 00:08:11 -04:00
#else
public uint? FileAllocationTableOffset => _model.CommonHeader?.FileAllocationTableOffset;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.FileAllocationTableLength"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint FileAllocationTableLength => _model.CommonHeader.FileAllocationTableLength;
2023-09-13 00:08:11 -04:00
#else
public uint? FileAllocationTableLength => _model.CommonHeader?.FileAllocationTableLength;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.ARM9OverlayOffset"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint ARM9OverlayOffset => _model.CommonHeader.ARM9OverlayOffset;
2023-09-13 00:08:11 -04:00
#else
public uint? ARM9OverlayOffset => _model.CommonHeader?.ARM9OverlayOffset;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.ARM9OverlayLength"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint ARM9OverlayLength => _model.CommonHeader.ARM9OverlayLength;
2023-09-13 00:08:11 -04:00
#else
public uint? ARM9OverlayLength => _model.CommonHeader?.ARM9OverlayLength;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.ARM7OverlayOffset"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint ARM7OverlayOffset => _model.CommonHeader.ARM7OverlayOffset;
2023-09-13 00:08:11 -04:00
#else
public uint? ARM7OverlayOffset => _model.CommonHeader?.ARM7OverlayOffset;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.ARM7OverlayLength"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint ARM7OverlayLength => _model.CommonHeader.ARM7OverlayLength;
2023-09-13 00:08:11 -04:00
#else
public uint? ARM7OverlayLength => _model.CommonHeader?.ARM7OverlayLength;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.NormalCardControlRegisterSettings"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint NormalCardControlRegisterSettings => _model.CommonHeader.NormalCardControlRegisterSettings;
2023-09-13 00:08:11 -04:00
#else
public uint? NormalCardControlRegisterSettings => _model.CommonHeader?.NormalCardControlRegisterSettings;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.SecureCardControlRegisterSettings"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint SecureCardControlRegisterSettings => _model.CommonHeader.SecureCardControlRegisterSettings;
2023-09-13 00:08:11 -04:00
#else
public uint? SecureCardControlRegisterSettings => _model.CommonHeader?.SecureCardControlRegisterSettings;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.IconBannerOffset"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint IconBannerOffset => _model.CommonHeader.IconBannerOffset;
2023-09-13 00:08:11 -04:00
#else
public uint? IconBannerOffset => _model.CommonHeader?.IconBannerOffset;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.SecureAreaCRC"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public ushort SecureAreaCRC => _model.CommonHeader.SecureAreaCRC;
2023-09-13 00:08:11 -04:00
#else
public ushort? SecureAreaCRC => _model.CommonHeader?.SecureAreaCRC;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.SecureTransferTimeout"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public ushort SecureTransferTimeout => _model.CommonHeader.SecureTransferTimeout;
2023-09-13 00:08:11 -04:00
#else
public ushort? SecureTransferTimeout => _model.CommonHeader?.SecureTransferTimeout;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.ARM9Autoload"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint ARM9Autoload => _model.CommonHeader.ARM9Autoload;
2023-09-13 00:08:11 -04:00
#else
public uint? ARM9Autoload => _model.CommonHeader?.ARM9Autoload;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.ARM7Autoload"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint ARM7Autoload => _model.CommonHeader.ARM7Autoload;
2023-09-13 00:08:11 -04:00
#else
public uint? ARM7Autoload => _model.CommonHeader?.ARM7Autoload;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.SecureDisable"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] SecureDisable => _model.CommonHeader.SecureDisable;
2023-09-12 17:12:23 -04:00
#else
2023-09-13 00:08:11 -04:00
public byte[]? SecureDisable => _model.CommonHeader?.SecureDisable;
2023-09-12 17:12:23 -04:00
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.NTRRegionRomSize"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint NTRRegionRomSize => _model.CommonHeader.NTRRegionRomSize;
2023-09-13 00:08:11 -04:00
#else
public uint? NTRRegionRomSize => _model.CommonHeader?.NTRRegionRomSize;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.HeaderSize"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint HeaderSize => _model.CommonHeader.HeaderSize;
2023-09-13 00:08:11 -04:00
#else
public uint? HeaderSize => _model.CommonHeader?.HeaderSize;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.Reserved2"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] Reserved2 => _model.CommonHeader.Reserved2;
2023-09-12 17:12:23 -04:00
#else
2023-09-13 00:08:11 -04:00
public byte[]? Reserved2 => _model.CommonHeader?.Reserved2;
2023-09-12 17:12:23 -04:00
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.NintendoLogo"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] NintendoLogo => _model.CommonHeader.NintendoLogo;
2023-09-12 17:12:23 -04:00
#else
2023-09-13 00:08:11 -04:00
public byte[]? NintendoLogo => _model.CommonHeader?.NintendoLogo;
2023-09-12 17:12:23 -04:00
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.NintendoLogoCRC"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public ushort NintendoLogoCRC => _model.CommonHeader.NintendoLogoCRC;
2023-09-13 00:08:11 -04:00
#else
public ushort? NintendoLogoCRC => _model.CommonHeader?.NintendoLogoCRC;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.HeaderCRC"/>
2023-09-13 00:08:11 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public ushort HeaderCRC => _model.CommonHeader.HeaderCRC;
2023-09-13 00:08:11 -04:00
#else
public ushort? HeaderCRC => _model.CommonHeader?.HeaderCRC;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.CommonHeader.DebuggerReserved"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] DebuggerReserved => _model.CommonHeader.DebuggerReserved;
2023-09-12 17:12:23 -04:00
#else
2023-09-13 00:08:11 -04:00
public byte[]? DebuggerReserved => _model.CommonHeader?.DebuggerReserved;
2023-09-12 17:12:23 -04:00
#endif
2023-01-06 23:39:32 -08:00
#endregion
2023-01-06 23:48:26 -08:00
#region Extended DSi Header
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.GlobalMBK15Settings"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint[] GlobalMBK15Settings => _model.ExtendedDSiHeader?.GlobalMBK15Settings;
2023-09-12 17:12:23 -04:00
#else
public uint[]? GlobalMBK15Settings => _model.ExtendedDSiHeader?.GlobalMBK15Settings;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.LocalMBK68SettingsARM9"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint[] LocalMBK68SettingsARM9 => _model.ExtendedDSiHeader?.LocalMBK68SettingsARM9;
2023-09-12 17:12:23 -04:00
#else
public uint[]? LocalMBK68SettingsARM9 => _model.ExtendedDSiHeader?.LocalMBK68SettingsARM9;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.LocalMBK68SettingsARM7"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public uint[] LocalMBK68SettingsARM7 => _model.ExtendedDSiHeader?.LocalMBK68SettingsARM7;
2023-09-12 17:12:23 -04:00
#else
public uint[]? LocalMBK68SettingsARM7 => _model.ExtendedDSiHeader?.LocalMBK68SettingsARM7;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.GlobalMBK9Setting"/>
2023-09-11 23:25:09 -04:00
public uint? GlobalMBK9Setting => _model.ExtendedDSiHeader?.GlobalMBK9Setting;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.RegionFlags"/>
2023-09-11 23:25:09 -04:00
public uint? RegionFlags => _model.ExtendedDSiHeader?.RegionFlags;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.AccessControl"/>
2023-09-11 23:25:09 -04:00
public uint? AccessControl => _model.ExtendedDSiHeader?.AccessControl;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ARM7SCFGEXTMask"/>
2023-09-11 23:25:09 -04:00
public uint? ARM7SCFGEXTMask => _model.ExtendedDSiHeader?.ARM7SCFGEXTMask;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ReservedFlags"/>
2023-09-11 23:25:09 -04:00
public uint? ReservedFlags => _model.ExtendedDSiHeader?.ReservedFlags;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ARM9iRomOffset"/>
2023-09-11 23:25:09 -04:00
public uint? ARM9iRomOffset => _model.ExtendedDSiHeader?.ARM9iRomOffset;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.Reserved3"/>
2023-09-11 23:25:09 -04:00
public uint? Reserved3 => _model.ExtendedDSiHeader?.Reserved3;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ARM9iLoadAddress"/>
2023-09-11 23:25:09 -04:00
public uint? ARM9iLoadAddress => _model.ExtendedDSiHeader?.ARM9iLoadAddress;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ARM9iSize"/>
2023-09-11 23:25:09 -04:00
public uint? ARM9iSize => _model.ExtendedDSiHeader?.ARM9iSize;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ARM7iRomOffset"/>
2023-09-11 23:25:09 -04:00
public uint? ARM7iRomOffset => _model.ExtendedDSiHeader?.ARM7iRomOffset;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.Reserved4"/>
2023-09-11 23:25:09 -04:00
public uint? Reserved4 => _model.ExtendedDSiHeader?.Reserved4;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ARM7iLoadAddress"/>
2023-09-11 23:25:09 -04:00
public uint? ARM7iLoadAddress => _model.ExtendedDSiHeader?.ARM7iLoadAddress;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ARM7iSize"/>
2023-09-11 23:25:09 -04:00
public uint? ARM7iSize => _model.ExtendedDSiHeader?.ARM7iSize;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.DigestNTRRegionOffset"/>
2023-09-11 23:25:09 -04:00
public uint? DigestNTRRegionOffset => _model.ExtendedDSiHeader?.DigestNTRRegionOffset;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.DigestNTRRegionLength"/>
2023-09-11 23:25:09 -04:00
public uint? DigestNTRRegionLength => _model.ExtendedDSiHeader?.DigestNTRRegionLength;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.DigestTWLRegionOffset"/>
2023-09-11 23:25:09 -04:00
public uint? DigestTWLRegionOffset => _model.ExtendedDSiHeader?.DigestTWLRegionOffset;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.DigestTWLRegionLength"/>
2023-09-11 23:25:09 -04:00
public uint? DigestTWLRegionLength => _model.ExtendedDSiHeader?.DigestTWLRegionLength;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.DigestSectorHashtableRegionOffset"/>
2023-09-11 23:25:09 -04:00
public uint? DigestSectorHashtableRegionOffset => _model.ExtendedDSiHeader?.DigestSectorHashtableRegionOffset;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.DigestSectorHashtableRegionLength"/>
2023-09-11 23:25:09 -04:00
public uint? DigestSectorHashtableRegionLength => _model.ExtendedDSiHeader?.DigestSectorHashtableRegionLength;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.DigestBlockHashtableRegionOffset"/>
2023-09-11 23:25:09 -04:00
public uint? DigestBlockHashtableRegionOffset => _model.ExtendedDSiHeader?.DigestBlockHashtableRegionOffset;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.DigestBlockHashtableRegionLength"/>
2023-09-11 23:25:09 -04:00
public uint? DigestBlockHashtableRegionLength => _model.ExtendedDSiHeader?.DigestBlockHashtableRegionLength;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.DigestSectorSize"/>
2023-09-11 23:25:09 -04:00
public uint? DigestSectorSize => _model.ExtendedDSiHeader?.DigestSectorSize;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.DigestBlockSectorCount"/>
2023-09-11 23:25:09 -04:00
public uint? DigestBlockSectorCount => _model.ExtendedDSiHeader?.DigestBlockSectorCount;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.IconBannerSize"/>
2023-09-11 23:25:09 -04:00
public uint? IconBannerSize => _model.ExtendedDSiHeader?.IconBannerSize;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.Unknown1"/>
2023-09-11 23:25:09 -04:00
public uint? Unknown1 => _model.ExtendedDSiHeader?.Unknown1;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ModcryptArea1Offset"/>
2023-09-11 23:25:09 -04:00
public uint? ModcryptArea1Offset => _model.ExtendedDSiHeader?.ModcryptArea1Offset;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ModcryptArea1Size"/>
2023-09-11 23:25:09 -04:00
public uint? ModcryptArea1Size => _model.ExtendedDSiHeader?.ModcryptArea1Size;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ModcryptArea2Offset"/>
2023-09-11 23:25:09 -04:00
public uint? ModcryptArea2Offset => _model.ExtendedDSiHeader?.ModcryptArea2Offset;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ModcryptArea2Size"/>
2023-09-11 23:25:09 -04:00
public uint? ModcryptArea2Size => _model.ExtendedDSiHeader?.ModcryptArea2Size;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.TitleID"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] TitleID => _model.ExtendedDSiHeader?.TitleID;
2023-09-12 17:12:23 -04:00
#else
public byte[]? TitleID => _model.ExtendedDSiHeader?.TitleID;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.DSiWarePublicSavSize"/>
2023-09-11 23:25:09 -04:00
public uint? DSiWarePublicSavSize => _model.ExtendedDSiHeader?.DSiWarePublicSavSize;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.DSiWarePrivateSavSize"/>
2023-09-11 23:25:09 -04:00
public uint? DSiWarePrivateSavSize => _model.ExtendedDSiHeader?.DSiWarePrivateSavSize;
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ReservedZero"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] ReservedZero => _model.ExtendedDSiHeader?.ReservedZero;
2023-09-12 17:12:23 -04:00
#else
public byte[]? ReservedZero => _model.ExtendedDSiHeader?.ReservedZero;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.Unknown2"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] Unknown2 => _model.ExtendedDSiHeader?.Unknown2;
2023-09-12 17:12:23 -04:00
#else
public byte[]? Unknown2 => _model.ExtendedDSiHeader?.Unknown2;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ARM9WithSecureAreaSHA1HMACHash"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] ARM9WithSecureAreaSHA1HMACHash => _model.ExtendedDSiHeader?.ARM9WithSecureAreaSHA1HMACHash;
2023-09-12 17:12:23 -04:00
#else
public byte[]? ARM9WithSecureAreaSHA1HMACHash => _model.ExtendedDSiHeader?.ARM9WithSecureAreaSHA1HMACHash;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ARM7SHA1HMACHash"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] ARM7SHA1HMACHash => _model.ExtendedDSiHeader?.ARM7SHA1HMACHash;
2023-09-12 17:12:23 -04:00
#else
public byte[]? ARM7SHA1HMACHash => _model.ExtendedDSiHeader?.ARM7SHA1HMACHash;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.DigestMasterSHA1HMACHash"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] DigestMasterSHA1HMACHash => _model.ExtendedDSiHeader?.DigestMasterSHA1HMACHash;
2023-09-12 17:12:23 -04:00
#else
public byte[]? DigestMasterSHA1HMACHash => _model.ExtendedDSiHeader?.DigestMasterSHA1HMACHash;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.BannerSHA1HMACHash"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] BannerSHA1HMACHash => _model.ExtendedDSiHeader?.BannerSHA1HMACHash;
2023-09-12 17:12:23 -04:00
#else
public byte[]? BannerSHA1HMACHash => _model.ExtendedDSiHeader?.BannerSHA1HMACHash;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ARM9iDecryptedSHA1HMACHash"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] ARM9iDecryptedSHA1HMACHash => _model.ExtendedDSiHeader?.ARM9iDecryptedSHA1HMACHash;
2023-09-12 17:12:23 -04:00
#else
public byte[]? ARM9iDecryptedSHA1HMACHash => _model.ExtendedDSiHeader?.ARM9iDecryptedSHA1HMACHash;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ARM7iDecryptedSHA1HMACHash"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] ARM7iDecryptedSHA1HMACHash => _model.ExtendedDSiHeader?.ARM7iDecryptedSHA1HMACHash;
2023-09-12 17:12:23 -04:00
#else
public byte[]? ARM7iDecryptedSHA1HMACHash => _model.ExtendedDSiHeader?.ARM7iDecryptedSHA1HMACHash;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.Reserved5"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] Reserved5 => _model.ExtendedDSiHeader?.Reserved5;
2023-09-12 17:12:23 -04:00
#else
public byte[]? Reserved5 => _model.ExtendedDSiHeader?.Reserved5;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ARM9NoSecureAreaSHA1HMACHash"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] ARM9NoSecureAreaSHA1HMACHash => _model.ExtendedDSiHeader?.ARM9NoSecureAreaSHA1HMACHash;
2023-09-12 17:12:23 -04:00
#else
public byte[]? ARM9NoSecureAreaSHA1HMACHash => _model.ExtendedDSiHeader?.ARM9NoSecureAreaSHA1HMACHash;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.Reserved6"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] Reserved6 => _model.ExtendedDSiHeader?.Reserved6;
2023-09-12 17:12:23 -04:00
#else
public byte[]? Reserved6 => _model.ExtendedDSiHeader?.Reserved6;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.ReservedAndUnchecked"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] ReservedAndUnchecked => _model.ExtendedDSiHeader?.ReservedAndUnchecked;
2023-09-12 17:12:23 -04:00
#else
public byte[]? ReservedAndUnchecked => _model.ExtendedDSiHeader?.ReservedAndUnchecked;
#endif
2023-01-06 23:39:32 -08:00
2023-01-06 23:48:26 -08:00
/// <inheritdoc cref="Models.Nitro.ExtendedDSiHeader.RSASignature"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] RSASignature => _model.ExtendedDSiHeader?.RSASignature;
2023-09-12 17:12:23 -04:00
#else
public byte[]? RSASignature => _model.ExtendedDSiHeader?.RSASignature;
#endif
2023-01-06 23:39:32 -08:00
#endregion
#region Secure Area
/// <inheritdoc cref="Models.Nitro.Cart.SecureArea"/>
2023-09-12 17:12:23 -04:00
#if NET48
2023-09-11 23:25:09 -04:00
public byte[] SecureArea => _model.SecureArea;
2023-09-12 17:12:23 -04:00
#else
public byte[]? SecureArea => _model.SecureArea;
#endif
2023-01-06 23:39:32 -08:00
#endregion
2023-01-08 10:24:27 -08:00
#region Name Table
/// <inheritdoc cref="Models.Nitro.NameTable.FolderAllocationTable"/>
#if NET48
2023-09-11 23:25:09 -04:00
public SabreTools.Models.Nitro.FolderAllocationTableEntry[] FolderAllocationTable => _model.NameTable.FolderAllocationTable;
#else
2023-09-13 00:08:11 -04:00
public SabreTools.Models.Nitro.FolderAllocationTableEntry?[]? FolderAllocationTable => _model.NameTable?.FolderAllocationTable;
#endif
2023-01-08 10:24:27 -08:00
/// <inheritdoc cref="Models.Nitro.NameTable.NameList"/>
#if NET48
2023-09-11 23:25:09 -04:00
public SabreTools.Models.Nitro.NameListEntry[] NameList => _model.NameTable.NameList;
#else
2023-09-13 00:08:11 -04:00
public SabreTools.Models.Nitro.NameListEntry?[]? NameList => _model.NameTable?.NameList;
#endif
2023-01-08 10:24:27 -08:00
#endregion
2023-01-13 14:04:21 -08:00
#region File Allocation Table
2023-01-08 10:24:27 -08:00
/// <inheritdoc cref="Models.Nitro.Cart.FileAllocationTable"/>
#if NET48
2023-09-11 23:25:09 -04:00
public SabreTools.Models.Nitro.FileAllocationTableEntry[] FileAllocationTable => _model.FileAllocationTable;
#else
public SabreTools.Models.Nitro.FileAllocationTableEntry?[]? FileAllocationTable => _model.FileAllocationTable;
#endif
2023-01-08 10:24:27 -08:00
#endregion
2023-01-06 23:39:32 -08:00
#endregion
#region Constructors
2023-09-11 23:25:09 -04:00
/// <inheritdoc/>
#if NET48
public Nitro(SabreTools.Models.Nitro.Cart model, byte[] data, int offset)
#else
public Nitro(SabreTools.Models.Nitro.Cart? model, byte[]? data, int offset)
#endif
: base(model, data, offset)
{
// All logic is handled by the base class
}
/// <inheritdoc/>
#if NET48
public Nitro(SabreTools.Models.Nitro.Cart model, Stream data)
#else
public Nitro(SabreTools.Models.Nitro.Cart? model, Stream? data)
#endif
: base(model, data)
{
// All logic is handled by the base class
}
2023-01-06 23:39:32 -08:00
/// <summary>
/// Create a NDS cart image from a byte array and offset
/// </summary>
/// <param name="data">Byte array representing the archive</param>
/// <param name="offset">Offset within the array to parse</param>
/// <returns>A NDS cart image wrapper on success, null on failure</returns>
2023-09-12 17:12:23 -04:00
#if NET48
2023-01-06 23:39:32 -08:00
public static Nitro Create(byte[] data, int offset)
2023-09-12 17:12:23 -04:00
#else
public static Nitro? Create(byte[]? data, int offset)
#endif
2023-01-06 23:39:32 -08:00
{
// If the data is invalid
if (data == null)
return null;
// If the offset is out of bounds
if (offset < 0 || offset >= data.Length)
return null;
// Create a memory stream and use that
MemoryStream dataStream = new MemoryStream(data, offset, data.Length - offset);
return Create(dataStream);
}
/// <summary>
/// Create a NDS cart image from a Stream
/// </summary>
/// <param name="data">Stream representing the archive</param>
/// <returns>A NDS cart image wrapper on success, null on failure</returns>
2023-09-12 17:12:23 -04:00
#if NET48
2023-01-06 23:39:32 -08:00
public static Nitro Create(Stream data)
2023-09-12 17:12:23 -04:00
#else
public static Nitro? Create(Stream? data)
#endif
2023-01-06 23:39:32 -08:00
{
// If the data is invalid
if (data == null || data.Length == 0 || !data.CanSeek || !data.CanRead)
return null;
2023-09-10 23:51:38 -04:00
var archive = new SabreTools.Serialization.Streams.Nitro().Deserialize(data);
2023-01-06 23:39:32 -08:00
if (archive == null)
return null;
2023-09-11 23:25:09 -04:00
try
{
return new Nitro(archive, data);
}
catch
2023-01-06 23:39:32 -08:00
{
2023-09-11 23:25:09 -04:00
return null;
}
2023-01-06 23:39:32 -08:00
}
#endregion
#region Printing
/// <inheritdoc/>
2023-01-13 14:04:21 -08:00
public override StringBuilder PrettyPrint()
2023-01-06 23:39:32 -08:00
{
2023-01-13 14:04:21 -08:00
StringBuilder builder = new StringBuilder();
2023-09-15 00:47:44 -04:00
Printing.Nitro.Print(builder, _model);
2023-01-13 14:04:21 -08:00
return builder;
2023-01-06 23:39:32 -08:00
}
#if NET6_0_OR_GREATER
/// <inheritdoc/>
2023-09-11 23:25:09 -04:00
public override string ExportJSON() => System.Text.Json.JsonSerializer.Serialize(_model, _jsonSerializerOptions);
#endif
2023-01-06 23:39:32 -08:00
#endregion
}
}