Skip to content
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

Input doesn't distinguish between right and left ctrl/shift #135

Open
zeta12ti opened this issue Sep 8, 2018 · 4 comments
Open

Input doesn't distinguish between right and left ctrl/shift #135

zeta12ti opened this issue Sep 8, 2018 · 4 comments

Comments

@zeta12ti
Copy link

zeta12ti commented Sep 8, 2018

When hitting either right or left ctrl (or shift), the game takes the input to be left ctrl (or shift) regardless. This is a problem since Mupen64Plus uses right ctrl and right shift to reduce the amount that the arrow keys move the controls (c.f. this guide). If both keys are taken to be the left keys, there's no way to modulate the controls.

It looks like the culprit is Qt's handling of the situation. As you can see in keymap.py, Qt only has Key_Control and Key_Shift, with no way to distinguish right and left. The only solution appears to be using QKeyEvent::nativeScanCode, rather than the built-in codes.

@gen2brain
Copy link
Member

I don't remember exactly, but I think there were some issues with QKeyEvent::nativeScanCode, I did tried to add left/right modifiers and failed.
Anyway, whole input system should be revisited to remove hard coded stuff and allow different input plugins for configuration, like other plugins do, see #123 . Not sure when will I find time, I am quite busy, any help is welcomed.

@zeta12ti
Copy link
Author

zeta12ti commented Sep 9, 2018

After getting familiar with the code, I think you're right. It would be nice to be able to directly reroute inputs to whatever plugin handles them (I guess using QT's nativeEvent handler so that the raw input is passed).

I made a quick patch here that fixes this issue for Posix systems. I tested it out and the right ctrl and shift do exactly what I want. I'm sure it can be easily adapted to Windows and iOS (but not more than one at once) using their virtualkeys or scancodes (Windows uses these codes. I think iOS is less uniform, but there's this).

@raafaar
Copy link

raafaar commented Sep 28, 2022

I was about to post the same issue. The same happens to me.

This issue should be given more attention because we are missing an important feature of mupen64plus which allows us to make smaller moves with the analog stick (e.g. for aiming accurately in a game). The feature is described in https://mupen64plus.org/wiki/index.php/KeyboardSetup like this:

When using the keyboard, the analog stick is normally moved by its full range when you press an arrow key. Sometimes you may need to make smaller moves. In this case, you can move the analog stick more gently by holding down the Right Control key (for -50%) or Right Shift key (-25%), or both (-75%).

I've even tried to unset shift and control keys in the configuration (so they are no assigned to any button) but no difference in the movement in the game.

I will try the @zeta12ti's patch but still people with other OS will be missing that feature.

@raafaar
Copy link

raafaar commented Oct 4, 2022

Thank you @zeta12ti. Your patch works for me. It should be merged into master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants