Skip to content

ESP32: a USB gamepad's bumpers switch weapons, its d-pad picks and uses Force powers - #7

Merged
finger563 merged 1 commit into
esp32p4from
esp32/gamepad-weapons-force
Nov 25, 2026
Merged

finger563 merged 1 commit into
esp32p4from
esp32/gamepad-weapons-force

Conversation

@finger563

@finger563 finger563 commented Nov 25, 2026 •

Copy link
Copy Markdown

A USB gamepad can switch weapons and use Force powers

There was no way to change weapons or use a Force power from a USB gamepad on the Tab5. ESP32 took the homebrew joystick defaults (sithControl_MapDefaultsJoystick). Their L/R binds, next item and next weapon on B10/B11, were never fed by stdControl_ReadControls, and the joystick hat was held at 0.

  • sithControl_MapDefaultsJoystick: a new TARGET_ESP32 branch, placed ahead of the homebrew one, with the desktop layout for a USB gamepad:
    • B10/B11 (L1/R1): previous/next weapon;
    • the hat (its d-pad) left/right: previous/next Force power;
    • hat up: use the Force power (held), as INPUT_FUNC_USESKILL;
    • the touch pad keeps B1–B4, and Select keeps B7, as on the other homebrew ports.
  • stdControl_ReadControls (ESP32):
    • feeds B10/B11 from bits 10/11 of joy_buttons, where tab5-emu puts L1/R1 alone once the pad has shown it has triggers to fire with;
    • feeds the hat in play from the new jk_esp_input_t.dpad, the d-pad alone. JK's menus already navigate with the d-pad as keys, so they don't get the hat too.

Testing (Tab5, with esp-cpp/tab5-emu#42)

A temporary test hook injected each press through the host's input path in level 1, with all weapons and the light Force powers given by cheats:

Press Weapon Force power
R1, R1, L1 2 → 3 → 4 → 3
d-pad right, right, left Jump (21) → Speed (22) → Jump
d-pad up, held 1.5 s Jump activated

Fire on R2/L2 and the face buttons are unchanged (#6). On real hardware (a Backbone Pro), the bumpers and Force controls were tried by hand: everything worked except the d-pad, which needed the tab5-emu side to read its d-pad usages (no hat switch). That is fixed in the tab5-emu PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY

…es Force powers

There was no way to change weapons or use a Force power from a USB gamepad on
the Tab5. ESP32 used the homebrew joystick defaults, whose L/R binds (next
item / next weapon on B10 / B11) were never fed by stdControl_ReadControls,
and the joystick hat was held at 0.

- sithControl_MapDefaultsJoystick: an ESP32 branch with the desktop layout
  for a USB gamepad. B10 / B11 (L1 / R1) = previous / next weapon; the hat
  (its d-pad) left / right = previous / next Force power, up = use it
  (held). The touch pad keeps B1-B4 and Select keeps B7, as on the other
  homebrew ports.
- stdControl_ReadControls feeds B10 / B11 from bits 10 / 11 of joy_buttons
  (tab5-emu puts L1 / R1 alone there, once the pad has shown it has
  triggers to fire with). It feeds the hat in play from the new
  jk_esp_input_t.dpad, the d-pad alone; JK's menus already navigate with the
  d-pad as keys, so they don't get the hat too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
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.

1 participant