Fix stuck down guitar input#1
Open
Maudfer wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue I was having on my own wii guitar, so I'm assuming it affects certain hardware only.
The Wiimote itself was working fine, and WiimoteThing created the virtual Xbox controller normally, but piping the input to the virtual controller was not working as expected: With just the Wiimote connected, input worked as expected, but as soon as I connected a Guitar accessory, the app would constantly pipe a Down / HAT Down input to the virtual Xbox controller even when I wasn't touching the stick or strum bar.
I ruled out any hardware defects, the guitar works fine on a real Wii, and the same Wiimote + guitar + Bluetooth dongle also works correctly in Dolphin. The issue only showed up here, in the translation from guitar input to the virtual Xbox controller.
The root cause was the guitar stick being normalized against a hardcoded neutral center that I'm guessing doesn't hold across all guitar hardware revisions. On my guitar (an off-brand from 15 years ago that as far as I know is a clone of the original Guitar Hero Les Paul for the Wii), that meant the stick looked slightly off-center all the time, which turned into a permanent held direction.
This change makes the guitar learn its joystick neutral from the first real live sample instead of assuming the default center is always correct. Saved calibration is still respected if it's already present.