public static bool Exists(Rom rom, string path) { throw new NotImplementedException( ); }
public static FileStream Open(Rom rom, string path) { throw new NotImplementedException( ); }
private static void _LoadHeaderData(Rom rom, Stream stream) { var reader = new BinaryReader(stream); reader.BaseStream.Seek(0L, SeekOrigin.Begin); rom.ShortTitle = Encoding.ASCII.GetString(reader.ReadBytes(12)); rom.GameCode = Encoding.ASCII.GetString(reader.ReadBytes(4)); rom.MakerCode = MakerCodes.FromBytes(reader.ReadBytes(2)); rom.SupportedDevices = _GetSupportedDevices(reader.ReadByte( )); rom.EncryptionSeed = reader.ReadByte( ); rom.DeviceCapacity = reader.ReadByte( ); reader.ReadBytes(9); // 9 bytes reserved at 015h rom.Version = reader.ReadByte( ); rom.AutoStart = reader.ReadBoolean( ); /// Read the basic info of the Arm9 Chip. rom._arm9 = new RomChipInfo { RomOffset = reader.ReadUInt32( ), EntryAddress = reader.ReadUInt32( ), RamAddress = reader.ReadUInt32( ), Size = reader.ReadUInt32( ), }; /// Read the basic info of the Arm7 Chip. rom._arm7 = new RomChipInfo { RomOffset = reader.ReadUInt32( ), EntryAddress = reader.ReadUInt32( ), RamAddress = reader.ReadUInt32( ), Size = reader.ReadUInt32( ), }; /// TODO: File Name/Allocation Table Reads... reader.ReadUInt32( ); reader.ReadUInt32( ); reader.ReadUInt32( ); reader.ReadUInt32( ); reader.ReadUInt32( ); // Port 40001A4h setting for normal commands (usually 00586000h) reader.ReadUInt32( ); // Port 40001A4h setting for KEY1 commands (usually 001808F8h) rom._iconTitleOffset = reader.ReadUInt32( ); rom.SecureAreaChecksum = reader.ReadUInt16( ); rom.SecureAreaDelay = reader.ReadUInt16( ); rom._arm9.AutoLoadListRamAddress = reader.ReadUInt32( ); rom._arm7.AutoLoadListRamAddress = reader.ReadUInt32( ); // 8 Secure Area Disable (by encrypted "NmMdOnly") (usually zero) // 4 Total Used ROM size (remaining/unused bytes usually FFh-padded) // 4 ROM Header Size (4000h) // 38h Reserved (zero filled) // 9Ch Nintendo Logo (compressed bitmap, same as in GBA Headers) // 2 Nintendo Logo Checksum, CRC-16 of [0C0h-15Bh], fixed CF56h // 2 Header Checksum, CRC-16 of [000h-15Dh] // 4 Debug rom_offset (0=none) (8000h and up) ;only if debug // 4 Debug size (0=none) (max 3BFE00h) ;version with // 4 Debug ram_address (0=none) (2400000h..27BFE00h) ;SIO and 8MB // 4 Reserved (zero filled) (transferred, and stored, but not used) // 90h Reserved (zero filled) (transferred, but not stored in RAM) }