Repository navigation
ESP32: a gamepad jump is as high as a keyboard one; face buttons do one thing each - #6
Merged
Merged
Conversation
…ne thing each tab5-emu sends the USB gamepad's face buttons to JK as keys (A = space, B = x, X = c, Y = enter: activate, jump, crouch, use item) and, through jk_esp_input_t.buttons, also as joystick buttons B1-B4, which the homebrew default binds map to fire, duck, activate and jump (profile binds are reset to those defaults on homebrew). So each button did two things. B jumped and ducked in the same frame, and sithPlayerActions_JumpWithVel gives a crouching jump 0.7x the speed: measured on the device, the player rose 0.095 against 0.1149 for the keyboard's X. A also fired, X also activated, and Y also jumped. In play, stdControl_ReadControls now takes the joystick buttons from jk_esp_input_t.joy_buttons, which leaves out the USB gamepad's a/b/x/y; the touch pad's buttons still go through. While one of JK's menus is open (jkGuiRend_ESP32_MenuActive), it still takes all of them: the menus use B1 as enter, B2 as back and B3 as the default button, and the binding screens read them too. The Select + X noclip combo still works from either pad. 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.
A gamepad jump went lower than a keyboard jump
tab5-emu sends the USB gamepad's face buttons to JK as the keys of its gamepad layout (A = space, B = x, X = c, Y = enter: activate, jump, crouch, use item). It also sent them through
jk_esp_input_t.buttonsas joystick buttons B1–B4. The homebrew default joystick binds (sithControl_MapDefaultsJoystick) map those to fire, duck, activate and jump, and on homebrew the profile's binds are reset to the defaults (jkPlayer.c, aftersithControl_ReadConf). So each button did two things:sithControl_PlayerMovementreads DUCK before JUMP in the same frame, andsithPlayerActions_JumpWithVelgives a crouching jump 0.7× the speed.Fix: in play,
stdControl_ReadControlstakes the joystick buttons from the newjk_esp_input_t.joy_buttons, which leaves out the USB gamepad's a/b/x/y; the touch pad's buttons still go through. While one of JK's menus is open (jkGuiRend_ESP32_MenuActive, new), it still takes every button: the menus use B1 as enter, B2 as back and B3 as the default button, and the binding screens read them too. The Select + X noclip combo is checked on the unmasked buttons, so it still works from either pad.Testing (Tab5, with esp-cpp/tab5-emu#41)
A temporary test hook injected each press through the host's real input path (
jk_esp_read_input), held it 300 ms on flat ground in level 1, and logged how far the player rose.The diagnosis was checked by two skeptics, who confirmed the mechanism. They also pointed out that the menus need the joystick buttons, which is why the mask applies in play only.
🤖 Generated with Claude Code
https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY