BizHawk
BizHawk copied to clipboard
"Accept background input" Does not work with Lua Console / Lua Scripts
AcceptBackgroundInput_Test.zip
What steps will reproduce the problem?
- Open BizHawk, Tools -> Config -> Customize -> Check "Accept background input"
- Open a ROM and then switch focus to another application and hit frame advance hotkey and note that BizHawk does still respond
- Open the Lua Console and keep focus on the console, hit frame advance hotkey. BizHawk does not respond
- Run any Lua script that creates a window (example attached) and keep focus on the window, hit frame advance hotkey. BizHawk does not respond
What is the expected output? What do you see instead? Expected: BizHawk would respond to input when focus is on Lua Console or Lua Script (Ideally there would even be an option to "Accept background input from any BizHawk-generated window" or something to that effect. But at least it would be good to have the current option function across BizHawk generated windows. Actual: BizHawk does not respond to input when focus is on Lua Console or Lua Script
What version of the product are you using? On what operating system? Emuhawk 1.11.6 on Windows 10
I dont' think it should be expected at all that "Accept background input" works on tool dialogs of bizhawk itself. Each tool has to decide to accept mainform input. Tools like tastudio do this (and it is a very tricky thing to consider). If I could edit this ticket I would change it to request mainform input on the lua console and lua created dialogs.
Persists in 2.3.1. Easiest "solution" is to change When this is set, the client will receive user input even when focus is lost
to When this is set, the client will receive keyboard and controller input when another program is focused
, or similar, and close as wontfix.
Is there a way to configure an external tool to ignore controller input and let the client handle it normally?
Not sure. You can definitely do it with a hack: overwrite MainFormInputAllowedCallback
on the global Input.Instance
(usually set once on program launch here) to add IExternalToolForm
to the allowlist (here).
The hack has become a feature (as of 7596b9721). Have your ext. tool form inherit FormBase
and override BlocksInputWhenFocused
, like Virtual Pads does (though see #3087 for why this naïve implementation had to be replaced):
https://github.com/TASEmulators/BizHawk/blob/7596b9721855d1a36b47d8f26bdb08a1a163c052/src/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs#L25
Back on-topic, the Lua Console could override BlocksInputWhenFocused
with something that returns true
when the console textbox, script list, or menu bar is focused, but... that sounds really hard. I think we should wontfix this issue.
Open for 7 years? Yeah let's close wontfix
Hotkeys are broken in other ways too, even on Windows... It's just hard to do this right with WinForms. Remember also the mouse isn't passed through (the prop should be BlocksKeyEventsWhenFocused
I guess).
I'll be changing the setting's description as above.