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 - DirectInput joystick incorrect initial axis positions
Summary: DirectInput joystick incorrect initial axis positions
Status: NEW
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: 2.0.13
Hardware: x86 Windows 10
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-03 20:19 UTC by Jean-Pierre Gygax
Modified: 2020-10-18 10:44 UTC (History)
1 user (show)

See Also:


Attachments
DInput Poll() call immediately after opening a joystick (885 bytes, patch)
2020-09-03 20:19 UTC, Jean-Pierre Gygax
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.