diff --git a/BizHawk.MultiClient/Global.cs b/BizHawk.MultiClient/Global.cs index 98ff2cd718..9cd8d12551 100644 --- a/BizHawk.MultiClient/Global.cs +++ b/BizHawk.MultiClient/Global.cs @@ -196,7 +196,7 @@ namespace BizHawk.MultiClient public static CopyControllerAdapter ControllerOutput = new CopyControllerAdapter(); //input state which has been destined for game controller inputs are coalesced here - public static InputCoalescer ControllerInputCoalescer = new InputCoalescer(); + public static ControllerInputCoalescer ControllerInputCoalescer = new ControllerInputCoalescer(); //input state which has been destined for client hotkey consumption are colesced here public static InputCoalescer HotkeyCoalescer = new InputCoalescer(); diff --git a/BizHawk.MultiClient/Input/Input.cs b/BizHawk.MultiClient/Input/Input.cs index 3a53dbe045..171225d23d 100644 --- a/BizHawk.MultiClient/Input/Input.cs +++ b/BizHawk.MultiClient/Input/Input.cs @@ -15,7 +15,39 @@ namespace BizHawk.MultiClient public void Receive(Input.InputEvent ie) { bool state = ie.EventType == Input.InputEventType.Press; - Buttons[ie.LogicalButton.ToString()] = state; + + string button = ie.LogicalButton.ToString(); + Buttons[button] = state; + + //when a button is released, all modified variants of it are released as well + if (!state) + { + var releases = Buttons.Where((kvp) => kvp.Key.Contains("+") && kvp.Key.EndsWith(ie.LogicalButton.Button)).ToArray(); + foreach (var kvp in releases) + Buttons[kvp.Key] = false; + } + } + } + + public class ControllerInputCoalescer : SimpleController + { + public void Receive(Input.InputEvent ie) + { + bool state = ie.EventType == Input.InputEventType.Press; + + string button = ie.LogicalButton.ToString(); + Buttons[button] = state; + + //For controller input, we want Shift+X to register as both Shift and X (for Keyboard controllers) + string[] subgroups = button.Split('+'); + if (subgroups != null && subgroups.Length > 0) + { + foreach (string s in subgroups) + { + Buttons[s] = state; + } + } + //when a button is released, all modified variants of it are released as well if (!state) { diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index f7cdb12ec7..bfbe24c54f 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -1530,7 +1530,7 @@ namespace BizHawk.MultiClient void RewireInputChain() { - Global.ControllerInputCoalescer = new InputCoalescer(); + Global.ControllerInputCoalescer = new ControllerInputCoalescer(); Global.ControllerInputCoalescer.Type = Global.ActiveController.Type;