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 5280

Summary: DirectInput joystick incorrect initial axis positions
Product: SDL Reporter: Jean-Pierre Gygax <gygax>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: NEW --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: sezeroz
Version: 2.0.13   
Hardware: x86   
OS: Windows 10   
Attachments: DInput Poll() call immediately after opening a joystick

Description Jean-Pierre Gygax 2020-09-03 20:19:51 UTC
Created attachment 4457 [details]
DInput Poll() call immediately after opening a joystick

When first querying DirectInput joystick axis positions, they are reported as 0, even when their physical position is different.

After some research, it appears Windows requires some time between the call to IDirectInputDevice8_Poll() and the collecting of the resulting data via IDirectInputDevice8_GetDeviceData().

The attached patch is a crude but apparently functional solution to this problem.