Allow Shift + another key to register as Shift and that key separately on Controller input (not hotkey input), this allows the C64 keyboard to use shift as intended

This commit is contained in:
adelikat 2012-12-09 01:42:47 +00:00
parent 39606f7a0b
commit 9c8b79be4b
3 changed files with 35 additions and 3 deletions

View File

@ -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();

View File

@ -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)
{

View File

@ -1530,7 +1530,7 @@ namespace BizHawk.MultiClient
void RewireInputChain()
{
Global.ControllerInputCoalescer = new InputCoalescer();
Global.ControllerInputCoalescer = new ControllerInputCoalescer();
Global.ControllerInputCoalescer.Type = Global.ActiveController.Type;