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

SDL 3.2 Xbox Gamepad Axes incorrect on Windows #12082

Open
nardo opened this issue Jan 25, 2025 · 5 comments
Open

SDL 3.2 Xbox Gamepad Axes incorrect on Windows #12082

nardo opened this issue Jan 25, 2025 · 5 comments
Assignees
Milestone

Comments

@nardo
Copy link

nardo commented Jan 25, 2025

I'm having a gamepad issue with SDL3 using an Xbox gamepad from the Xbox Series X on Windows.

On MacOS it works as expected, but on WIndows, the axes coming back from SDL3 are off by one for the thumb sticks (ie left stick is axes 1,2 and right stick is axes 3,4). I get the same behavior whether using the Xbox Controller or Xbox Gaming Device driver in Device Manager.

The build works correctly on both platforms with a Switch controller.

The windows build is built with VS2022 targeting Win32 and running on ARM64 (Surface 11)

@slouken
Copy link
Collaborator

slouken commented Jan 25, 2025

Are you using the gamepad API or the joystick API?

@slouken slouken added this to the 3.2.2 milestone Jan 25, 2025
@slouken slouken self-assigned this Jan 25, 2025
@slouken slouken added the waiting Waiting on user response label Jan 25, 2025
@nardo
Copy link
Author

nardo commented Jan 25, 2025

This is using the Gamepad API

@slouken
Copy link
Collaborator

slouken commented Jan 25, 2025

Does testcontroller work for you?

@nardo
Copy link
Author

nardo commented Jan 25, 2025

testcontroller exhibits the same failure with the Xbox controller, specifically:
Controller name: "Xbox One Controller"
LeftX -is pinned at -1
LeftY.is mapped to the left stick x axis
RightX is mapped to the left stick y axis
RightY is mapped to the to the right stick x axis
Left Trigger is mapped to the right stick y axis
Right Trigger is unbound
Axes[7] is mapped to the right trigger
Buttons/HAT work correctly

The Switch controller, which comes through named "Xbox 360 Controller" works correctly

@nardo
Copy link
Author

nardo commented Jan 25, 2025

Here is the console output from the run:
Gamepad 3 added
Opened gamepad Xbox One Controller, guid 0300938d5e040000ff02000000007200, \?\HID#VID_045E&PID_02FF&IG_00#7&a2ac37b&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Rumble supported
Trigger rumble supported
Player index: 0
Mapping: 0300938d5e040000ff02000000007200,,a:b0,b:b1,x:b2,y:b3,back:b6,guide:b10,start:b7,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,crc:8d93,platform:Windows,
Gamepad 3 removed
Added HIDAPI device 'Nintendo Switch Pro Controller' VID 0x057e, PID 0x2009, bluetooth 0, version 512, serial 000000000001, interface 0, interface_class 0, interface_subclass 0, interface_protocol 0, usage page 0x0001, usage 0x0004, path = \?\HID#VID_057E&PID_2009#6&35c399e5&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}, driver = SDL_JOYSTICK_HIDAPI_SWITCH (ENABLED)
Removing HIDAPI device 'Nintendo Switch Pro Controller' VID 0x057e, PID 0x2009, bluetooth 0, version 512, serial 000000000001, interface 0, interface_class 0, interface_subclass 0, interface_protocol 0, usage page 0x0001, usage 0x0004, path = \?\HID#VID_057E&PID_2009#6&35c399e5&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}, driver = SDL_JOYSTICK_HIDAPI_SWITCH (ENABLED)
Couldn't open joystick: Joystick 4 not found
Gamepad 4 added
Couldn't open gamepad: Couldn't find mapping for device (4)
Gamepad 4 removed
Couldn't open joystick: Joystick 5 not found
Gamepad 6 added
Opened gamepad Xbox 360 Controller, guid 0300b9695e0400008e02000000007200, \?\HID#VID_045E&PID_028E&IG_00#7&1692c6a2&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Rumble supported
Player index: 0
Mapping: 0300b9695e0400008e02000000007200,
,a:b0,b:b1,x:b2,y:b3,back:b6,guide:b10,start:b7,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,crc:69b9,platform:Windows,
Gamepad 6 removed
Gamepad 9 added
Opened gamepad Xbox One Controller, guid 0300938d5e040000ff02000000007200, \?\HID#VID_045E&PID_02FF&IG_00#7&a2ac37b&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Rumble supported
Trigger rumble supported
Player index: 0
Mapping: 0300938d5e040000ff02000000007200,,a:b0,b:b1,x:b2,y:b3,back:b6,guide:b10,start:b7,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,crc:8d93,platform:Windows,
Gamepad 9 removed
Added HIDAPI device 'Nintendo Switch Pro Controller' VID 0x057e, PID 0x2009, bluetooth 0, version 512, serial 000000000001, interface 0, interface_class 0, interface_subclass 0, interface_protocol 0, usage page 0x0001, usage 0x0004, path = \?\HID#VID_057E&PID_2009#6&35c399e5&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}, driver = SDL_JOYSTICK_HIDAPI_SWITCH (ENABLED)
Removing HIDAPI device 'Nintendo Switch Pro Controller' VID 0x057e, PID 0x2009, bluetooth 0, version 512, serial 000000000001, interface 0, interface_class 0, interface_subclass 0, interface_protocol 0, usage page 0x0001, usage 0x0004, path = \?\HID#VID_057E&PID_2009#6&35c399e5&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}, driver = SDL_JOYSTICK_HIDAPI_SWITCH (ENABLED)
Couldn't open joystick: Joystick 10 not found
Gamepad 10 added
Couldn't open gamepad: Couldn't find mapping for device (10)
Gamepad 10 removed
Gamepad 11 added
Opened gamepad Xbox 360 Controller, guid 0300b9695e0400008e02000000007200, \?\HID#VID_045E&PID_028E&IG_00#7&1692c6a2&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Rumble supported
Player index: 0
Mapping: 0300b9695e0400008e02000000007200,
,a:b0,b:b1,x:b2,y:b3,back:b6,guide:b10,start:b7,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,crc:69b9,platform:Windows,
Gamepad 11 removed

@slouken slouken removed the waiting Waiting on user response label Feb 2, 2025
@slouken slouken modified the milestones: 3.2.2, 3.2.4 Feb 2, 2025
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

2 participants