New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keyboard shortcuts don't work #88
Comments
I am experiencing the same issue. In the latest two releases Also it's probably worth noting that the "Keyboardfixes" release also affects gamepads - without that fix, games that require multiple directions (e.g. any 8-direction RPG) are almost unplayable because the controls are crippled. |
I've been doing lots of work on the keyboard related code, I will try to look at this soon. |
I cannot reproduce this, in my msys2 built binary and the latest release shortcuts like CTRL+P and ALT+ENTER work fine. Can you make sure that you don't have any part of the shortcut mapped to a game key, e.g. if you mapped CTRL or P then CTRL+P will NOT work. Also can you please provide some details about your environment, whether you are using any special keyboard software like AutoHotKey etc. |
Well damn, I also cannot seem to reproduce it anymore. (Nvm read on. It's an issue with an INI setting?) Let me take a few steps back and analyze what I did: When I first tested the latest builds, everything seemed to work - i distinctly remember using keyboard shortcuts for reset and pause. Then I tried using save states in Mega Man V. It seemed to save fine, but upon loading, it corrupted the game. I thought maybe I was using an incompatible save state between versions. Or maybe it was an issue with i686 or x86-64 specifically. I couldn't determine exactly what was going on, but I knew that freshly created save states were failing to load on certain builds. Then, out of nowhere, keyboard shortcuts just stopped working. I found this bug and immediately related to it. And noticed that beta-3 worked fine. In fact, I can reproduce that fact: MMV save states work in beta-3 but not the newest two builds. I think it affects all SGB games.. they boot slowly and save states are corrupt when loaded. However I cannot reproduce the keyboard issue anymore. I did notice this, at the same time the bug occured: The key shortcut dialog has incorrect text labels. No clue if its related, but "Reset All" neither fixed it when it was broken (I tried that to see if it'd fix it), or causing it now. I think I was trying to associate keys using my gamepad using that key config dialog, specifically, save state on my gamepad. It didn't seem to work - is it possible that junk data was saved in config that invalidated all key shortcuts? Edit: I just reproduced the keyboard bug. Apparently I was right - I tried to associate Load State F1 to my gamepad, and CTRL+R doesn't work now. Here is the vba.ini: http://paste2.org/4xKtFU1N, hopefully it makes sense. I don't immediately see the problem in the ini. Also, like I mentioned, "Reset All" doesn't fix it. Also, beta-3 is indeed unaffected by whatever went wrong in the ini. Edit2: Is there VBA-M config anywhere else besides %AppData%/visualboyadvance-m/vba.ini? Deleting the ini doesn't fix the bug! It still occurs. |
@bryc thanks for the detailed info, I don't know what is going on here myself, it seems the shortcuts are not written to the |
@rkitover can you reproduce it? I have more information: CTRL+Q (Exit) and CTRL+O (Open) works when first starting the program, but once a game starts, it cannot be used anymore. It appears that all keyboard shortcuts get disabled. If the ROM is closed, the keyboard shortcuts seem to be usable again. I also noticed that when I unplug my controller and restart the emulator, the issue is nonexistent, I can use shortcuts when a ROM is loaded. In fact, when I unplug my controller, even when the emulator is currently running a game, it immediately lets me use keyboard shortcuts again. When I plug back my controller, keyboard shortcuts still work, but VBA-M cannot detect my controller or set gamepad inputs. (Edit: It seems when I close the input dialog and switch to game screen, it reinitializes my gamepad, and disables keyboard shortcuts again) When I re-open emulator with controller plugged in, it again disables keyboard shortcuts like before. User bindings are stored in the INI it seems, but somehow by using my gamepad in the keyboard shortcut window, something screws up possibly in Registry? Because deleting the vbam.ini doesn't fix the bug. An important question is: Does the Key Shortcut window react to gamepad input? Can pressing a gamepad key in any way affect something? |
@bryc yeah there may be some leftover cruft that writes to the registry, will need to investigate. It looks like the accel dialog uses wxKeyTextCtrl while the game key dialog uses wxJoyKeyTextCtrl, this is in the xrc. The widgets themselves are in src/wx/widgets I don't think the code itself has any support for binding accels that are not game keys to joystick controls because the joystick controls are done with SDL and handled separately. |
@rkitover Reading this has been very insightful. And @bryc, you are right about it working when the emulator hasn't loaded a game or has a controller in. UPDATE: I think I've found the problem! It has something to do with the default input for the Special controls (as you probably already know, the Input Configure option brings up a window with two tabs, "Standard" and "Special", along with tabs to select each player). Once I cleared the Special controls except for "Speed Up" and "Screenshot", I could use keyboard shortcuts once I restarted VBA-M. I hope this solution is universal and works for everybody. |
@BeyondTheHorizon I can reproduce it. It seems to work but reverts back if defaults are used again. I isolated "Joy1-Axis2-" as the culprit for me (default binding for Motion Down). It is the only binding that needs to be removed to invoke the workaround: Did the keyboard shortcuts ever work i.e. when you first started using the newest builds were keyboard shortcuts broken to begin with, or only after tinkering with settings? |
@bryc If it helps, the keyboard shortcuts were broken when I first started using the latest release. Oh, and out of curiosity, what does KP mean? Keypad? When I press 8 on the numeric keyboard, it says "KP_8" instead of "KP_UP", for example. |
I've figured out the exact culprit. It seems previous VBA-M versions were much less picky about controls. When a trigger is pressed past its halfway point, its value is registered under (for example) Joy1-Axis2+, whereas if it hasn't reached the halfway point yet, its value is registered as Joy1-Axis2-. This normally works fine, except this version of VBA-M has included not being pressed at all as being -, so when that state is registered to an action, the action will be consistently fired (unless the trigger is once again moved past its halfway point to untrigger the - action and instead trigger the + action). It also seems that when an action is continuously fired in this way, standard keyboard shortcuts like Alt+Enter and Ctrl+Q are disallowed from working. |
I'm also having issues with the shortcut keys in the latest release, it might be because of what you said (@kelpso) but I'm not really sure. Also the fact that it randomly works and sometimes it doesn't, could point that maybe sometimes it's reading + or - on the trigger and sometimes something else. |
Same issue. |
I solved the issue by clearing all the special keys except Speed up and screenshot. I hope this works for everyone :) |
I appear to have experienced the exact same problem as @bryc describes: Keyboard shortcuts work fine when VBA-M is started sans controller, but with a controller connected, CTRL+O and CTRL+Q work (although I usually have CTRL+Q and CTRL+W unbound as I have been burned by accidentally pressing these combinations instead of CTRL+S after difficult Pokèmon fights) before loading a ROM, but once a ROM is loaded, all keyboard shortcuts are disabled. Unbinding Joy1-Axis2- fixed the issue. Oddly enough, I cannot recall ever having experienced this while using an original Sony PlayStation 4 controller. It only happened after I misplaced my genuine DualShock and started using a cheap aftermarket controller branded, rather surprisingly, "Arrogant Bastard". However, from the previous comments here, it appears this must have been coincidence; I included it anyway because with programming, you quite frankly never know what might turn out to be relevant. |
as a workaround for shortcuts not working when game is already running, the culprit here is due to the nature of some analog triggers (at least on my case with xbox360). removing remaps(was set default for Motion Up/Down) for any triggers should resolve most shortcut key issues. |
I will try to rewrite the SDL joystick API usage from SDL1 calls to SDL2 calls for the next release, hopefully that will help. SDL2 has better support for axis etc.. |
well just have some problems with bios of gba and some games and finally update from 1.8 for the most recent 2.1.0 but this problem with shortcuts really are worst than the bios problem the workaround do not work for me but waiting the new build with the fix but aside this little bug, GREAT WORK GUYS!!!really thanks for the updates!! |
MORE INFORMATION: |
Correct. |
The default keyboard/joystick bindings for the "special" keys have assumptions about axis numbers that do not hold with modern game pads. For reference, the 360 controller has the following mappings: Axis 0/1: left stick Axis 3/4: right stick Axis 2: left trigger Axis 5: right trigger This triggers another bug causing the depressed state of a trigger axis to fire continuously. In this case, this is the left trigger on a 360 controller which is axis 2. This triggers yet another bug where a stream of joystick events blocks keyboard events from registering, resulting in hotkeys like ctrl+p to pause not working. Replace all joystick binds for special keys with null values. With this change, a default installation of vbam will not trigger the hotkeys not working bug when a joystick is plugged in. The other bugs here mentioned also need to be fixed.
On joystick event notification, filter out axis values that are equal to their initial state. The reason for doing this is explained in 539027c. Triggers on e.g. the 360 controller are an axis that are the max negative value in the depressed state, and for some reason a constant stream of events are generated for them, that's another issue that needs to be addressed. For the time being, this fixes the other half of the main issue in #88: users with an old config with the default special key bindings will now be able to use keyboard hotkeys as these spurious joystick events will be filtered out and will not block keyboard events. TODO: - stop generating events for depressed triggers in the first place - fix joystick events completely blocking keyboard events
This is essentially fixed in master now, although there is a lot more work to do to fix things properly and make some improvements to the joystick code. |
One bug noted in the #88 discussion is that when a joystick button is held down, keyboard shortcuts do not work. Rewrite the logic for process_key_press() to only block further wxWidgets event propagation if the actual key pressed is a game key, not if any game keys are being held down. This takes care of all the issues in #88. TODO: - investigate other joystick issues
The last issue was joystick buttons blocking hotkeys and that's now fixed in master, looking at other joystick issues. Me and @ZachBacon will try to get a release out soon. |
Using latest release (2.1.0) Note that this appears to also be related to whether or not the game is launched from the command-line. If I open VBA-M and launch a ROM, shortcuts and xinput work, but from the command line xinput continues to work but keyboard shortcuts do not (launching this way is necessary to use external library managers such as PlayNite) |
this should be fixed in latest commit.... |
turbo mode assign to |
Several toggle options from the main menu could not be handled by the key shortcuts. This was mainly because the code was only checking if they were ticked or not. When a key shortcut was pressed, the key itself did not trigger the tick of the box from the menu, hence nothing was being done. We are not setting the debug ones because they are not being missed by the users (yet). - Fix remaining of #88.
@rkitover This was very like fixed at some moment in the past. I can't reproduce the joystick issue, and the keybinding was done not so long ago. @Stargateur If you are still around, your keybinding issue was fixed and it will be available on next release! |
The only remaining issue is that the keybind editor is too sensitive when picking up the analog axis, it binds e.g. axis+ and then immediately adds axis-. |
Ok I added a better hack for 360 triggers in 2fcad3f and that problem is gone. I think we can close this now. |
Several toggle options from the main menu could not be handled by the key shortcuts. This was mainly because the code was only checking if they were ticked or not. When a key shortcut was pressed, the key itself did not trigger the tick of the box from the menu, hence nothing was being done. We are not setting the debug ones because they are not being missed by the users (yet). - Fix remaining of #88.
Several toggle options from the main menu could not be handled by the key shortcuts. This was mainly because the code was only checking if they were ticked or not. When a key shortcut was pressed, the key itself did not trigger the tick of the box from the menu, hence nothing was being done. We are not setting the debug ones because they are not being missed by the users (yet). - Fix remaining of #88.
I've tried using keyboard shortcuts with VBA-M, but for some reason they don't do jack. For example, when using CTRL+P while playing a game, this should pause the game, but it doesn't.
I'm using the latest release—6ecab80—with Windows. I can't find the interface (wx or SDL).
Thank you for your time.
The text was updated successfully, but these errors were encountered: