diff --git a/src/BizHawk.Bizware.Input/HostInputType.cs b/src/BizHawk.Bizware.Input/HostInputType.cs index aa5bc21f06b..b0a45b7dbe5 100644 --- a/src/BizHawk.Bizware.Input/HostInputType.cs +++ b/src/BizHawk.Bizware.Input/HostInputType.cs @@ -10,5 +10,6 @@ public enum HostInputType Keyboard = 2, Pad = 4, Ignored = 8, + IPC = 16, } } diff --git a/src/BizHawk.Bizware.Input/IHostInputAdapter.cs b/src/BizHawk.Bizware.Input/IHostInputAdapter.cs index 4c006c6de79..13e8de6a62a 100644 --- a/src/BizHawk.Bizware.Input/IHostInputAdapter.cs +++ b/src/BizHawk.Bizware.Input/IHostInputAdapter.cs @@ -23,6 +23,7 @@ public interface IHostInputAdapter void ProcessHostGamepads(Action handleButton, Action handleAxis); IEnumerable ProcessHostKeyboards(); + IEnumerable ProcessHostIPC(); (int DeltaX, int DeltaY) ProcessHostMice(); diff --git a/src/BizHawk.Bizware.Input/OSTailoredKeyInputAdapter.cs b/src/BizHawk.Bizware.Input/OSTailoredKeyInputAdapter.cs index 761351d3b9e..92a6038dd73 100644 --- a/src/BizHawk.Bizware.Input/OSTailoredKeyInputAdapter.cs +++ b/src/BizHawk.Bizware.Input/OSTailoredKeyInputAdapter.cs @@ -1,7 +1,6 @@ #nullable enable using System.Collections.Generic; -using System.Linq; namespace BizHawk.Bizware.Input { @@ -41,7 +40,11 @@ public virtual IEnumerable ProcessHostKeyboards() } var ret = _keyMouseInput!.UpdateKeyInputs(_getHandleAlternateKeyboardLayouts()); - return ret.Concat(IPCKeyInput.Update()); + return ret; + } + public virtual IEnumerable ProcessHostIPC() + { + return IPCKeyInput.Update(); } public virtual (int DeltaX, int DeltaY) ProcessHostMice() diff --git a/src/BizHawk.Client.EmuHawk/Input/Input.cs b/src/BizHawk.Client.EmuHawk/Input/Input.cs index 072449a18dc..caf8988178b 100644 --- a/src/BizHawk.Client.EmuHawk/Input/Input.cs +++ b/src/BizHawk.Client.EmuHawk/Input/Input.cs @@ -228,6 +228,7 @@ private void UpdateThreadProc() UpdateModifierKeysEffective(); var keyEvents = Adapter.ProcessHostKeyboards(); + var ipcKeyEvents = Adapter.ProcessHostIPC(); var (mouseDeltaX, mouseDeltaY) = Adapter.ProcessHostMice(); Adapter.PreprocessHostGamepads(); @@ -239,6 +240,10 @@ private void UpdateThreadProc() { HandleButton(DistinctKeyNameOverrides.GetName(ke.Key), ke.Pressed, HostInputType.Keyboard); } + foreach (var ke in ipcKeyEvents) + { + HandleButton(DistinctKeyNameOverrides.GetName(ke.Key), ke.Pressed, HostInputType.IPC); + } lock (_axisValues) { @@ -315,7 +320,7 @@ private void UpdateThreadProc() private static bool ShouldSwallow(AllowInput allowInput, HostInputType inputFocus) { - return allowInput == AllowInput.None || (allowInput == AllowInput.OnlyController && inputFocus != HostInputType.Pad); + return (allowInput is AllowInput.None && inputFocus is not HostInputType.IPC) || (allowInput == AllowInput.OnlyController && inputFocus != HostInputType.Pad); } public void StartListeningForAxisEvents()