Implemented a system for controller vs hotkey conflicts. There is now a key priority option in the config menu, either controller input can override hotkeys, hotkeys can override input, or both can happen.
This commit is contained in:
parent
046e3244ce
commit
f6afda4ed8
|
@ -211,6 +211,7 @@ namespace BizHawk.MultiClient
|
|||
public string FFMpegPath = "%exe%/dll/ffmpeg.exe";
|
||||
|
||||
// General Client Settings
|
||||
public int Input_Hotkey_OverrideOptions = 0;
|
||||
public bool StackOSDMessages = true;
|
||||
public int TargetZoomFactor = 2;
|
||||
public int TargetDisplayFilter = 0;
|
||||
|
|
|
@ -44,6 +44,22 @@ namespace BizHawk.MultiClient
|
|||
return ret;
|
||||
}
|
||||
|
||||
//Searches bindings for the controller and returns true if this binding is mapped somewhere in this controller
|
||||
public bool HasBinding(string button)
|
||||
{
|
||||
foreach (var kvp in bindings)
|
||||
{
|
||||
foreach (var bound_button in kvp.Value)
|
||||
{
|
||||
if (bound_button == button)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// uses the bindings to latch our own logical button state from the source controller's button state (which are assumed to be the physical side of the binding).
|
||||
/// this will clobber any existing data (use OR_* or other functions to layer in additional input sources)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2269,21 +2269,68 @@ namespace BizHawk.MultiClient
|
|||
|
||||
//zero 09-sep-2012 - all input is eligible for controller input. not sure why the above was done.
|
||||
//maybe because it doesnt make sense to me to bind hotkeys and controller inputs to the same keystrokes
|
||||
Global.ControllerInputCoalescer.Receive(ie);
|
||||
|
||||
bool handled = false;
|
||||
if (ie.EventType == Input.InputEventType.Press)
|
||||
|
||||
//adelikat 02-dec-2012 - implemented options for how to handle controller vs hotkey conflicts. This is primarily motivated by computer emulation and thus controller being nearly the entire keyboard
|
||||
bool handled;
|
||||
switch (Global.Config.Input_Hotkey_OverrideOptions)
|
||||
{
|
||||
foreach (var trigger in triggers)
|
||||
{
|
||||
handled |= CheckHotkey(trigger);
|
||||
}
|
||||
}
|
||||
default:
|
||||
case 0: //Both allowed
|
||||
Global.ControllerInputCoalescer.Receive(ie);
|
||||
|
||||
//hotkeys which arent handled as actions get coalesced as pollable virtual client buttons
|
||||
if (!handled)
|
||||
{
|
||||
Global.HotkeyCoalescer.Receive(ie);
|
||||
handled = false;
|
||||
if (ie.EventType == Input.InputEventType.Press)
|
||||
{
|
||||
foreach (var trigger in triggers)
|
||||
{
|
||||
handled |= CheckHotkey(trigger);
|
||||
}
|
||||
}
|
||||
|
||||
//hotkeys which arent handled as actions get coalesced as pollable virtual client buttons
|
||||
if (!handled)
|
||||
{
|
||||
Global.HotkeyCoalescer.Receive(ie);
|
||||
}
|
||||
break;
|
||||
case 1: //Input overrides Hokeys
|
||||
Global.ControllerInputCoalescer.Receive(ie);
|
||||
bool inputisbound = Global.ActiveController.HasBinding(ie.LogicalButton.ToString());
|
||||
if (!inputisbound)
|
||||
{
|
||||
handled = false;
|
||||
if (ie.EventType == Input.InputEventType.Press)
|
||||
{
|
||||
foreach (var trigger in triggers)
|
||||
{
|
||||
handled |= CheckHotkey(trigger);
|
||||
}
|
||||
}
|
||||
|
||||
//hotkeys which arent handled as actions get coalesced as pollable virtual client buttons
|
||||
if (!handled)
|
||||
{
|
||||
Global.HotkeyCoalescer.Receive(ie);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2: //Hotkeys override Input
|
||||
handled = false;
|
||||
if (ie.EventType == Input.InputEventType.Press)
|
||||
{
|
||||
foreach (var trigger in triggers)
|
||||
{
|
||||
handled |= CheckHotkey(trigger);
|
||||
}
|
||||
}
|
||||
|
||||
//hotkeys which arent handled as actions get coalesced as pollable virtual client buttons
|
||||
if (!handled)
|
||||
{
|
||||
Global.HotkeyCoalescer.Receive(ie);
|
||||
Global.ControllerInputCoalescer.Receive(ie);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
} //foreach event
|
||||
|
@ -4648,5 +4695,43 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
LoadGBAGPUView();
|
||||
}
|
||||
|
||||
private void bothHotkeysAndControllersToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.Input_Hotkey_OverrideOptions = 0;
|
||||
}
|
||||
|
||||
private void inputOverridesHotkeysToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.Input_Hotkey_OverrideOptions = 1;
|
||||
}
|
||||
|
||||
private void hotkeysOverrideInputToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.Input_Hotkey_OverrideOptions = 2;
|
||||
}
|
||||
|
||||
private void keyPriorityToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
switch (Global.Config.Input_Hotkey_OverrideOptions)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
bothHotkeysAndControllersToolStripMenuItem.Checked = true;
|
||||
inputOverridesHotkeysToolStripMenuItem.Checked = false;
|
||||
hotkeysOverrideInputToolStripMenuItem.Checked = false;
|
||||
break;
|
||||
case 1:
|
||||
bothHotkeysAndControllersToolStripMenuItem.Checked = false;
|
||||
inputOverridesHotkeysToolStripMenuItem.Checked = true;
|
||||
hotkeysOverrideInputToolStripMenuItem.Checked = false;
|
||||
break;
|
||||
case 2:
|
||||
bothHotkeysAndControllersToolStripMenuItem.Checked = false;
|
||||
inputOverridesHotkeysToolStripMenuItem.Checked = false;
|
||||
hotkeysOverrideInputToolStripMenuItem.Checked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue