fix(input): Stick range row so a controller's full push counts as full tilt #1349
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!1349
Loading…
Reference in a new issue
No description provided.
Delete branch "donkeykong/Longshot:fix/stick-range"
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?
Type: fix · Risk: low · Tested on: Windows 11, RTX 5090, Switch Pro Controller over Bluetooth · Needs: a DualShock 4 or DualSense (the pad of #88), an Xbox pad, Linux
Why
With a controller, Link sometimes runs when he should roll: the stick is held all the way forward, Action is pressed, and he keeps running. Changing the Stick dead zone does not help.
The game rolls only from a (nearly) full tilt. The keyboard and scripted input always send exactly full tilt, which is why #88's scripted checks never failed. A real pad often reads a few percent short on an ordinary full push, and the port passed that on unchanged.
See #88 (reported there for diagonals on a PS4 pad; this is the same failure on another pad, straight forward).
How to reproduce
Seen on: Windows 11 (build 26200), RTX 5090, NVIDIA 617.42; Switch Pro Controller over Bluetooth through SDL (SDL 3.4.20 behind sdl2-compat)
Settings and switches: Stick dead zone 15% (also at Default),
HOS_STICK_LOG=1for the log linesSteps: on flat ground, hold the left stick straight forward to its rim and press Action, a few dozen times
Expected: Link rolls every time
Actual: he often keeps running. The log shows the stick at 94% to 98% on those presses, never 100%
What changed
A new Controls row, Stick range (70% to 100%, default 90%): the share of a pad's own range at which a stick counts as fully tilted. Pad sticks are scaled by it once, after the dead zone.
hos_stick_range()inhost/nn_hid.c, called once per pad for SDL (host/pad_sdl.c) and XInput. It scales along the stick's own direction, so the angle is kept. Keyboard, mouse and scripted input are not touched.stick_witness()behindHOS_STICK_LOG=1logs the stick on each press of Action, for reports like #88.gpu/vk/vk_menu.cpp,vk_menu.h), option 72HOS_OPT_STICK_RANGEingpu/vk/vk_api.h, answered by the existing option callback. No new member, no ABI change. Texts in all 13 languages.HOS_STICK_LOGin docs/development.md.tests/test_stick_range.py(new); two fixtures that cutnn_hid.cupdated.Why the pad reads short is not confirmed. The ceiling of a full push sank during one session (about 31,800 to 30,800 of 32,767), which would fit a driver that calibrates to the largest value seen. The console also counts a stick as full before its rim.
Measurements
Verdict: it helped. At 90% the roll never failed in two rounds of play; at 100% (the behaviour on
main) it failed again in the same session.Hardware: Windows 11 (build 26200), RTX 5090, NVIDIA 617.42, Ryzen 7 9800X3D, 31 GB; Switch Pro Controller over Bluetooth
Scene: Forest Temple (adult); 5120x2880, DLSS (DLAA)
Method:
Action pressedlines of longshot_log.txt, 259 presses in one run, the row changed in the menu between rounds (90%, 100%, 90%). Whether Link rolled was judged by the player.How to reproduce:
HOS_STICK_LOG=1, hold forward and press Action repeatedly at 100% and at 90%Baseline: measured on v3.0.0-rc.5 with an earlier version of this change applied by hand; the row at 100% is the "before". The branch's final host and menu code was then built into rc.5 and played without the log: rolls worked every time at 90%. The branch built from
mainhas not been run.main): v3.0.0-rc.5 with this change by hand @e4d035ee4d035eFlags and settings
One menu row with its ini key, and one logging switch.
stick_range)HOS_STICK_LOGTesting
Tested:
python -I -B tests/run_all.pyon Windows: 581 passed, 48 failed;main@6d72ca9on the same PC: 580 passed, 48 failed. 47 fail in both; the one that differs on each side passes when run alone. The new test fails onmain. In the game, by the player, with a Switch Pro Controller: rolls forward and on diagonals at 90%, 100%, then 90% again (earlier build), and a couple of minutes of rolls at 90% on the final code. Screenshot of the row in the first comment.Not tested: the branch built from
main(the game here is v3.0.0-rc.5 with this change's host and menu files, without the translations). XInput pads. The right stick's camera feel. Linux. Two pads at once.Must be tested:
HOS_STICK_LOG=1, hold a full diagonal and press Action at 100% and at 90%, expecting a roll every time at 90% (by hand, and theAction pressedlines)Risks
What could break: the feel of analog walking and the camera, slightly, on every pad: full tilt arrives at 90% of the stick's way and partial tilts are a ninth larger.
Turning it off: Stick range 100% in the Insert menu (
stick_range=100).Compatibility: longshot_options.ini gains
stick_range; a file without it gets 90%. Saves, shader and pipeline caches and the vk ABI are unchanged (MkwVkHostandMkwVkRendereruntouched).Issues
See #88
Checklist
Everyone
type(scope): description) of the status line's type.can't be run by hand is in Testing's Not testable by hand, with why.
in Risks. Not ticked yet: Risks says analog walking and camera feel change on every pad, and Testing says the camera feel is not tested.
main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named). (47 fail on this PC onmainand here alike; named in the first comment.)third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.mainand passing here.tests/that reads changed source updated in this PR, not weakened.Tested in game: Windows 11 (26200), RTX 5090, NVIDIA 617.42, Switch Pro Controller over Bluetooth: this branch's host and menu code built into v3.0.0-rc.5 with llvm-mingw; a couple of minutes of rolls straight forward and on diagonals at Stick range 90%, every one rolled; the new row shows in the Controls tab and keeps its value. Earlier build of the same change: fails at 100%, never at 90% (log in the description).
The new row (Insert menu, Controls tab, v3.0.0-rc.5 with this change, Stick range 90%, the default). There is no "before": the row is new.
Tested in the game: Windows 11 (26200), RTX 5090, NVIDIA 617.42, Switch Pro Controller over Bluetooth. This branch's host and menu code built into v3.0.0-rc.5 with llvm-mingw: a couple of minutes of rolls straight forward and on diagonals at 90%, every one rolled. The branch built from
mainhas not been run.The game-free checks that fail on this PC on
main(@6d72ca9) and on this branch alike (47; none reads the files this change touches, except where the description says a fixture was updated, and those pass):the list
WIP: fix(input): Stick range row so a controller's full push counts as full tiltto fix(input): Stick range row so a controller's full push counts as full tiltA pad's full push counts as a full tilt from 90% of its own range. I read head
a466a40f. It applies onto current main, and this stays a comment.hos_stick_rangescales each stick along its own direction, once, after the dead zone, for SDL and for XInput. At 90%, a push at 29,491 on one axis becomes 32,767. A push already at the rim stays there. A diagonal grows in the same proportion and is brought back along that direction if an axis would pass its end. 100%, and any value outside 70 to 100, leaves the stick as the pad reported it. The keyboard and scripted input are not scaled. The row defaults to 90%. The check walks the axes, the diagonal and a grid of angles, and the new strings are in all 13 languages with the counts raised. On a Switch Pro Controller the rolls that failed at 100% landed at 90%. That play was this change built into v3.0.0-rc.5, not a build of this branch from current main.The two runs this asks for are still open: a DualShock 4 or DualSense, full diagonal, at 100% and at 90%; and an Xbox pad on the XInput path at 90%. If #1318 lands first, keep its
lang()rows and these two strings.Brought up to the ready-for-review standard (#1454): the checklist's Everyone list has two new boxes, added here from what this PR's description and comments show (please check they match what you know).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.