feat(input):Improving Sprint feature: Sprint sets the game's dash input instead of holding A #2038
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2038
Loading…
Reference in a new issue
No description provided.
Delete branch "kendowashere/Longshot:feat/sprint-dash-input"
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 (#1929, #1948, #1977, built on thegrandao's #196) gets the game's run by holding A and then hiding A's "pressed" bit from the game's controllers, so the game sees a held A (its run) without a press (no roll, no talk). This PR keeps everything players see from those PRs: the Sprint row on the Controls tab, the Controls page's Sprint line (Shift and L3 by default, rebindable), its Toggle cell and the saved keys (
sprint=,toggle_sprint=,key_sprint,pad_sprint). It replaces only how Link is made to run, with the engine of my Sprint button from the NX2navi runtime (its PRs 752, 887 and 927; Alimjan suggested putting the two together on #196).How: Link sprints while bit 4 of his input flags (
*(Link +0x50)), the dash input, is set: the flag the game sets itself for the run that follows a roll. Two places load those flags: his movement update (f_804caa80at0x804ce798, the sprint's start and keep tests) and his stance and camera update (f_80c225d0at0x80c27f3c).nx2/oot_patches.pyputs a call right after each load, andhost/oot_sprint.cORs the bit in while Sprint runs, only for the Link the player controls. The game's own sprint then runs: its speed, animation, camera, and every rule that ends it.Why this is better than holding A:
SPRINT_ROLL_GAP_MS) so the game can see a fresh press, then holds it again; a tap counts only through that gapf_8038a220and also the menus'f_834a3680: every reader of A sees the mask+0x470), never the other instance of his classWhat players notice: Sprint feels the same (it is the same game run), A works while sprinting, L3 hides the text box again with Sprint on, and a toggled sprint stops when Link stops instead of coming back later.
Also: the Toggle cell's help says a toggled sprint ends with Link's state (all 13 languages), the user guide's Sprint paragraph and the control bridge's Sprint check follow, and
injected_buttons(only the A handoff read it) is gone.Read first:
host/oot_sprint.c,hos_sprint_input's call innpad_states(host/nn_hid.c),patch_sprint_linkandpatch_sprint_stanceinnx2/oot_patches.py.Testing
Tested: Windows 11, NVIDIA GeForce RTX 5070 Ti (driver 621.24), by hand in the game: this branch's engine built together with my other open PRs (#699, #711, #1294) on
main@fd7dc40d(build/combined, the samehost/oot_sprint.c,nn_hid.cwiring and patch sites as this head). Sprint On, Toggle off and on: L3 held (and Shift) runs the game's sprint with no roll and the plain run on letting go; Toggle on starts it with a press, keeps it through a roll and a jump, ends it when Link stops or attacks; A while sprinting rolls and talks as usual; in a conversation L3 hides the text box and starts nothing. Everything worked.dev.py packs base, llvm-mingw):oot_patches: Sprint's link site in code_hot.cand... stance site in code_hot.c, each found once;oot_sprint.ccompiled.tests/test_sprint.py(8 tests): the bindings and layout cases as before, andhost/oot_sprint.ccompiled alone against a fake game (Link's state chain, the actor and event managers): held on while held and off when let go; A never added and the player's A passed through; Toggle on through jumps, landings, slides and rolls, off at the next press, an attack, ZL, the host's reset, 4 frames standing still (16 updates at 240 fps), 90 frames after a press made standing; a conversation's L3 handed to the game as LS for as long as it is held; nothing handed for a key; blocked (Insert, ocarina) neither; a press held on from a load stays the game's; another Link never sprints. The two patch sites on lifted text, a drifted build left alone and counted, andtouches()keeping both functions out ofguest_locals.tests/test_input_background.py(every case butstick-directions, which fails onmain@7c23d2betoo,sprint-togglenow checks whatnpad_stateshandshost/oot_sprint.cand that the game's buttons stay the player's),test_walk_key,test_bound_keys,test_menu_i18n,test_settings_table,test_menu_modules,test_option_ids,test_alt_enter,test_pad_layout: pass.test_pads_after_menufails onmaintoo (#1721's stand-in, named in #1977), andtest_menu_i18nfails onmain@7c23d2bethe same way (an Output resolution text #1859 changed). The whole suite onmain@e6196f0f: the same failures with and without this change.Still to test:
Measurements
Nothing to measure: per frame, a few guest pointer reads at Link's two updates replace the A handoff and a mask in the controllers' update; no switch is added.
Risks
oot_patches.pyexpects: the build printsWARNING: Sprint's sites were found ..., and nothing else breaks (no A is held any more).sprint=,toggle_sprint=, the bindings). A revert brings back A held.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
tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.WIP: feat(input): Sprint sets the game's dash input instead of holding Ato feat(input): Sprint sets the game's dash input instead of holding Afeat(input): Sprint sets the game's dash input instead of holding Ato feat(input):Improving Sprint feature: Sprint sets the game's dash input instead of holding AView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.