Repository navigation
Jedi Knight: gamepad bumpers switch weapons, the d-pad picks and uses Force powers - #42
Merged
Merged
Conversation
… Force powers A USB gamepad had no way to change weapons or use a Force power in Jedi Knight. Now, as on desktop OpenJKDF2: R1 / L1 = next / previous weapon, the d-pad's left / right = previous / next Force power and up = use it (held). Fire stays on R2 / L2, and the left stick moves. - Tab5 HAL: GamepadDetail (Tab5Emu::gamepad_detail()) keeps apart what GamepadState folds together: L1 / R1 alone, whether the pad has shown it has triggers (L2 / R2 pressed since it connected), and its d-pad alone. usb_hid.cpp reads the d-pad from the pad's own fields, a hat switch or the d-pad usages (the Backbone Pro has four of those and no hat); the decoder folds it with the left stick. - jk_esp_read_input: with the d-pad known, the left stick moves (W/A/S/D) and the d-pad goes to the engine as the joystick hat (jk_esp_input_t.dpad). Once the pad has shown triggers, they fire and L1 / R1 go to the joystick binds (bits 10 / 11 of joy_buttons). A pad without triggers keeps firing with L / R, and one whose d-pad can't be told apart keeps moving with it. - OpenJKDF2 esp32/gamepad-weapons-force: the ESP32 joystick binds and the input read that feeds them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
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.
Engine side: esp-cpp/OpenJKDF2#7. This PR bumps
components/jk/OpenJKDF2to that branch (0f72de90).Summary
A USB gamepad had no way to change weapons or use a Force power in Jedi Knight. Now, as on desktop OpenJKDF2:
JK's own menus are unchanged.
How
GamepadDetail, fromTab5Emu::gamepad_detail(), keeps apart whatGamepadStatefolds together:usb_hid.cpp: reads the d-pad from the pad's own fields, either a hat switch or the d-pad usages, since the hid-rp decoder folds the d-pad and the left stick together. The Backbone Pro has four d-pad usage fields and no hat. The connect log now says which one a pad has.jk_esp_read_input:jk_esp_input_t.dpad);Testing (Tab5)
0 hat switch(es), 4 d-pad usage field(s).🤖 Generated with Claude Code
https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY