diff --git a/BizHawk.MultiClient/Global.cs b/BizHawk.MultiClient/Global.cs index be58378778..2a1633ba91 100644 --- a/BizHawk.MultiClient/Global.cs +++ b/BizHawk.MultiClient/Global.cs @@ -109,6 +109,12 @@ namespace BizHawk.MultiClient {"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"Button", "B"} } }, + { + "Commodore 64 Controller", new Dictionary() + { + {"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"Button", "B"} + } + }, { "ColecoVision Basic Controller", new Dictionary() { @@ -136,7 +142,7 @@ namespace BizHawk.MultiClient {"Gameboy 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}, - {"ColecoVision Basic 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 c731ce8532..369aaf943f 100644 --- a/BizHawk.MultiClient/movie/InputAdapters.cs +++ b/BizHawk.MultiClient/movie/InputAdapters.cs @@ -360,6 +360,8 @@ namespace BizHawk.MultiClient return "|.|........|........|........|........|........|"; case "Coleco": return "|..................|..................|"; + case "C64": + return "|.....|.....|..................................................................|"; } } @@ -386,7 +388,6 @@ namespace BizHawk.MultiClient { foreach (string button in Global.BUTTONS[ControlType].Keys) { - input.Append(IsBasePressed("P" + player + " " + button) ? Global.BUTTONS[ControlType][button] : "."); } input.Append("|"); @@ -397,7 +398,18 @@ namespace BizHawk.MultiClient private string GetC64ControllersAsMnemonic() { - return ""; //TODO + StringBuilder input = new StringBuilder("|"); + + 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() @@ -713,9 +725,27 @@ namespace BizHawk.MultiClient } - private void SetSNESControllersAsMnemonic() + private void SetC64ControllersAsMnemonic(string mnemonic) { - //TODO + MnemonicChecker c = new MnemonicChecker(mnemonic); + MyBoolButtons.Clear(); + + + for (int player = 1; player <= Global.PLAYERS[ControlType]; player++) + { + int srcindex = (player - 1) * (Global.BUTTONS[ControlType].Count + 1); + + if (mnemonic.Length < srcindex + 1 + Global.BUTTONS[ControlType].Count - 1) + { + return; + } + + int start = 1; + foreach (string button in Global.BUTTONS[ControlType].Keys) + { + Force("P" + player + " " + button, c[srcindex + start++]); + } + } } /// @@ -734,7 +764,7 @@ namespace BizHawk.MultiClient } else if (ControlType == "Commodore 64 Controller") { - SetSNESControllersAsMnemonic(); + SetC64ControllersAsMnemonic(mnemonic); return; }