liballeg / allegro5

The official Allegro 5 git repository. Pull requests welcome!
https://liballeg.org
Other
1.85k stars 283 forks source link

[osx] Unexpected behavior for right stick of modern Xbox controller #1462

Open connorjclark opened 1 year ago

connorjclark commented 1 year ago

Xbox Wireless Controller

This controller has three sticks: 0 and 1 are the left and right sticks, and 2 is the DPAD (hat switch).

According to the allegro joystick interface on OSX, these switches have these number of axis:

Stick 0 has 3 axis (kHIDUsage_GD_X, kHIDUsage_GD_Y, kHIDUsage_GD_Y) Stick 1 has 1 axis (kHIDUsage_GD_Rz) Stick 2 has 2 axis (the hat switch)

I noticed that when processing stick 1 in static void add_elements, two HID usage interfaces are ignored with decimal values 196 and 197. These values are not defined in the HID header.

Listing the odd things:

connorjclark commented 1 year ago

I found a similar issue on Windows for DirectInput wjoydxnu.cpp w/ the Stadia controller. Same exact stick layout, same exact number of axis as the example described above.

image

image

Also found issues with secondary stick for PS4 dualshock controller. Allegro discovers the controller supports Rx/y/z, but actually the inputs that come through when moving the second stick are for Z and Rz.

Perhaps a good solution: https://www.gamedev.net/forums/topic/613913-directinput-identifying-second-thumbstick/4878869/