diff --git a/BizHawk.MultiClient/Global.cs b/BizHawk.MultiClient/Global.cs index 79fea07660..8186948366 100644 --- a/BizHawk.MultiClient/Global.cs +++ b/BizHawk.MultiClient/Global.cs @@ -1,4 +1,5 @@ -using BizHawk.DiscSystem; +using System; +using BizHawk.DiscSystem; using System.Collections.Generic; #if WINDOWS using SlimDX.Direct3D9; @@ -192,6 +193,35 @@ namespace BizHawk.MultiClient {"ColecoVision Basic Controller", 2}, {"Commodore 64 Controller", 2} }; + // just experimenting with different possibly more painful ways to handle mnemonics + // |P|UDLRsSBA| + public static Tuple[] DGBMnemonic = new Tuple[] + { + new Tuple(null, '|'), + new Tuple("P1 Power", 'P'), + new Tuple(null, '|'), + new Tuple("P1 Up", 'U'), + new Tuple("P1 Down", 'D'), + new Tuple("P1 Left", 'L'), + new Tuple("P1 Right", 'R'), + new Tuple("P1 Select", 's'), + new Tuple("P1 Start", 'S'), + new Tuple("P1 B", 'B'), + new Tuple("P1 A", 'A'), + new Tuple(null, '|'), + new Tuple("P2 Power", 'P'), + new Tuple(null, '|'), + new Tuple("P2 Up", 'U'), + new Tuple("P2 Down", 'D'), + new Tuple("P2 Left", 'L'), + new Tuple("P2 Right", 'R'), + new Tuple("P2 Select", 's'), + new Tuple("P2 Start", 'S'), + new Tuple("P2 B", 'B'), + new Tuple("P2 A", 'A'), + new Tuple(null, '|') + }; + /// /// whether throttling is force-disabled by use of fast forward /// diff --git a/BizHawk.MultiClient/movie/InputAdapters.cs b/BizHawk.MultiClient/movie/InputAdapters.cs index 88a8159a81..feef43f1dc 100644 --- a/BizHawk.MultiClient/movie/InputAdapters.cs +++ b/BizHawk.MultiClient/movie/InputAdapters.cs @@ -433,6 +433,8 @@ namespace BizHawk.MultiClient return "|.|........|........|"; case "GB": return "|.|........|"; + case "DGB": + return "|.|........|.|........|"; case "PCE": case "PCECD": case "SGX": @@ -521,6 +523,22 @@ namespace BizHawk.MultiClient return input.ToString(); } + private string GetDualGameBoyControllerAsMnemonic() + { + // |.|........|.|........| + StringBuilder input = new StringBuilder(); + + foreach (var t in Global.DGBMnemonic) + { + if (t.Item1 != null) + input.Append(IsBasePressed(t.Item1) ? t.Item2 : '.'); + else + input.Append(t.Item2); // seperator + } + return input.ToString(); + } + + private string GetA78ControllersAsMnemonic() { StringBuilder input = new StringBuilder("|"); @@ -565,7 +583,7 @@ namespace BizHawk.MultiClient } else if (ControlType == "Dual Gameboy Controller") { - return "|.|"; // TODO + return GetDualGameBoyControllerAsMnemonic(); } StringBuilder input = new StringBuilder("|"); @@ -924,6 +942,18 @@ namespace BizHawk.MultiClient } } + private void SetDualGameBoyControllerAsMnemonic(string mnemonic) + { + MnemonicChecker c = new MnemonicChecker(mnemonic); + MyBoolButtons.Clear(); + for (int i = 0; i < Global.DGBMnemonic.Length; i++) + { + var t = Global.DGBMnemonic[i]; + if (t.Item1 != null) + Force(t.Item1, c[i]); + } + } + private void SetC64ControllersAsMnemonic(string mnemonic) { MnemonicChecker c = new MnemonicChecker(mnemonic); @@ -984,7 +1014,8 @@ namespace BizHawk.MultiClient } else if (ControlType == "Dual Gameboy Controller") { - return; // TODO + SetDualGameBoyControllerAsMnemonic(mnemonic); + return; } MnemonicChecker c = new MnemonicChecker(mnemonic);