diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs index 1aeaed6933..eb4b1f49af 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs @@ -26,6 +26,13 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 private bool _frameStartPending = true; + private bool _leftDifficultySwitchPressed = false; + private bool _rightDifficultySwitchPressed = false; + + private bool _leftDifficultySwitchHeld = false; + private bool _rightDifficultySwitchHeld = false; + + internal byte BaseReadMemory(ushort addr) { addr = (ushort)(addr & 0x1FFF); @@ -390,6 +397,26 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 HardReset(); } + if (Controller["Toggle Left Difficulty"] && !_leftDifficultySwitchHeld) + { + _leftDifficultySwitchPressed ^= true; + _leftDifficultySwitchHeld = true; + } + else if (!Controller["Toggle Left Difficulty"]) + { + _leftDifficultySwitchHeld = false; + } + + if (Controller["Toggle Right Difficulty"] && !_rightDifficultySwitchHeld) + { + _rightDifficultySwitchPressed ^= true; + _rightDifficultySwitchHeld = true; + } + else if (!Controller["Toggle Right Difficulty"]) + { + _rightDifficultySwitchHeld = false; + } + _tia.BeginAudioFrame(); _frameStartPending = false; } @@ -468,8 +495,15 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 if (reset) { value &= 0xFE; } if (select) { value &= 0xFD; } if (SyncSettings.BW) { value &= 0xF7; } - if (SyncSettings.LeftDifficulty) { value &= 0xBF; } - if (SyncSettings.RightDifficulty) { value &= 0x7F; } + if (_leftDifficultySwitchPressed) + { + value &= 0xBF; + } + + if (_rightDifficultySwitchPressed) + { + value &= 0x7F; + } if (!peek) { diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs index ae221d9364..9ca2bdbf9a 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs @@ -37,6 +37,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 Settings = (A2600Settings)settings ?? new A2600Settings(); SyncSettings = (A2600SyncSettings)syncSettings ?? new A2600SyncSettings(); + _leftDifficultySwitchPressed = SyncSettings.LeftDifficulty; + _rightDifficultySwitchPressed = SyncSettings.RightDifficulty; + Rom = rom; _game = game; @@ -45,16 +48,16 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 game.AddOption("m", DetectMapper(rom)); } - if (Rom.HashSHA1() == "3A77DB43B6583E8689435F0F14AA04B9E57BDDED" || - Rom.HashSHA1() == "E986E1818E747BEB9B33CE4DFF1CDC6B55BDB620") - { - game.RemoveOption("m"); - game.AddOption("m", "F8_sega"); - } + if (Rom.HashSHA1() == "3A77DB43B6583E8689435F0F14AA04B9E57BDDED" || + Rom.HashSHA1() == "E986E1818E747BEB9B33CE4DFF1CDC6B55BDB620") + { + game.RemoveOption("m"); + game.AddOption("m", "F8_sega"); + } - Console.WriteLine("Game uses mapper " + game.GetOptionsDict()["m"]); - Console.WriteLine(Rom.HashSHA1()); - RebootCore(); + Console.WriteLine("Game uses mapper " + game.GetOptionsDict()["m"]); + Console.WriteLine(Rom.HashSHA1()); + RebootCore(); SetupMemoryDomains(); Tracer = new TraceBuffer { Header = Cpu.TraceHeader }; @@ -103,7 +106,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 { "P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Button", "P2 Up", "P2 Down", "P2 Left", "P2 Right", "P2 Button", - "Reset", "Select", "Power" + "Reset", "Select", "Power", "Toggle Left Difficulty", "Toggle Right Difficulty" } };