Debug tab: a Movement speed choice for Link (1x to 3x) #2020
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!2020
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/debug-link-speed"
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?
Requested by Tommy · project thread
Getting around while testing takes a long time at Link's own pace. This adds a Movement speed choice to the Debug tab's tools: 1x, 1.25x, 1.5x, 2x or 3x.
What changed
gpu/vk/vk_menu.cpp): a "Movement speed" row in the Player group (Left/Right choose, stops at 1x and 3x). Only the Debug tab changes; the two-column boxed layout stays as it was. With the debug tools off, Link is back to his own speed. The row's percent goes to the game side as optionHOS_OPT_CHEAT_SPEED(36,gpu/vk/vk_api.h; an older renderer answers 0, which the host reads as 1x, soMKWVK_API_VERSIONis unchanged).nx2/oot_patches.pypatch_cct_speed,host/hos_main.chos_oot_cct_speed): the forward speed the game sets on a character controller goes through the host, which scales it for Link's controller only. It is hooked where the speed is set:f_809552f0, the move Link's walk, run and swim go through (at its two setter calls), plus the controller's setterf_80559df0andf_80964bf0, which inlines it. The physics step then moves him by that speed, so walls and floors still stop him. Like the other debug-tool patches, it is applied only to the supported build's lift.host/nn_hid.chos_move_stick_held), so walks the game scripts (the walk into a map after a map change) keep their pace.+476,OneShotPhysicsCctSetSpeedRate) first. The game sets it again before every step, so writing it had no effect.Testing
In the game (Windows, RTX, headless scripted runs with a throwaway save; Link's position logged once a second while the stick was held forward):
python -I -B tests/run_all.py: the same 62 checks fail with and without this change (they need gcc/g++, which this PC doesn't have). The checks that skip for want of gcc/g++, run with clang instead: no new failures oncetests/test_input_background.pywas updated for the new stick flag inhost/nn_hid.c. New:tests/test_movement_speed.py(the hooks, the host's limits, the menu's choices).Screenshots
The Debug tab at 2560x1440, menu size Small, Medium and Large (at this resolution Medium and Large already used one column before this change):
🤖 Generated with Claude Code
Nice, small and well contained. I went through the patch, the host side and the menu, and compared the hook places against a local lift.
What I checked:
MKWVK_API_VERSIONis right: only an enum value was added, and neither interface struct changed. The hooks go in at lift time, in the supported build's lift only (like the other debug-tool patches). Whether to scale is decided every time the speed is set, so changing the row takes effect right away with no relift. The refactor of the controller walk inoot_update_player_cheatsbehaves the same as before (the vtable has to match before the+0xe8check, so using the constant is equivalent).link_speedisn't inopts, so it isn't written to the ini, it's back to 1x at every launch, and the Quality preset can't touch it. Normal players never see it.test_movement_speed.pyis plain Python with no arguments, so run_all picks it up without aRUN_ALL_*declaration. Thetest_input_background.pychange makes that check stricter, not weaker: the cut-out state now has to include the new flag, which the harness needs so the cut-outnpad_statescompiles. Nothing it asserts was dropped.Things to look at:
feat(debug): Movement speed choice for Link (1x to 3x). The Windows Python failures (test_log_batch.py, andtest_bake_skeleton.pytiming out) fail the same way on main, so they aren't from this PR.Fine to merge once the title is fixed. Point 1 is a question, not a blocker.
Nit: this comment belongs to
link_agetwo lines up (the age report from the game side), not tolink_speed. It looks like the new block was inserted between the declaration and its comment. Move it back tolink_age?@ -442,0 +452,4 @@if (!controller || controller != __atomic_load_n(&oot_speed_controller, __ATOMIC_RELAXED)) return;const int percent = __atomic_load_n(&oot_speed_percent, __ATOMIC_RELAXED);int hos_move_stick_held(void); /* host/nn_hid.c */if (percent <= 100 || percent > 400 || !hos_move_stick_held()) return;This gate is "the stick is pushed", so a walk the game scripts while the player holds the stick (e.g. holding forward through a loading zone into the arrival walk) is still scaled. Probably fine for a debug tool. Worth a quick try, and a word in the row's help if it overshoots.