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

Better support for secondary stick in DirectInput driver #1463

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

connorjclark
Copy link
Contributor

As referenced here: #1462 (comment)

This patch fixes detection of the secondary thumbstick. I tested on two devices: a PS4 Dualshock, and a Stadia controller.

The code assumed that Rx, Ry, Rz will always be what maps to the secondary stick. However, that apparently was too hard for controller manufacturers to do. For example, my above mentioned controllers use Z and Rz for the second stick. Short of including a database of controller mappings, this patch introduces a heuristic to guess how to map to a secondary stick.

The idea for the solution came from https://www.gamedev.net/forums/topic/613913-directinput-identifying-second-thumbstick/

// ...it may be that using `Z` really is common for some input devices.
//
// Solution came from https://www.gamedev.net/forums/topic/613913-directinput-identifying-second-thumbstick/
if (j)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we have a backwards compatibility mechanism, we can merge a version of this. Could you add check like this https://github.com/liballeg/allegro5/blob/8575e373ab79c7bc25f8425990fc6780e75e69c8/src/macosx/hidjoy.m#L192C4-L192C76 here, so this behavior can be configured?

Also, could j be called something more informative, like... offset_override maybe?

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.

2 participants