We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3960

Summary: [UWP] XInput forcibly uses old joystick mapping for all WinRT configurations
Product: SDL Reporter: Ethan Lee <flibitijibibo>
Component: joystickAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: icculus
Version: HG 2.1   
Hardware: All   
OS: Windows 10   
Attachments: Patch to fix Win10 XInput binding

Description Ethan Lee 2017-11-14 18:34:12 UTC
For WinRT, XInput always forces the old code path for all versions:

https://hg.libsdl.org/SDL/file/cf166abbde4a/src/joystick/windows/SDL_xinputjoystick.c#l39

Looking around briefly it seems this might have been required for Windows 8 (?), but I think for Windows 10 the new path is required. In its current form, ABXY is unintentionally mapped to the physical d-pad due to this array:

https://hg.libsdl.org/SDL/file/cf166abbde4a/src/joystick/windows/SDL_xinputjoystick.c#l349

By changing the hardcoded return value to SDL_FALSE, we use the new path where the array properly lines up...

https://hg.libsdl.org/SDL/file/cf166abbde4a/src/joystick/windows/SDL_xinputjoystick.c#l375

... and the issue is resolved for me.
Comment 1 Ethan Lee 2018-02-21 17:44:19 UTC
Created attachment 3177 [details]
Patch to fix Win10 XInput binding

Attached is a patch to fix this issue without changing the behavior on Windows 8, which presumably needed the old path to begin with.
Comment 2 Ryan C. Gordon 2018-02-21 18:16:49 UTC
This patch is now https://hg.libsdl.org/SDL/rev/1a033404c88b, thanks!

(note the commit hash changed because of Windows newlines, so be careful when updating your local copy.)

--ryan.