Read the gyro from the controller behind Steam Input's virtual gamepad when the game is started from Steam, from the patch in issue #1282

A game Steam starts gets SDL_GAMECONTROLLER_IGNORE_DEVICES with the controllers Steam reads itself and sees Steam's
virtual gamepad, which has no motion sensors. input.c steam_reveal keeps that list and clears the hint before
SDL_Init (only with motion on); scan_pads still takes the virtual pad for buttons and sticks, so Steam's remapping
holds, and motion_source opens the hidden controller for its gyro and accelerometer only. A bias belongs to the pad
as Steam presents it: " (Steam Input)" or " (under Steam)" in gyro_bias_pad. docs/controls.md, "Steam Input and
motion", says the Steam layout must bind the gyro to something or Steam zeroes it on the Steam Controller.

The patch as posted against 6151ac4, with sensors_ready merged with #1274's restart. Tested by the author on Linux
(Steam Controller) and the Steam Deck; not on Windows.

Co-authored-by: St5sz2Jk <St5sz2Jk@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
committed 2026-11-18 09:08:13 +03:00
1 parent 45a0cd1f6c
commit 2dbdcf9a37
2 files changed
+167 -26

No files matched your search

+18
View File
@@ -246,6 +246,24 @@ Windows does not present the Switch 2 Pro Controller as a gamepad SDL can open (
Bridges that output a ViGEm DualShock 4 (ProCon2Windows, connectyourpro as tested) give buttons and rumble but no motion: their virtual DualShock 4 reports a gyro and an accelerometer that never change, so motion aiming and Ultrahand rotation do nothing. Run one bridge at a time; Steam Input can also claim the controller, so close Steam if the bridge does not find it.
## Steam Input and motion
A game Steam starts sees Steam's virtual gamepad in place of the controllers Steam Input reads (Steam lists them in
`SDL_GAMECONTROLLER_IGNORE_DEVICES`), and that virtual pad has no gyro or accelerometer. With `motion = 1` the game
clears that list before SDL starts (`runtime/input.c`, `steam_reveal`): buttons and sticks still come from the virtual
pad, so Steam's remapping applies and nothing is read twice, and when the virtual pad has no sensors the motion thread
opens the real controller behind it for its gyro and accelerometer only (`motion_source`). The log then shows
`input: motion from "<name>" (<vendor>:<product>), the controller behind Steam Input's virtual gamepad`. This covers the
Steam Controller and the Steam Deck's built-in controls, which Steam Input cannot be turned off for, and other
controllers Steam Input wraps. With `motion = 0` at start Steam's list stays in force.
Steam switches the controller's gyro off while the game's layout binds nothing to it: the reports keep coming with the
gyro at zero, and the game's request for it (SDL renews it every 3 s) does not win. The layout needs a gyro binding,
for example Gyro Behavior "As Mouse"; its activation only decides when Steam itself moves the mouse, the game gets the
gyro all the time. Pick an activation the game does not need (a back button), or Steam's mouse turns the camera on top
of the game's own motion. Under Steam the Steam Controller's gyro arrives already corrected, so it keeps a bias of its
own (`gyro_bias_pad` ends in "(under Steam)").
## Scripted input
`TOTK_INPUT_SCRIPT=<file>` replays presses. It is ORed with real input and still applies under `TOTK_INPUT=none`. One event per line, `#` starts a comment: