@@ -155,7 +155,7 @@ private static AutofireController BindToDefinitionAF(
155
155
/// <param name="processUnboundInput">Events that did not do anything are forwarded out here.
156
156
/// This allows things like Windows' standard alt hotkeys (for menu items) to be handled by the
157
157
/// caller if the input didn't alrady do something else.</param>
158
- public void ProcessInput ( IInputSource source , Func < string , bool > processHotkey , Config config , Action < InputEvent > processUnboundInput , Func < string , bool > isInternalHotkey )
158
+ public void ProcessInput ( IInputSource source , Func < string , bool > processHotkey , Config config , Action < InputEvent > processUnboundInput )
159
159
{
160
160
// loop through all available events
161
161
InputEvent ie ;
@@ -166,76 +166,33 @@ public void ProcessInput(IInputSource source, Func<string, bool> processHotkey,
166
166
167
167
// TODO - wonder what happens if we pop up something interactive as a response to one of these hotkeys? may need to purge further processing
168
168
169
- // look for hotkey bindings for this key
170
- var triggers = ClientControls . SearchBindings ( ie . LogicalButton . ToString ( ) ) ;
171
- if ( triggers . Count == 0 )
169
+ var hotkeyTriggers = ClientControls . SearchBindings ( ie . LogicalButton . ToString ( ) ) ;
170
+ bool isEmuInput = ie . LogicalButton . ToString ( ) . Split ( '+' ) . Any ( ActiveController . HasBinding ) ;
171
+
172
+ bool shouldDoHotkey = config . InputHotkeyOverrideOptions != 1 ;
173
+ bool shouldDoEmuInput = config . InputHotkeyOverrideOptions != 2 ;
174
+ if ( shouldDoEmuInput && ! isEmuInput ) shouldDoHotkey = true ;
175
+
176
+ bool didHotkey = false ;
177
+ if ( shouldDoHotkey )
172
178
{
173
- processUnboundInput ( ie ) ;
179
+ if ( ie . EventType is InputEventType . Press )
180
+ {
181
+ didHotkey = hotkeyTriggers . Aggregate ( false , ( current , trigger ) => current | processHotkey ( trigger ) ) ;
182
+ }
183
+ _hotkeyCoalescer . Receive ( ie ) ;
174
184
}
175
185
176
- switch ( config . InputHotkeyOverrideOptions )
186
+ if ( ! didHotkey ) shouldDoEmuInput = true ;
187
+ if ( shouldDoEmuInput )
177
188
{
178
- default :
179
- case 0 : // Both allowed
180
- {
181
- ControllerInputCoalescer . Receive ( ie ) ;
182
-
183
- var handled = false ;
184
- if ( ie . EventType is InputEventType . Press )
185
- {
186
- handled = triggers . Aggregate ( handled , ( current , trigger ) => current | processHotkey ( trigger ) ) ;
187
- }
188
-
189
- // hotkeys which aren't handled as actions get coalesced as pollable virtual client buttons
190
- if ( ! handled )
191
- {
192
- _hotkeyCoalescer . Receive ( ie ) ;
193
- }
194
-
195
- break ;
196
- }
197
- case 1 : // Input overrides Hotkeys
198
- {
199
- ControllerInputCoalescer . Receive ( ie ) ;
200
- if ( ! ie . LogicalButton . ToString ( ) . Split ( '+' ) . Any ( ActiveController . HasBinding ) )
201
- {
202
- var handled = false ;
203
- if ( ie . EventType is InputEventType . Press )
204
- {
205
- handled = triggers . Aggregate ( false , ( current , trigger ) => current | processHotkey ( trigger ) ) ;
206
- }
207
-
208
- // hotkeys which aren't handled as actions get coalesced as pollable virtual client buttons
209
- if ( ! handled )
210
- {
211
- _hotkeyCoalescer . Receive ( ie ) ;
212
- }
213
- }
214
-
215
- break ;
216
- }
217
- case 2 : // Hotkeys override Input
218
- {
219
- var handled = false ;
220
- if ( ie . EventType is InputEventType . Press )
221
- {
222
- handled = triggers . Aggregate ( false , ( current , trigger ) => current | processHotkey ( trigger ) ) ;
223
- }
224
-
225
- // hotkeys which aren't handled as actions get coalesced as pollable virtual client buttons
226
- if ( ! handled )
227
- {
228
- _hotkeyCoalescer . Receive ( ie ) ;
229
-
230
- // Check for hotkeys that may not be handled through processHotkey() method, reject controller input mapped to these
231
- if ( ! triggers . Exists ( ( t ) => isInternalHotkey ( t ) ) )
232
- {
233
- ControllerInputCoalescer . Receive ( ie ) ;
234
- }
235
- }
236
-
237
- break ;
238
- }
189
+ ControllerInputCoalescer . Receive ( ie ) ;
190
+ }
191
+ bool didEmuInput = shouldDoEmuInput ;
192
+
193
+ if ( ! didHotkey && ! didEmuInput )
194
+ {
195
+ processUnboundInput ( ie ) ;
239
196
}
240
197
} // foreach event
241
198
0 commit comments