void LoadRom(string filename) { byte[] rom = File.ReadAllBytes(filename); if ((rom[6] & 0x08) == 0x08) { CoreWrapper.setMirroringType(MirroringType.FourScreens); } else { CoreWrapper.setMirroringType((rom[6] & 0x01) == 0x01 ? MirroringType.Vertical : MirroringType.Horizontal); } int prgRamSize = rom[4] * 0x4000; int chrRamSize = rom[5] * 0x2000; byte[] prgRam = new byte[prgRamSize]; byte[] chrRam = new byte[chrRamSize]; Array.Copy(rom, 16, prgRam, 0, prgRamSize); Array.Copy(rom, 16 + prgRamSize, chrRam, 0, chrRamSize); if (prgRamSize == 0x4000) { Array.Resize(ref prgRam, 0x8000); Array.Copy(prgRam, 0, prgRam, 0x4000, 0x4000); } lock (_runLock) { Stop(); Reset(false); CoreWrapper.setMemoryState(MemoryType.ChrRam, chrRam); CoreWrapper.setMemoryState(MemoryType.PrgRam, prgRam); } }
void SetMirroring(MirroringType mirroringType) { mnuMirrorHorizontal.Checked = mirroringType == MirroringType.Horizontal; mnuMirrorVertical.Checked = mirroringType == MirroringType.Vertical; mnuMirrorScreenA.Checked = mirroringType == MirroringType.ScreenAOnly; mnuMirrorScreenB.Checked = mirroringType == MirroringType.ScreenBOnly; mnuMirrorFourScreens.Checked = mirroringType == MirroringType.FourScreens; CoreWrapper.setMirroringType(mirroringType); }