using System;
using System.Collections.Generic;
namespace NESDecompiler.Core.ROM
{
///
/// Mirroring types for NES hardware
///
public enum MirroringType
{
Horizontal,
Vertical,
FourScreen
}
///
/// Contains information about a loaded NES ROM
///
public class ROMInfo
{
///
/// Size of the PRG ROM in bytes
///
public int PRGROMSize { get; set; }
///
/// Size of the CHR ROM in bytes
///
public int CHRROMSize { get; set; }
///
/// Mapper number
///
public byte MapperNumber { get; set; }
///
/// Type of mirroring used
///
public MirroringType MirroringType { get; set; }
///
/// Whether the ROM has battery-backed RAM
///
public bool HasBatteryBackedRAM { get; set; }
///
/// Whether the ROM has a trainer
///
public bool HasTrainer { get; set; }
///
/// Whether the ROM uses four-screen VRAM
///
public bool HasFourScreenVRAM { get; set; }
///
/// Whether the ROM is a VS System cartridge
///
public bool IsVSSystemCart { get; set; }
///
/// Offset of the PRG ROM in the file
///
public int PRGROMOffset { get; set; }
///
/// Offset of the CHR ROM in the file
///
public int CHRROMOffset { get; set; }
///
/// The Reset Vector (entry point) address
///
public ushort ResetVector { get; set; }
///
/// The NMI handler address
///
public ushort NmiVector { get; set; }
///
/// The IRQ handler address
///
public ushort IrqVector { get; set; }
///
/// The raw ROM data for reference
///
public byte[]? RawData { get; set; }
///
/// List of identified entry points (including reset vector and NMI)
///
public HashSet EntryPoints { get; } = new HashSet();
///
/// Returns a string representation of the ROM information
///
public override string ToString()
{
return $"ROM Info:\n" +
$" PRG ROM: {PRGROMSize} bytes\n" +
$" CHR ROM: {CHRROMSize} bytes\n" +
$" Mapper: {MapperNumber}\n" +
$" Mirroring: {MirroringType}\n" +
$" Battery-Backed RAM: {HasBatteryBackedRAM}\n" +
$" Reset Vector: ${ResetVector:X4}";
}
}
}