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

Fix rounding error when computing the emulated control stick values #356

Conversation

pdeblois
Copy link
Contributor

@pdeblois pdeblois commented Jun 29, 2022

This PR fixes issue #344 : Modifier Control Stick key only works when turning to the right. This fixes the issue both for the Gray Stick and the C-Stick.

There was a rounding inconsistency when computing the emulated (Standard Controller) control sticks' values. If the stick was pushed all the way to the max of the axis and the modifier key was pressed, the resulting offset was +63 if the stick was pushed in the positive direction of the axis, but -64 if it was pushed in the negative direction of the axis.

This fix first computes the absolute offsets to get consistent (and "correct") rounding, then computes the final result using the sign of the offset.

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

Successfully merging this pull request may close these issues.

2 participants