fix(input): a stick axis steers once it has been seen at rest (camera spinning on its own) #1677
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!1677
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/stick-seen-at-rest"
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?
Fixes #1673 and #1661: the camera pans or spins by itself, and Link runs in circles, as soon as he can move. Reported with an Xbox 360 pad on CachyOS, and a wired GameSir 2 Lite.
Cause
host/pad_sdl.ctakes each stick as the strongest value across all the open pads. Some devices read an axis as held all the time: a mapping that puts a trigger or an unused axis on a stick, or a second, virtual pad. One of those drives the camera or Link even with the player's own pad at rest.Fix
Each pad lets an axis steer once that axis has been seen at rest since the pad was opened (
hos_stick_axisreturns 0, inside the dead zone). A real stick rests when connected, so it works right away; an axis stuck at full deflection never does.A worn stick that rests just past a small dead zone also counts once it's pushed the other way, since it went past its rest. The bits are kept per pad and per axis and reset when a pad is opened.
Tests
New
tests/test_stick_rest.pycompiles the block frompad_sdl.cand checks:test_stick_dead_zonepasses. Not tested on a real affected controller; the reporters'hid:lines (#1661) would confirm the phantom device.🤖 Generated with Claude Code
Tried version 2.0.14, so if this is merged into that build then it's still happening to me (issue #1673)