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 forwarding leads to games reading two gamepads #1045

Open
lyra-scarlet opened this issue Jan 28, 2025 · 3 comments
Open

Input forwarding leads to games reading two gamepads #1045

lyra-scarlet opened this issue Jan 28, 2025 · 3 comments

Comments

@lyra-scarlet
Copy link

lyra-scarlet commented Jan 28, 2025

I am using the two following input remappings:
BTN_TL2 remapped to key_down(BTN_TL2).set(var, 1).hold().set(var, 0).key_up(BTN_TL2)
BTN_NORTH remapped to if_eq($var, 1, key_down(BTN_WEST).hold().key_up(BTN_WEST), key_down(BTN_NORTH).hold().key_up(BTN_NORTH))

For this gamepad, BTN_TL2 is the left trigger, and BTN_NORTH/BTN_WEST are X and Y. Effectively, the left trigger is being used as a modifier to change X to Y when held, while also preserving its input as the left trigger.

However, I was confused when I tested this, as games were reading the remapped inputs as a separate controller. Using https://hardwaretester.com/gamepad I realised that this was because the remapped inputs are coming from the input-remapper gamepad while the untouched ones are coming from a gamepad labelled as 'forwarded'.

Requiring a separate input device to send inputs to rather than the original controller is an understandable technical limitation, however by forwarding the inputs to a separate device, the kind of use case I have with a modifier button is unsuitable.

A potential workaround for this would be to manually remap every button on the gamepad to itself, but I would prefer a simple option to redirect all of the forwarded inputs to the input-remapper gamepad, so that games can properly read all the inputs coming from a singular gamepad.

@sezanzeb
Copy link
Owner

sezanzeb commented Jan 28, 2025

We'd could maybe add an option to send all events into an appropriate predefined uinput, like the gamepad.

The original reason why we have those (Gamepad, Mouse, etc.) is, because someone might want to map BTN_A to KEY_A or something, which a gamepad can't inject. If we tell the system that we have a special gamepad that can inject keyboard events (via its "capabilities"), it might not be recognized as a gamepad anymore. And we can't predict what kind of events a mapping will inject, because of variables.

I wonder if we can decide on a per-output-event basis if we want to send it into the "forwarded" device, if that device has said output-event listed in its capabilities. (We would also have to change the name from "gamepad forwarded" to "gamepad clone"). However, all sorts of tests would have to be adjusted if we change where/how events are injected.

Or we add an entry to the target dropdown to allow selecting the clone.

That last option is tempting, because it sounds easy... Which it probably isn't, but at least it sounds easier than the alternatives. Optional functionality shouldn't break any existing tests. And the UI already has all the GTK widgets required for this.

@sezanzeb
Copy link
Owner

(You might want to use hold_keys(BTN_WEST) instead of key_down(BTN_WEST).hold().key_up(BTN_WEST) by the way)

@lyra-scarlet
Copy link
Author

Optional functionality sounds good to me if it won't break tests.
Thanks for the recommendation on hold_keys, I just copied over what I had for BTN_TL2 since it worked fine.

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

No branches or pull requests

2 participants