#485

Controllers: gyro aim and turbo for player 1

Openinsertfloppywants to merge intofrom

Requested by Cameron · project thread

Gyro aim and turbo, per game and off by default, under Game details › Controls › Gyro aim & turbo and the same page in the in-game Session menu. Two commits.

Changes

  1. Gyro aim and turbo for player 1 (new PadAssist.swift). Gyro aim adds the controller's rotation (DualSense, DualShock 4, Switch Pro, Joy-Con) or the device's own gyro to the right stick: always or while holding LT/LB/RB, yaw or roll to turn, sensitivity 0.25×–4×, an anti-dead zone and inversion. Turbo repeats chosen buttons (A/B/X/Y/LB/RB/LT/RT) 5–30 times a second while held, touch buttons included. It's applied in GamepadInput.sample() after the touch merge, so XInput, the HID controller and the stick mouse all see it. Settings live in LibraryEntry.padAssist.
  2. Move the mouse when the game sees no controller. A mouse game with no controller has no player 1, so the right stick gyro aim fed went nowhere. A Moves choice (Automatic, Right stick, Mouse) now moves the mouse when there is no controller for the game, or in keyboard-and-mouse mode. The 4 ms poll runs for it without a pad.

Docs: CONTROLLERS.md, "Gyro aim and turbo". [pad-assist] log lines record each session's choices. tests/host/check-pad-assist.py covers the math (settings decoding, gyro scaling, the anti-dead zone, turbo timing).

Testing

  • On device (iPhone, sideloaded build): gyro aim with no controller, using the device's gyro to move the mouse, works. Turbo and gyro from a physical controller weren't part of that test.
  • This branch: the two commits applied to main c2c1b03a without conflicts. They aren't compiled here (no Swift toolchain), so CI is the first compile on this base.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LiLQakAySboBR7FkqkJFKS