private static bool DetectPal(GameInfo game, byte[] rom) { // force NTSC mode for the new core we instantiate var newgame = game.Clone(); if (newgame["PAL"]) { newgame.RemoveOption("PAL"); } if (!newgame["NTSC"]) { newgame.AddOption("NTSC"); } // give the emu a minimal of input\output connections so it doesn't crash var comm = new CoreComm(null, null); using (Atari2600 emu = new Atari2600(new CoreComm(null, null), newgame, rom, null, null)) { emu.Controller = new NullController(); List <int> framecounts = new List <int>(); emu._tia.FrameEndCallBack = (i) => framecounts.Add(i); for (int i = 0; i < 71; i++) // run for 71 * 262 lines, since we're in NTSC mode { emu.FrameAdvance(false, false); } int numpal = framecounts.Count((i) => i > 287); bool pal = numpal >= 25; Console.WriteLine("PAL Detection: {0} lines, {1}", numpal, pal); return(pal); } }
private static bool DetectPal(GameInfo game, byte[] rom) { // force NTSC mode for the new core we instantiate var newGame = game.Clone(); if (newGame["PAL"]) { newGame.RemoveOption("PAL"); } if (!newGame["NTSC"]) { newGame.AddOption("NTSC", ""); } // here we advance past start up irregularities to see how long a frame is based on calls to Vsync // we run 72 frames, then run 270 scanlines worth of cycles. // if we don't hit a new frame, we can be pretty confident we are in PAL using var emu = new Atari2600(newGame, rom, null, null); for (int i = 0; i < 72; i++) { emu.FrameAdvance(NullController.Instance, false, false); } for (int i = 0; i < 61560; i++) { emu.Cycle(); } bool pal = !emu._tia.New_Frame; Console.WriteLine("PAL Detection: {0}", pal); return(pal); }
public TIA(Atari2600 core, bool pal, bool secam) { _core = core; _player0.ScanCnt = 8; _player1.ScanCnt = 8; _pal = pal; SetSECAM(secam); }
static MapperBase SetMultiCartMapper(Atari2600 core, int romLength, int gameTotal) { return((romLength / gameTotal) switch { 1024 * 2 => new Multicart2K(core, gameTotal), 1024 * 4 => new Multicart4K(core, gameTotal), 1024 * 8 => new Multicart8K(core, gameTotal), _ => new Multicart4K(core, gameTotal) });
public M6532(Atari2600 core) { _core = core; // Apparently starting the timer at 0 will break for some games (Solaris and H.E.R.O.). To avoid that, we pick an // arbitrary value to start with. Timer.Value = 0x73; Timer.PrescalerShift = 10; Timer.PrescalerCount = 1 << Timer.PrescalerShift; }
public TIA(Atari2600 core, bool pal, bool secam) { _core = core; _player0.ScanCnt = 8; _player1.ScanCnt = 8; _pal = pal; SetSecam(secam); CalcFrameRate(); _spf = _vsyncNum / (double)_vsyncDen > 55.0 ? 735 : 882; }
public mF6(Atari2600 core) : base(core) { }
public mF8_sega(Atari2600 core) : base(core) { }
public mAR(Atari2600 core) { Core = core; InitializeSettings(); }
public m4A50(Atari2600 core) : base(core) { }
protected MapperBase(Atari2600 core) { Core = core; }
public CpuLink(Atari2600 atari2600) { _atari2600 = atari2600; }
public m3F(Atari2600 core) : base(core) { }
public mDPC(Atari2600 core) : base(core) { }
public mAR(Atari2600 core) : base(core) { InitializeSettings(); }
// TODO: PokeMem, and everything else public mDPCPlus(Atari2600 core) : base(core) { throw new NotImplementedException(); }
public mE7(Atari2600 core) : base(core) { }
public mSB(Atari2600 core) : base(core) { }
public Multicart4K(Atari2600 core, int gameTotal) : base(core) { _gameTotal = gameTotal; _currentGame = 0; }
public mF4SC(Atari2600 core) : base(core) { }
public mCV(Atari2600 core) : base(core) { }
public m0840(Atari2600 core) : base(core) { }
private static MapperBase CreateMapper(Atari2600 core, string mapperName, int romLength) {
public mUA(Atari2600 core) : base(core) { }
public mEFSC(Atari2600 core) : base(core) { }
private static bool DetectPal(GameInfo game, byte[] rom) { // force NTSC mode for the new core we instantiate var newgame = game.Clone(); if (newgame["PAL"]) newgame.RemoveOption("PAL"); if (!newgame["NTSC"]) newgame.AddOption("NTSC"); // give the emu a minimal of input\output connections so it doesn't crash var comm = new CoreComm(null, null); comm.InputCallback = new InputCallbackSystem(); using (Atari2600 emu = new Atari2600(new CoreComm(null, null), newgame, rom, null, null)) { emu.Controller = new NullController(); List<int> framecounts = new List<int>(); emu._tia.FrameEndCallBack = (i) => framecounts.Add(i); for (int i = 0; i < 71; i++) // run for 71 * 262 lines, since we're in NTSC mode emu.FrameAdvance(false, false); int numpal = framecounts.Count((i) => i > 287); bool pal = numpal >= 25; Console.WriteLine("PAL Detection: {0} lines, {1}", numpal, pal); return pal; } }