Skip to content

Fix controller mode button mapping regression - #501

Merged
zortos293 merged 2 commits into
devfrom
capy/fix-controller-button-mapping
Jun 5, 2026
Merged

Fix controller mode button mapping regression#501
zortos293 merged 2 commits into
devfrom
capy/fix-controller-button-mapping

Conversation

@zortos293

Copy link
Copy Markdown
Collaborator

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.tsx and LibraryPage.tsx.

Button mapping changes:

  • Centralized gamepad reading into controllerGamepad.ts with named bit masks for all standard controls
  • Updated both HomePage and LibraryPage to use the shared mapping, fixing B (back navigation), X (search overlay), L1/R1 (page navigation), and Mode (details/variant cycle)
  • Added controller search overlay UI and CSS styling to both pages
  • Reduced move repeat latency from 220ms to 140ms for more responsive D-pad navigation
  • Added unit tests for the button mapping utility

Verification:

  • npm --prefix opennow-stable run typecheck
  • npm --prefix opennow-stable test (84 tests passing)
  • npm --prefix opennow-stable run lint (no new errors introduced)

Resolves #498.

Open OPE-170 OPE-170

…ling

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@zortos293 zortos293 added the capy Generated by capy.ai label Jun 4, 2026 — with Image Capy AI

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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>
@zortos293
zortos293 merged commit edeb07e into dev Jun 5, 2026
15 checks passed
Chizuui pushed a commit to Chizuui/OpenNOW-Modified that referenced this pull request Aug 11, 2026
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capy Generated by capy.ai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant