close
Skip to content

Fixed joystick POV values not being set properly for devices that are…#1719

Merged
eXpl0it3r merged 1 commit into
masterfrom
bugfix/joystick_pov
Dec 28, 2020
Merged

Fixed joystick POV values not being set properly for devices that are…#1719
eXpl0it3r merged 1 commit into
masterfrom
bugfix/joystick_pov

Conversation

@binary1248

Copy link
Copy Markdown
Member

This fixes an issue where joystick/controller POV values were not set correctly for devices that are accessed via DirectInput.

See: #1634 (comment)

DirectInput provides a combined value for both X and Y hat directions, this value has to be translated back to the separate X and Y values that SFML exposes through its API. Previously the implementation erroneously treated X and Y hat axes as separate objects which could only work if the device reported the same hat twice as distinct objects. This was the case with some devices but not all causing this bug to not always be reproducible.

This fix was tested with both a joystick and a controller (the same one mentioned in the linked comment).

@Dreamykass

Dreamykass commented Nov 29, 2020

Copy link
Copy Markdown

Tested this PR with the joystick example with my controller Torid Speedlink. It's got two modes, XInput and DirectInput (dunno which is which), and both appear to work fine.

(Just the second sees the back triggers as on-off buttons instead of analog input. But I think that's a controller thing.)

https://i.imgur.com/aiD9ebg.gif
https://i.imgur.com/WlakuyF.gif

(Windows 10 Pro, 64 bit. Compiled the current version of Visual Studio 2019.)

@MarioLiebisch MarioLiebisch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be working fine with my Saitek X-55 (incompatible with XInput). All 8 hat directions follow the same coordinates pattern as a Xbox One Conotroller (using XInput).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants