feat(input): Sprint's Toggle arms and disarms from Link's state, on by default #2168
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!2168
Loading…
Reference in a new issue
No description provided.
Delete branch "llun/Longshot:feat/sprint-toggle-link-state"
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
Sprint's Toggle now arms and disarms from Link himself, as Hotoni describes it for their sprint mod (the rules
below are theirs), and it is on by default.
and a turn or a U-turn.
made standing still (so a press before you start moving isn't lost). Standing still also covers Link stuck in his
Walk state without moving (held against a wall, or a stick resting a little off its centre), after 16 frames of it
followed by the standing-still wait, so a U-turn's short stop in Walk keeps the sprint.
ledge, swimming, Epona, the ocarina. The next press ends it too.
Insert open or the window behind another one (with no controller playing in the background) holds it as it is; the
game's pause and its panel (Plus, Minus) hold it while the game stops under them; a load holds it. Back in the game,
Link has the same 90 frames to move again. The menus keep their own input as before: a press of Sprint's in Insert or
the pause menu isn't Sprint's, and one held as a menu closes starts nothing.
options_version6 and older) wrotetoggle_sprint=0whether itwas chosen or not; they now come up with the Toggle on. Hold is still one click away on the Controls page, and works
as before. Reset and Reset to defaults put Sprint's Toggle back on.
How to see it on
main: Sprint On, Toggle on, run into a wall and stay against it: the sprint never ends, andmoving away later is still the sprint (one way to get #2146's report). Or open Insert, the pause menu, or click
another window: the toggled sprint is gone. A test run's exclusive bridge input (
longshot_ctl.py) ends it as soon asits
SPRINTis let go, so a toggled sprint can't be checked headless onmain.How:
host/oot_sprint.c.hos_sprint_input'sblockedis now flags:SPRINT_BLOCKEDtakes no press and nolonger ends a toggled sprint;
SPRINT_AWAYholds it;SPRINT_PAUSE(Plus or Minus pressed) allows time for the game's pause or panel to open.Their screen updates signal when they are open and when they close, including while Link is stationary. Walk under
STILL_SPEED(0.5 m/s) across the ground forSTILL_WALK_FRAMESis standing; his position is the state tap's (+0x31cin the actor at Link+0x18).host/nn_hid.cstops resetting the toggled sprint with the buttons' toggles. The state ids are the game's own statetable's, read from its names (Walk 1, Wait 40, Rolling 99, TurnAround 21, Turn 22, QuickTurn 188; anything unlisted,
like LockOnMove 66, BasicAttack 112, Talk 75, Climb 70, Swim 84, UseItem 238, ends it). Each start and end of a toggled
sprint is logged with its reason and Link's state id (
input: a toggled sprint ends: Link stopped (Link's state 40)),for reports like #2146 that came with no log. All the numbers are named constants (
WAIT_STOP_FRAMES4,WAIT_START_FRAMES90,STILL_SPEED,STILL_WALK_FRAMES16,PAUSE_OPEN_FRAMES30), counted in 60 Hz gameframes so 120 or 240 fps behave as 60.
Also: the Toggle and Reset cells' help in all 13 languages, the user guide's Sprint paragraph and table row.
Read first:
host/oot_sprint.c(hos_sprint_input,hos_sprint_step,state_kind), the Sprint block ofnpad_statesinhost/nn_hid.c,menu_init'soptions_version7 ingpu/vk/vk_menu.cpp.Refs #2146 (the toggle staying on after Link stops: fixed for Link stuck in Walk; I couldn't reproduce the report's
exact case on
main, see Testing). Fixes the focus part of #2060 ("tabbing out cancels Sprint Toggle"); its dialoguepart stays as it is on purpose: talking ends a toggled sprint, as the spec asks. Follows #1929, #1948, #1977 and
#2038.
Testing
Tested: Windows 11, NVIDIA GeForce RTX 5080 (driver 621.24), the game built from this branch over the shared base
of
main@dd5ffe6a2, headless through the job queue (--mode shared) and the control bridge, from the repository'smarket-entrancesave, in Hyrule Field, child and adult Link (the bridge's age switch). Link's state id and positionread each frame through
mem_read, his speed from them, and the log's toggled-sprint lines:ends: Link stopped (Link's state 40), run again 4.50ends: Link did not start moving after the press, 4.50ends: the next press, 4.50ends: ZL held(LockOnMove 66), 4.50ends: an event (a conversation, a cutscene)options_version=6,toggle_sprint=0)Not covered in the game: an attack, an item, climbing and talking (the repository's saves have no sword or items, so B
does nothing there), and opening Insert (the bridge can't open it, and a headless window takes no keys): the game-free
test covers them and they are in Still to test.
On
main@5726eff4(its base alone, before this branch's rebase), Hold mode the same way: the sprint 5.31 m/s against a 4.50 m/s run (child);the stick let go while Sprint stays held, Walk turns to Wait 4 frames later. A toggled sprint couldn't be driven
headless on
main(the exclusive bridge input ended it at once), so #2146's report itself wasn't reproduced; theWalk-without-moving case it can come from was, in the game-free test.
The checks:
tests/test_sprint.py(8 tests,host/oot_sprint.cagainst its fake game): fails onmainat the first new rule(a blocked read ends a toggled sprint), and each new rule fails there alone too (a pause ends it 4 frames after
Link is back; Walk without moving never ends it); passes here. Undoing each key line (
if (event || !toggle), theresumed grace, the Walk-still rule) makes it fail. Windows clang, and Linux gcc (WSL Ubuntu 24.04; its C++ cases
skip there, no g++).
tests/test_menu_keys.py: the Toggle on by default, Reset and Reset to defaults putting it back on, a file frombefore
options_version7 coming up on, Hold chosen now kept; fails onmain, passes here (clang++).tests/test_input_background.py(sprint-toggle: Insert, Plus and the focus lost end nothing, and whatnpad_stateshands over),test_walk_key,test_menu_i18n: updated, pass but for what fails onmaintoo.main@dd5ffe6a2and here (Windows, clang): 717 passed, 97 failed, 135 skipped both, the 97 the same set (this PC's toolchain: no Vulkan headers, no g++ for some fixtures; listed in a comment), none failing only here.Still to test:
and run, stop: back to normal speed; press while standing, start within a second and a half: sprint. Attack with a
sword, aim with ZL, use an item, climb, talk: each ends it. Open the pause menu, Insert and alt-tab mid-sprint, come
back with the stick held: still sprinting. Toggle off: only while held.
@Beanstalk build and start on Linux, then Sprint's Toggle: sprint, stop, pause and resume).Measurements
Nothing to measure: per update of Link, two more guest reads (his position) beside the state chain #2038 already reads, and no switch is added.
Risks
when Link stops and survives menus, pauses and alt-tab. A player who wants Hold turns the Toggle cell off once.
toggled sprint is held through them.
main's Toggle.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.host/oot_sprint.ccompiled by its check with gcc, the Linux build is on the Test Farm under Still to test)Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Tested in game: Windows 11, RTX 5080 (driver 621.24), built from
297ebed5over the shared base of main @dd5ffe6a2, headless through the job queue and the control bridge, market-entrance save, Hyrule Field, child and adult Link: press, run, stop ends it (back to the plain run); a press while standing holds 90 frames; rolls, a U-turn, the game's pause (stick held or let go), the focus lost and a load keep it; the next press, ZL and an event end it; Hold mode and an options file from before (Toggle comes up on) as expected. Each start and end read from the game's log with Link's state id. Not in the game: attack, item, climb, talk and Insert (no sword or items in the repo's saves; the bridge can't open Insert).The whole suite (
tests/run_all.py, Windows 11, clang from the builder's llvm-mingw) onmain@dd5ffe6a2and on this branch @297ebed5: 717 passed, 97 failed, 135 skipped on both, the same 97. None fails only here. They are this PC's setup (no Vulkan headers, fixtures that fall back to a missing g++, and the like), not this change:🤖 Generated with Claude Code
@Beanstalk build and start on Linux, then Sprint On with its Toggle on (the default): press Sprint and run, stop (back to the plain run), and open and close the pause menu mid-sprint (still sprinting after).
Beanstalk test farm
Commit
56a6972· approved by nobody yet · dashboardA member of
BigBeanscan review this commit and comment@Beanstalkto test it.@review
Recommendation: Request changes. The new pause detection can leave Sprint armed indefinitely after the game resumes, and the Sprint row’s reset control cannot restore its new default in a common case.
Sprint Toggle now follows Link’s movement and survives menus, focus loss, pauses and loads; it also becomes the default when Sprint is enabled. The change adds state tracking and changes existing Hold users to Toggle on upgrade.
@fixwill do (4)host/oot_sprint.c:263: Unchanged position and state do not establish that the pause is still open. (more on the line)gpu/vk/vk_menu.cpp:5337: The reset action now restores Sprint Toggle to on, but control_column_enabled still enables the reset cell when the toggle is on instead of when it differs from its default. (more on the line)Guide screenshots / Guide images and local UI source review (pull_request)fails on this head and passes on the base branch: Failing after 34s.CI / Website build and checks (pull_request)fails on this head and passes on the base branch: Failing after 35s.Before merging: testing (2) (runs on the systems it can change; it doesn't hold the recommendation)
host/nn_hid.c:1656: The reported bridge run does not exercise physical keyboard or controller input, Insert, or the untested action transitions. (more on the line)host/nn_hid.c:1656: The Linux host build and controller game run remain outstanding. (more on the line)More: does it help, other systems, switches, what was read
Does it help: Unproven for the reported issue: the author could not reproduce its exact case on main. The reported Windows game run shows the new stop, pause and focus behavior in the tested field scenarios, but physical input and several actions remain untested.
Other systems: The input and Link update paths affect Windows and Linux, keyboard, controllers, background input, the control bridge and Hold mode. The reported run used the bridge on Windows; physical controls and the Linux build and game run remain outstanding. No renderer or GPU-specific code changed.
Switches: No environment switches added, changed or removed. The saved Sprint Toggle option changes from off to on by default; version 6 and older files are migrated to on, including players previously using Hold. The Sprint feature itself remains off by default.
Reviewed:
297ebed56bagainstdd5ffe6a29: Read the repository rules and PR template, commit messages, changed host logic, menu migration and reset code, and the relevant test and input call sites. Skimmed the translated strings and guide changes. The full large menu and HID files and the unchanged portions of the tests were not read in full; Tooling’s AGENTS.md was unavailable in the checkout.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no builds, tests or project scripts were run. The author reports Windows bridge runs and game-free checks; physical Windows input and Linux remain to be tested.
Overlaps and merge order: none found
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -5327,3 +5335,3 @@if (host->reset_binding(button)) {blocked_reset_row = -1;if (has_toggle(button)) toggle_set(button, false);if (has_toggle(button)) toggle_set(button, toggle_default(button));L2: The reset action now restores Sprint Toggle to on, but control_column_enabled still enables the reset cell when the toggle is on instead of when it differs from its default. With default Sprint bindings and Toggle off, the reset arrow is disabled, so a player cannot restore its default through the row; with Toggle on it remains enabled even when everything is already default. Compare the toggle with toggle_default in the enable predicate and exercise the real predicate in the test.
@ -1652,0 +1653,4 @@const int sprint_reset = InterlockedExchange(&sprint_reset_pending, 0);/* (away: the player's input does not reach the game, Insert open or the focus lost with no pads behind otherwindows; a test run's own input, which keeps the player out, reaches it behind them) */const int sprint_away = menu_open || (!sprint_excluded && !sprint_front && !pads_behind);L3 (minor): The reported bridge run does not exercise physical keyboard or controller input, Insert, or the untested action transitions. Run the described Windows keyboard and controller checks, including attack, item, climb, talk and menu entry and exit.
L4 (minor): The Linux host build and controller game run remain outstanding. Verify Sprint start, stop, pause and resume on Linux as requested in the pull request.
@ -172,0 +260,4 @@if (__atomic_exchange_n(&pause_pressed, 0, __ATOMIC_RELAXED) && LOAD(toggled) && on) paused = 1, pause_wait = 0;if (paused == 1 && !frozen && (pause_wait += frame_step_frames()) > PAUSE_OPEN_FRAMES) paused = 0;if (paused && frozen && on && LOAD(toggled)) {paused = 2, moved = 0, wait_frames = 0;L1: Unchanged position and state do not establish that the pause is still open. If Link is standing when the pause closes, this branch continues returning indefinitely: the 90-frame grace never counts down, Sprint presses are discarded, and ZL is ignored until Link moves or changes state. Use an actual pause/menu signal to distinguish a closed pause from stationary gameplay, and test closing it without changing Link’s state or position.
@fix
Recommendation: Approve. The code is ready: only testing is left. The reported game run shows the main sprint behavior working, but physical input and the Linux build and controller run remain unverified. Recommend approval; not approved on the forge.
What
@fixchangedI changed this pull request: the new head is
56a69721c6. It was already up to date withmain. I edited its description to match the change.Changed
Not done
Nothing was built or run: the checks run again on the new head.
Sprint Toggle follows Link’s state, survives menus and focus loss, and defaults to on when Sprint is enabled. It adds state and menu tracking, and existing players who prefer Hold must select it again.
Before merging: testing (2) (runs on the systems it can change; it doesn't hold the recommendation)
host/nn_hid.c:1656: The reported bridge run does not exercise physical keyboard or controller input, Insert, or the untested action transitions. Run the described Windows keyboard and controller checks, including attack, item, climb, talk and menu entry and exit.host/nn_hid.c:1656: The Linux host build and controller game run remain outstanding. Verify Sprint start, stop, pause and resume on Linux as requested in the pull request.Checks: they run again on this head (
Guide screenshots / Guide images and local UI source review (pull_request),CI / Website build and checks (pull_request)failed on the last one); a failure shows on the pull request.Also noticed (5; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes for the tested paths: the reported Windows bridge run shows sprint ending on a stop and surviving pause and focus loss. Physical input and several action transitions have not yet been checked in game.
Other systems: The input and menu hooks run on Windows and Linux and affect keyboard and controller input. Windows bridge results cover part of the behavior; the physical input and Linux paths remain outstanding. The change also updates the website’s settings reader.
Switches: No environment switch added or changed. Sprint remains off by default; its Toggle now defaults to on, including for options files from version 6 and earlier. Hold remains selectable.
Reviewed:
56a69721c6againstdd5ffe6a29: Read AGENTS.md, CONTRIBUTING.md, the pull request template, host/oot_sprint.c and the relevant input, menu and website reader code. Reviewed the diff and skimmed translations and test changes; the large changed files and tests were not all read in full.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run tests were executed. The author reports a Windows bridge run and the same 97 suite failures on the base and branch; physical Windows input and Linux verification remain outstanding.
Overlaps and merge order: none found
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
WIP: feat(input): Sprint's Toggle arms and disarms from Link's state, on by defaultto feat(input): Sprint's Toggle arms and disarms from Link's state, on by defaultReplies to BeanBot's review (00:08), checked against
main@9e10f6f72, which holds this PR asa053f9e12(the review's fix commit56a69721included, unchanged but for one test line from #2171):L1, pausing can leave Sprint armed. Leaving it armed through a pause is the design. The rules come from Hotoni's description of their sprint mod: "Menus, a pause or losing focus do NOT cancel it: it is decided from Link's state, not from the input layer." The real defect inside the point was right, though: with the hold keyed to Link's state and place being frozen, a pause closed with Link standing still kept holding, so the 90-frame grace never ran and a Sprint press or ZL did nothing until he moved.
56a69721fixed that, and it is onmain. The hold now follows the pause menu's and the panel's own screen updates (host/oot_menu.c,sprint_menu_tick) and ends at Link's first update after they stop; from there the grace counts down, and presses and ZL work again (tests/test_sprint.pycloses a pause with Link standing still).L2, the row's reset control. Fixed in
56a69721, onmain:control_column_enabledcompares Sprint's Toggle withtoggle_default(gpu/vk/vk_menu.cpp:1672), andtests/test_menu_keys.pyruns the real predicate. It passes with clang++ on Windows.L3, physical input and the untested actions. The user played 85e4cfef by hand on Windows 11 with an RTX 5080. In its log, each press started a toggled sprint and the next ended it; a jump attack ended it (
Link's state 114), ZL ended it twice, and Link stopping ended one started by a press while standing. No sprint ended while a menu was open. Items, climbing, talking and Insert don't appear in that log, so they stay to test by hand. Earlier, the headless bridge runs covered stop, grace, rolls, a U-turn, pause, focus loss, the next press, ZL and an event for child and adult Link. They ran on the version before56a69721, so that commit's screen signal had the hand test only.L4, Linux. Not run. Beanstalk said the farm can't turn Sprint on, so the Linux build and a controller run stay with a person on Linux.
L5, the guide screenshots check. It fails the same way on
main@9e10f6f72(10 entries forsettings-graphics.png, including sources this PR doesn't touch, likegpu/vk/vk_texture.handgpu/vk/device_policy.h): its review hashes are stale onmain. The job runs only on pull requests that touch those sources, which is why it showed here. It needs a person to review the picture and record new hashes; the check won't do that itself.L6, the website build.
56a69721taught the settings page's parser the ReShade rows that broke it, and #2171 broughtmain's website build back to passing.🤖 Generated with Claude Code