From ead2d186cfcc491bc56fdf1af96773d7841d0355 Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 5 Sep 2012 02:24:03 +0000 Subject: [PATCH] SNES - hook up movie playback, probably, needs a frame counter to use it --- BizHawk.MultiClient/Global.cs | 2 +- BizHawk.MultiClient/movie/InputAdapters.cs | 36 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/BizHawk.MultiClient/Global.cs b/BizHawk.MultiClient/Global.cs index 45a5508a24..7217f369b0 100644 --- a/BizHawk.MultiClient/Global.cs +++ b/BizHawk.MultiClient/Global.cs @@ -121,7 +121,7 @@ namespace BizHawk.MultiClient {"Gameboy Controller", new Dictionary() {}}, {"Genesis 3-Button Controller", new Dictionary() {}}, {"NES Controller", new Dictionary() {{"Reset", "r"}}}, - {"SNES Controller", new Dictionary() {{"Lag", "l"}, {"Reset", "r"}}}, + {"SNES Controller", new Dictionary() {{"Reset", "r"}}}, {"PC Engine Controller", new Dictionary() {}}, {"SMS Controller", new Dictionary() {{"Pause", "p"}, {"Reset", "r"}}}, {"TI83 Controller", new Dictionary() {}} diff --git a/BizHawk.MultiClient/movie/InputAdapters.cs b/BizHawk.MultiClient/movie/InputAdapters.cs index 74add5056d..bfe8c10ae4 100644 --- a/BizHawk.MultiClient/movie/InputAdapters.cs +++ b/BizHawk.MultiClient/movie/InputAdapters.cs @@ -431,13 +431,49 @@ namespace BizHawk.MultiClient } } + //Redundancy beats crazy if logic that makes new consoles annoying to add + private void SetSNESControllersAsMnemonic(string mnemonic) + { + MnemonicChecker c = new MnemonicChecker(mnemonic); + MyBoolButtons.Clear(); + + if (mnemonic.Length < 2) + { + return; + } + + Force("Reset", mnemonic[1] != '.' && mnemonic[1] != '0' && mnemonic[1] != 'l'); + for (int player = 1; player <= Global.PLAYERS[ControlType]; player++) + { + int srcindex = (player - 1) * (Global.BUTTONS[ControlType].Count + 1); + + if (mnemonic.Length < srcindex + 3 + Global.BUTTONS[ControlType].Count - 1) + { + return; + } + + int start = 3; + foreach (string button in Global.BUTTONS[ControlType].Keys) + { + Force("P" + player + " " + button, c[srcindex + start++]); + } + } + + } + /// /// latches all buttons from the supplied mnemonic string /// public void SetControllersAsMnemonic(string mnemonic) { if (Global.Emulator.SystemId == "NULL" || ControlType == "Null Controller") + { return; + } + else if (Global.Emulator.SystemId == "SNES") + { + SetSNESControllersAsMnemonic(mnemonic); + } MnemonicChecker c = new MnemonicChecker(mnemonic); MyBoolButtons.Clear();