Atari 2600 - add console buttons for toggling Difficulty switches. Note that this commit may or may not break both movie and savestate backwards compatibility

This commit is contained in:
adelikat 2016-11-11 15:28:21 -06:00
parent 82c1c11879
commit 333e17a054
2 changed files with 49 additions and 12 deletions

View File

@ -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)
{

View File

@ -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"
}
};