fix(hid): Link rolls again when A is pressed while running forward: the Npad state carries no stick direction bits #2017
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2017
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:fix/no-stick-bits-roll"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Since #1684 (merged 11-19), Link often does not roll when A is pressed while running forward: tap A a few times while running forward and he keeps running; holding A sometimes unsticks it. Backward and to the sides still roll.
#1684 ORed the sticks' direction pseudo-buttons (bits 16-23) into every Npad state the game reads, on the reading that "the game reads the axes, not these bits". The game does read them. Its own controllers have 28 bits: the left stick's directions at 20-23 and the right's at 24-27, which they work out from the axes and write over each update. Npad bits below 20 are kept as buttons, and 16-19 there are the D-pad. With the left stick pushed forward (Npad bit 17, StickLUp), the game saw a D-pad bit held while A was pressed, and did not roll.
This writes the buttons alone again:
stick_buttonsand its call innpad_statesgo, and so doestests/test_stick_buttons.py, which checked that the bits were there. Nothing onmainreads the bits; #1684 added them for a mod on another branch, which can get stick directions from the axes.Read
host/nn_hid.cnpad_statesandtests/input_background_test.cpacket().To see it on
main: run forward in the field and tap A every 100-200 ms; most taps keep Link running instead of rolling.See #1684.
Testing
Tested: CachyOS (Linux 7.3.3), NVIDIA GeForce RTX 3090, driver 620.70, Nintendo Switch Pro Controller over SDL, uncapped (65-80 fps), DLSS Quality, Hyrule Field and Kokiri Forest,
main@6e1521a7built as a pack:0x20001) with the stick at about (-1500, 32700); Sprint's mask stayed 0 and Link's driven-body carry (#1740) never ran. Taps while running forward did not roll.0x1for A with the stick forward, 238 presses, and forward rolls worked every time.b8c04c1c, built as a pack and run through the job queue (65 s, Switch Pro Controller, DLSS, uncapped): run forward tapping A, Link rolls as he should (by hand); the game closed normally.The game-free test:
tests/test_input_background.py's harness runs the realnpad_statesand now expects each state's buttons alone, whatever the sticks. Its frame-clock cases (frame-hold,wall,zero,empty) press A with the left stick fully forward, so onmainthe state carries0x20001and the check fails; here it carries0x1. A new case,stick-directions, pushes each stick all the way in each direction and diagonal with A held and presses each D-pad button with the stick forward: the buttons alone, and the D-pad still reaches the state. It was not run on this PC (tests are left to CI here).Still to test:
Measurements
Verdict: forward rolls work again: with the stick bits left out, every forward A tap rolled; with them in, the taps kept Link running.
Setup: CachyOS (Linux 7.3.3), RTX 3090, NVIDIA 620.70, Switch Pro Controller over SDL, uncapped (65-80 fps), DLSS Quality, Hyrule Field; A tapped every 100-200 ms while running forward; the game's received word from a local input log, the roll seen by hand.
6e1521a76e1521a7, the removed line skipped (local switch)6e1521a7, control (line back on)b8c04c1c0x200010x10x20001The PR head after review (
d0a74ffe,35db3bf9) changes only the test;host/is the same asb8c04c1c.Risks
Code that read bits 16-23 from the game's Npad state sees them clear again, as before #1684. Nothing on
maindoes. A revert brings back the roll bug. Players notice nothing after updating except that forward rolls work.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (not run on this PC; for CI)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here. (written as two commits, test then fix; not run on this PC, for CI)tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.🤖 Generated with Claude Code
Tested in game: CachyOS (Linux 7.3.3), RTX 3090, NVIDIA 620.70, Switch Pro Controller, uncapped, Hyrule Field: on main
6e1521a7taps of A while running forward did not roll (the game got A + StickLUp, 0x20001); the same build with exactly this line's stick bits left out gave 0x1 and every forward roll worked (238 presses); bits back on, the rolls failed again. This branch builds as a pack.Recommendation: Request changes. Removing the synthetic stick bits restored forward rolls in the Linux A/B. The required regression harness can fail before checking the fix on a Clang-only setup or when it inherits a mouse setting.
The Npad writer sends the mapped buttons and stick axes without synthesizing direction bits. This removes the false D-pad input that blocked forward rolls and deletes the helper that produced it. Mods that read stick directions from bits 16–23 lose those inputs and need to derive them from the axes.
@fixwill do (7)tests/test_input_background.py:40: The replacement regression test hardcodes GCC in both the suite declaration and the standalone default. On a Windows llvm-mingw setup with CC pointing to clang and no gcc on PATH, the suite can skip or fail this check before reading a packet. Honor CC unless --cc is explicit, use a GCC or Clang fallback, and remove the suite's hardcoded override.tests/test_input_background.py:132: The fixture still inherits HOS_MOUSE_NATIVE, which overrides the mouse mode set by its cases. With HOS_MOUSE_NATIVE=0, menu-side-buttons takes the mouse-as-stick path before the menu opens, the motion spy reports no capture, and the Mouse 4 assertion fails independently of the Npad fix. Clear HOS_MOUSE_NATIVE from the fixture environment.tests/test_input_background.py:172: The live-input cases pass an absolute temporary path to a fixture that uses narrow getenv and fopen without the game's Windows UTF-8 manifest. With TEMP under a directory containing characters outside the system code page, the fixture can fail to reopen the file Python created. Launch the fixture from its temporary directory and pass an ASCII relative filename, or link the existing UTF-8 manifest.tests/input_background_test.c:172: The test describes a contract for both sticks, but the fixture always expects right-stick Y to be zero. Reintroducing just StickRDown would pass, including the direction used by the mod that prompted #1684. Add full deflections in each direction for both sticks and include a real D-pad press to verify that it still reaches the state.6e1521a7and the local line-bypass variant, and add the PR-head result when available. Restore the applicable Windows/Linux host-build checkbox and leave it open until verified.Guide screenshots / Guide images and local UI source review (pull_request)fails on this head and passes on the base branch: Failing after 26s.CI / Website build and checks (pull_request)fails on this head and passes on the base branch: Failing after 51s.For the author (2) (a run, a measurement or a decision)
tests/test_input_background.py:126: The description predicts the fixture result, but supplies no run of the test-only commit or the head. (more on the line)host/nn_hid.c:1458: The in-game result comes from a local Linux variant. Before merge, verify forward A taps on the PR head with a Windows controller, the Steam Deck's built-in controls and the keyboard, and exercise the real D-pad and right-stick camera during those runs.More: does it help, other systems, switches, what was read
Does it help: Yes for the reproduced Linux case. On the same CachyOS, RTX 3090 and Switch Pro Controller setup, the author reports 238 successful forward rolls on main
6e1521a7with the removed line bypassed. Re-enabling it reproduced the failure, and 101 of 148 control presses were forward with StickLUp set. The tested revision has the same HID source as the merge base. The PR head was reported to build as a pack. No performance gain is claimed.Other systems: SDL, XInput, the Deck, keyboard, mouse-as-stick, scripted input and the control bridge share the Npad writer. All five Npad styles take the same change. The diff leaves the axis writes, physical D-pad mapping, Sprint processing, ocarina remapping and the cheat button snapshot in their existing positions. Renderer, GPU-driver, audio, save and build paths have no direct change. Windows controller, Steam Deck and keyboard gameplay still need confirmation. The off-branch mod's R plus right-stick-down combo loses its direction bit.
Switches: None. The local A/B switch does not ship.
Reviewed:
b8c04c1ce4against2b3de5b27a: Read host/nn_hid.c, tests/input_background_test.c, tests/test_input_background.py and the deleted tests/test_stick_buttons.py in full, along with the two PR commits, AGENTS.md, CONTRIBUTING.md, the developer standards, the fix-with-test guidance and the Forgejo template. No docs/review-checklist.md was present. Traced Npad entry points, the control bridge, cheat and Sprint consumers, the guest range helper, the fixture runner and local main history. Read the PR report, comment and supplied CI results. Skimmed related source checks and CI configuration. Unrelated archived runs and translations were outside the diff.; nothing run (a code review).Checked and fine:
Testing: Read-only review. git diff --check passed. No builds, tests or project scripts were run during review. The author reported the Linux A/B and PR-head pack build. The supplied CI has two head-only failures, which the bot tracks separately.
Overlaps and merge order: No competing open change was visible in the checkout. #1684 is the merged change being reversed. Local main is
85a59e6f8and has no intervening edits to the four changed files.Automated code review by BeanBot (gpt-6.2-sol), on the pull request's opening. Nothing was run; a maintainer decides.
@ -120,3 +124,3 @@block(hid, "static int walk_percent("), block(hid, "static void move_keys_stick("),block(hid, "static int flight_jump_shortcut("), read, block(hid, "static uint64_t stick_buttons("),block(hid, "static int flight_jump_shortcut("), read,block(hid, "static void npad_states(")))L6 (minor): The description predicts the fixture result, but supplies no run of the test-only commit or the head. Record the test-only commit failing the button-word assertion and the fixed head passing the fixture on Linux and Windows.
@fix
I didn't fix this pull request: docs/user/images/guide/settings-graphics.png isn't a UTF-8 text file. Nothing was pushed.
Automated fix by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
WIP: fix(hid): Link rolls again when A is pressed while running forward: the Npad state carries no stick direction bitsto fix(hid): Link rolls again when A is pressed while running forward: the Npad state carries no stick direction bitsb8c04c1ce435db3bf910Review answered, at
d0a74ffe(test) and35db3bf9(fix):stick-directions, pushes each stick all the way in each direction and diagonal with A held, and presses each D-pad button with the left stick forward. Each state must carry the buttons alone, and the D-pad must still reach it. The bridge fake's sticks now reach the state, andpacket4()checks the right stick's Y too, so reintroducing StickRDown alone fails. It is folded into the test commit, which still comes before the fix.main, not by this diff.HOS_MOUSE_NATIVEinheritance and UTF-8 temporary paths predate this PR and don't touch the Npad word. They belong in a change of their own.Correction to the reply above: the keyboard was not confirmed separately. The by-hand run of this PR on Linux was with the Switch Pro Controller; the keyboard (W, then E for A) stays in Still to test, by hand.
35db3bf91039ac2e5c08@fix
I didn't fix this pull request: it isn't open.
Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.