Fix controller mode button mapping regression - #501
Conversation
…ling Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f6bce9e4a5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (pad.buttons[13]?.pressed || (pad.axes[1] ?? 0) > 0.65) buttons |= controllerButton.down; | ||
| if (pad.buttons[14]?.pressed || (pad.axes[0] ?? 0) < -0.65) buttons |= controllerButton.left; | ||
| if (pad.buttons[15]?.pressed || (pad.axes[0] ?? 0) > 0.65) buttons |= controllerButton.right; | ||
| if (pad.buttons[16]?.pressed) buttons |= controllerButton.guide; |
There was a problem hiding this comment.
Map the controller menu button correctly
When a user presses the controller Menu/Start button advertised by the controller hints and keyboard m binding, the standard Gamepad API reports that as button 9, while button 16 is the guide/home button and is often reserved or not exposed. Because this helper only maps index 16 to guide, the new controllerButton.guide actions in Home/Library won't fire on common controllers when users press Menu; map button 9 (or include it as an alias) for the more-options action.
Useful? React with 👍 / 👎.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
* Fix controller mode button mapping by centralizing gamepad input handling Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * Handle controller menu button alias Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --------- Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This PR fixes the v0.4.0 controller mode regression where L1, R1, B, X, and Mode buttons were unresponsive despite correctly reaching the renderer. The issue stemmed from inconsistent bit-shift mappings between the gamepad reader (using HTML5 Gamepad API indices) and the button handlers in both
HomePage.tsxandLibraryPage.tsx.Button mapping changes:
controllerGamepad.tswith named bit masks for all standard controlsHomePageandLibraryPageto use the shared mapping, fixing B (back navigation), X (search overlay), L1/R1 (page navigation), and Mode (details/variant cycle)Verification:
npm --prefix opennow-stable run typechecknpm --prefix opennow-stable test(84 tests passing)npm --prefix opennow-stable run lint(no new errors introduced)Resolves #498.