fix: Correct inverted Android stick Y axis and map the RX/RY right stick - #129
Merged
Merged
Conversation
Follow-up to #128, which fixed the same double inversion for the d-pad hat axis. gamepads_android's EventListener already inverts AXIS_Y, AXIS_RZ and AXIS_RY, so a physical stick-up reaches Dart as +1.0. AndroidMapping negated it a second time and emitted leftStickY = -1.0 for up, the opposite of every other platform and of the documented convention. AXIS_RX and AXIS_RY were reported by EventListener but missing from the axis map, so they fell through to normalizeDpadAxis and were dropped. Controllers that report the right stick on RX/RY, such as the DJI RC Pro, emitted no normalized right stick events at all. Claude-Session: https://claude.ai/code/session_019aEP4Np5vqDw5BkgGYyHe7
wolfenrain
approved these changes
Aug 25, 2026
7 tasks
spydon
added a commit
that referenced
this pull request
Aug 25, 2026
…8.4.0 (#130) ## Description Removes the `+x` build numbers from all package versions and updates melos to `^8.4.0`. Every `+x` version was the currently published one on pub.dev, so plain stripping would have produced versions that sort lower than what is published. Each package got a patch bump instead, with the build number dropped: | Package | Before | After | |---|---|---| | gamepads_android | 0.1.8+2 | 0.1.9 | | gamepads_darwin | 0.1.2+4 | 0.1.3 | | gamepads_ios | 0.1.3+3 | 0.1.4 | | gamepads_web | 0.1.1+1 | 0.1.2 | | gamepads_windows | 0.3.0+1 | 0.3.1 | | gamepads | 0.1.10+5 | 0.1.11 | | flutter_gamepads | 0.1.11+4 | 0.1.12 | Internal dependency constraints and changelogs were generated with `melos version` from the unreleased commits (#125 to #129). `gamepads_web` and `gamepads_windows` had no unreleased changes and are only bumped to drop the suffix. Melos 8.x bumps the patch version for fixes and dependency updates on 0.x packages and only keeps a build number when the current version already has one, so with these clean versions no `+x` will be reintroduced by future `melos version` runs. 8.4.0 is the latest release and requires `sdk: ^3.9.0`, which matches the workspace minimum. ## Checklist - [x] The title of my PR starts with a [Conventional Commit] prefix (`fix:`, `feat:`, `docs:` etc). - [x] I have read the [Contributor Guide] and followed the process outlined for submitting PRs. - [x] I have updated/added tests for ALL new/updated/fixed functionality. - [x] I have updated/added relevant documentation in `docs` and added dartdoc comments with `///`. - [x] I have updated/added relevant examples in `examples`. ## Breaking Change - [ ] Yes, this is a breaking change. - [x] No, this is *not* a breaking change. https://claude.ai/code/session_01ECm9j87ohzVbQSagq7qe8M [Conventional Commit]: https://conventionalcommits.org [Contributor Guide]: https://github.com/flame-engine/gamepads/blob/main/CONTRIBUTING.md
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.
Follow-up to #128, which fixed the same double inversion for the d-pad hat axis but left the analog sticks inconsistent with it. Also closes the second symptom reported in #123.
Stick Y axis was double inverted
gamepads_android'sEventListenerregistersAXIS_Y,AXIS_RZandAXIS_RYwithinvert = true, so a physical stick-up already arrives in Dart as+1.0.AndroidMapping.normalizeAxisnegated it a second time:The result was
leftStickY = -1.0for up on Android, while the same gesture gives+1.0on iOS, macOS and Web. That contradicts the convention documented onGamepadAxisandPlatformMapping("Left/Down = -1, Right/Up = +1"), so cross-platform game code moved the player in opposite directions.After #128 the file also argued both ways: "EventListener already inverted it" for the hat axis, and the opposite three lines above for the sticks.
RX/RY right stick events were dropped
EventListenerreportsAXIS_RXandAXIS_RY(added in #111 for non-Xbox layouts such as the DJI RC Pro), but they were missing from_axisMap. Unmatched analog keys fall through tonormalizeDpadAxis, which returnsconst []for anything that is not a hat axis, so those events were discarded. On a DJI RC Pro the right stick produced no normalized events at all.Both are mapped to
rightStickX/rightStickY, the same aliasing pattern already used forAXIS_BRAKE/AXIS_GAS.Guarding the cross-package invariant
AndroidMapping's correctness depends on theinvert = trueflags staying in the separately versioned Kotlin plugin, and until now the only trace of that was a comment on the Dart side.EventListener.ktis the more obvious place for a contributor to "fix" against Android's documentation, and doing so would silently re-invert everything without a single test failing, since the tests only exercise the Dart half. Added a counterpart comment next tosupportedAxespointing back at the Dart mapping.AXIS_WHEELis still reported byEventListenerand still unmapped, since there is no matchingGamepadAxis. It stays available through the raw event API.Changes
packages/gamepads/lib/src/mappings/android_mapping.dartpackages/gamepads/lib/src/mappings/platform_mapping.dart, the Y-axis contract no longer lists Android as a platform that must negatepackages/gamepads_android/.../EventListener.kt, comment onlypackages/gamepads/test/mappings_test.dart, stick assertions corrected, new RX/RY testpackages/gamepads/test/gamepad_normalizer_test.dart, theAXIS_Ytest asserted the buggy-1.0Verification
melos analyzeis clean,dart formatreports no changes, and all 80 tests inpackages/gamepadspass. Hardware confirmation on a physical Android device is still worth doing before release.https://claude.ai/code/session_019aEP4Np5vqDw5BkgGYyHe7