diff --git a/BizHawk.MultiClient/Global.cs b/BizHawk.MultiClient/Global.cs index 57af6d9d1c..ce368f2046 100644 --- a/BizHawk.MultiClient/Global.cs +++ b/BizHawk.MultiClient/Global.cs @@ -120,6 +120,12 @@ namespace BizHawk.MultiClient {"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"Button", "B"} } }, + { + "Atari 7800 ProLine Joystick Controller", new Dictionary() + { + {"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"Trigger", "1"}, {"Trigger 2", "2"} + } + }, { "Commodore 64 Controller", new Dictionary() { @@ -150,6 +156,7 @@ namespace BizHawk.MultiClient public static readonly Dictionary> COMMANDS = new Dictionary>() { {"Atari 2600 Basic Controller", new Dictionary() {{"Reset", "r"}, {"Select", "s"}}}, + {"Atari 7800 ProLine Joystick Controller", new Dictionary() {{"Reset", "r"}, {"Select", "s"}}}, {"Gameboy Controller", new Dictionary() {{"Power", "P"}}}, {"GBA Controller", new Dictionary() {{"Power", "P"}}}, {"Genesis 3-Button Controller", new Dictionary() {{"Reset", "r"}}}, @@ -163,7 +170,7 @@ namespace BizHawk.MultiClient public static readonly Dictionary PLAYERS = new Dictionary() { {"Gameboy Controller", 1}, {"GBA Controller", 1}, {"Genesis 3-Button Controller", 2}, {"NES Controller", 4}, - {"SNES Controller", 4}, {"PC Engine Controller", 5}, {"SMS Controller", 2}, {"TI83 Controller", 1}, {"Atari 2600 Basic Controller", 2}, + {"SNES Controller", 4}, {"PC Engine Controller", 5}, {"SMS Controller", 2}, {"TI83 Controller", 1}, {"Atari 2600 Basic Controller", 2}, {"Atari 7800 ProLine Joystick Controller", 2}, {"ColecoVision Basic Controller", 2}, {"Commodore 64 Controller", 2} }; diff --git a/BizHawk.MultiClient/movie/InputAdapters.cs b/BizHawk.MultiClient/movie/InputAdapters.cs index 38664f92d8..1d11858a72 100644 --- a/BizHawk.MultiClient/movie/InputAdapters.cs +++ b/BizHawk.MultiClient/movie/InputAdapters.cs @@ -340,6 +340,8 @@ namespace BizHawk.MultiClient return "|.|"; case "A26": return "|..|.....|.....|"; + case "A78": + return "|..|......|......|"; case "TI83": return "|..................................................|.|"; case "NES": @@ -448,6 +450,24 @@ namespace BizHawk.MultiClient return input.ToString(); } + private string GetA78ControllersAsMnemonic() + { + StringBuilder input = new StringBuilder("|"); + input.Append(IsBasePressed("Reset") ? "r" : "."); + input.Append(IsBasePressed("Select") ? "s" : "."); + + for (int player = 1; player <= Global.PLAYERS[ControlType]; player++) + { + foreach (string button in Global.BUTTONS[ControlType].Keys) + { + input.Append(IsBasePressed("P" + player + " " + button) ? Global.BUTTONS[ControlType][button] : "."); + } + input.Append('|'); + } + + return input.ToString(); + } + public string GetControllersAsMnemonic() { if (ControlType == "Null Controller") @@ -456,7 +476,7 @@ namespace BizHawk.MultiClient } else if (ControlType == "Atari 7800 ProLine Joystick Controller") { - return "|.|"; //TODO + return GetA78ControllersAsMnemonic(); } else if (ControlType == "SNES Controller") { @@ -783,7 +803,42 @@ namespace BizHawk.MultiClient Force("P" + player + " " + button, c[srcindex + start++]); } } + } + private void SetAtari7800AsMnemonic(string mnemonic) + { + MnemonicChecker c = new MnemonicChecker(mnemonic); + MyBoolButtons.Clear(); + + if (mnemonic.Length < 2) + { + return; + } + else if (mnemonic[1] == 'r') + { + Force("Reset", true); + } + else if (mnemonic[2] == 's') + { + Force("Select", true); + } + + + for (int player = 1; player <= Global.PLAYERS[ControlType]; player++) + { + int srcindex = (player - 1) * (Global.BUTTONS[ControlType].Count + 1); + + if (mnemonic.Length < srcindex + 4 + Global.BUTTONS[ControlType].Count - 1) + { + return; + } + + int start = 3; + foreach (string button in Global.BUTTONS[ControlType].Keys) + { + Force("P" + player + " " + button, c[srcindex + start++]); + } + } } private void SetC64ControllersAsMnemonic(string mnemonic) @@ -839,6 +894,10 @@ namespace BizHawk.MultiClient SetGBAControllersAsMnemonic(mnemonic); return; } + else if (ControlType == "Atari 7800 ProLine Joystick Controller") + { + SetAtari7800AsMnemonic(mnemonic); + } MnemonicChecker c = new MnemonicChecker(mnemonic);