Skip to content

joystick: Improve Xbox controller mapping with xpad quirks #13305

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

endrift
Copy link
Contributor

@endrift endrift commented Jul 1, 2025

xpad has a series of questionable design choices when it comes to button mapping. Notably, BTN_TRIGGER_HAPPY1-4 are used for the D-pad on dance mats instead of the typical BTN_DPAD_*, and maps the paddles to BTN_TRIGGER_HAPPY5-8. This commit plumbs through driver detection for a udev device and adds special exceptions for xpad's quirks. When not using xpad, it assumes that the paddles are instead mapped to BTN_TRIGGER_HAPPY1-4, which is what upcoming driver projects use instead.

It also exposes KEY_RECORD as the share button regardless of vendor, which had previously been gated behind being a Microsoft controller. All Xbox Series controllers can include this button, and many third party ones do.

I've noticed that there is a special exception to Xbox 360 wireless controller mapping of the D-pad in SDL_PrivateGetGamepadMappingForNameAndGUID in SDL_gamepad.c. I don't have the wireless adapter mentioned so I can't test how this affects that, which should probably be checked before merging.

xpad has a series of questionable design choices when it comes to button
mapping. Notably, BTN_TRIGGER_HAPPY1-4 are used for the D-pad on dance mats
instead of the typical BTN_DPAD_*, and maps the paddles to
BTN_TRIGGER_HAPPY5-8. This commit plumbs through driver detection for a udev
device and adds special exceptions for xpad's quirks. When not using xpad, it
assumes that the paddles are instead mapped to BTN_TRIGGER_HAPPY1-4, which is
what upcoming driver projects use instead.

It also exposes KEY_RECORD as the share button regardless of vendor, which had
previously been gated behind being a Microsoft controller. All Xbox Series
controllers can include this button, and many third party ones do.
@endrift endrift marked this pull request as draft July 12, 2025 00:04
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

Successfully merging this pull request may close these issues.

1 participant