public static NesCartMapper Build(Nes nes, NesCartHeader header) { var mapperId = header.MapperNumber; var mapper = GetMapper(nes, mapperId); return(mapper); }
private static NesCartHeader ReadHeader(Span <byte> rom) { var fileId = rom.Slice(0, 4).ToArray(); if (!fileId.SequenceEqual(INES_FORMAT)) { throw new RomFormatException(String.Format("Unsupported ROM type: {0:X}{1:X}{2:X}{3:X}", fileId[0], fileId[1], fileId[2], fileId[3])); } var header = new NesCartHeader( fileId, rom[4], rom[5], rom[6], rom[7], rom[8], rom[9], rom[10], rom.Slice(11, 5).ToArray() ); if (header.isNes20) { throw new RomFormatException("iNES 2.0 currently unsupported"); } return(header); }
public NesCart( string filename, NesCartHeader header, byte[] prgRom, byte[] chrRom, byte[] expansionArea, NesCartMapper mapper ) { this.Filename = filename; this.Header = header; this.PrgRom = prgRom; this.ChrRom = chrRom; this.ExpansionArea = expansionArea; this.Mapper = mapper; }