Idea: Adopt PrimeRecomp's direct-HID gyro implementation #2974

Open
opened 2026-12-01 21:10:33 +00:00 by tedfart · 3 comments

The idea

I'd like to request expanding Longshot's native gyroscope support to allow reading physical controller motion data directly, even when Steam Input is enabled and exposing a virtual Xbox controller.

Problem Statement:

When launching a game through Steam with Steam Input enabled, Steam frequently exposes a virtual controller that lacks accelerometer and gyroscope sensors.

SDL may consequently see only this virtual controller, preventing applications like Longshot from receiving the physical controller's motion data.

Disabling Steam Input can restore native sensor access in some cases, but sacrifices Steam Input's useful button remapping, trackpad configuration, controller profiles and other functionality.

Ideally, Longshot should support native motion aiming without requiring users to choose between Steam Input and gyro functionality.

Proposed solution:

Adapt or take inspiration from PrimeRecomp's direct-HID motion reader.

PrimeRecomp recently implemented this functionality for Metroid Prime Remastered, including explicit support for the new 2026 Steam Controller on Windows and Linux.

This seems like an excellent reference for extending Longshot's existing Steam Deck-specific gyro workaround.

Reference implementation:

PrimeRecomp — Direct gyro through Steam Input

Implementation commit: github.com/gminustwo/primerecomp@37d36e5882

Original feature discussion: https://github.com/gminustwo/primerecomp/issues/73

Motion implementation: https://github.com/gminustwo/primerecomp/blob/main/runtime/hle/motion.c

Windows HID implementation: https://github.com/gminustwo/primerecomp/blob/main/runtime/platform/windows.c

Related Longshot work:

Steam Deck direct IMU commit: c6022bcdc9

Existing DSU/Cemuhook request: #2733

PrimeRecomp separates controller input into two paths:

Buttons, triggers and analog sticks: Continue using the Steam Input virtual controller through SDL.

Gyroscope and accelerometer: Read motion reports directly from the underlying physical controller when SDL's active controller does not expose usable sensors.

The implementation uses read-only access to HID input reports so that Steam can continue managing mappings, trackpads, LEDs and controller configuration.

On Windows, it uses cfgmgr32 device enumeration and ReadFile, avoiding the standard HID discovery APIs that Steam's overlay can intercept.

On Linux, it reads controller reports through /dev/hidraw.

It supports multiple device families and converts their motion reports into values compatible with SDL's sensor conventions.

Requested controller support

Ideally:

Steam Controller (2026), including USB, Bluetooth and wireless receiver connections

Steam Deck built-in controls

DualSense / DualSense Edge

DualShock 4

Switch Pro Controller

Joy-Con

The original 2015 Steam Controller would also be a welcome addition if feasible, although PrimeRecomp's referenced direct reader does not currently implement it.

PrimeRecomp identifies the 2026 Steam Controller using Valve vendor ID 0x28DE and product IDs 0x1302–0x1305.

Suggested behavior:

Prefer native SDL motion sensors whenever available.

Fall back to direct HID motion when Steam Input's virtual controller lacks gyro data.

Keep Steam Input responsible for buttons and analog controls.

Avoid modifying the physical controller's operating mode or settings.

Provide a toggle to disable direct HID reading for troubleshooting.

Display the active motion source in Longshot's controller settings or logs.

Avoid double-counting motion if both SDL and HID provide sensor readings.

Re-detect sensors after disconnect/reconnect or sleep/resume.

Suggested acceptance criteria:

A user can launch Longshot through Steam on Windows with Steam Input enabled.

A supported physical controller's gyroscope works for native aiming without gyro-to-mouse mapping.

Steam Input's regular button, stick and trackpad mappings continue functioning.

The same behavior works under Linux where supported HID access is available.

Unsupported controllers fall back gracefully to existing input handling.

Thanks for considering it!

Anything else

No response

### The idea I'd like to request expanding Longshot's native gyroscope support to allow reading physical controller motion data directly, even when Steam Input is enabled and exposing a virtual Xbox controller. **Problem Statement:** When launching a game through Steam with Steam Input enabled, Steam frequently exposes a virtual controller that lacks accelerometer and gyroscope sensors. SDL may consequently see only this virtual controller, preventing applications like Longshot from receiving the physical controller's motion data. Disabling Steam Input can restore native sensor access in some cases, but sacrifices Steam Input's useful button remapping, trackpad configuration, controller profiles and other functionality. Ideally, Longshot should support native motion aiming without requiring users to choose between Steam Input and gyro functionality. **Proposed solution:** Adapt or take inspiration from PrimeRecomp's direct-HID motion reader. PrimeRecomp recently implemented this functionality for Metroid Prime Remastered, including explicit support for the new 2026 Steam Controller on Windows and Linux. This seems like an excellent reference for extending Longshot's existing Steam Deck-specific gyro workaround. Reference implementation: PrimeRecomp — Direct gyro through Steam Input Implementation commit: https://github.com/gminustwo/primerecomp/commit/37d36e5882028d872234c79ed0b95ed8851485f9 Original feature discussion: https://github.com/gminustwo/primerecomp/issues/73 Motion implementation: https://github.com/gminustwo/primerecomp/blob/main/runtime/hle/motion.c Windows HID implementation: https://github.com/gminustwo/primerecomp/blob/main/runtime/platform/windows.c Related Longshot work: Steam Deck direct IMU commit: https://git.magicbean.dev/MagicBeanDev/Longshot/commit/c6022bcdc9d2fa5262d0cd8c3cb460a825052717 Existing DSU/Cemuhook request: https://git.magicbean.dev/MagicBeanDev/Longshot/issues/2733 PrimeRecomp separates controller input into two paths: Buttons, triggers and analog sticks: Continue using the Steam Input virtual controller through SDL. Gyroscope and accelerometer: Read motion reports directly from the underlying physical controller when SDL's active controller does not expose usable sensors. The implementation uses read-only access to HID input reports so that Steam can continue managing mappings, trackpads, LEDs and controller configuration. On Windows, it uses cfgmgr32 device enumeration and ReadFile, avoiding the standard HID discovery APIs that Steam's overlay can intercept. On Linux, it reads controller reports through /dev/hidraw. It supports multiple device families and converts their motion reports into values compatible with SDL's sensor conventions. Requested controller support Ideally: Steam Controller (2026), including USB, Bluetooth and wireless receiver connections Steam Deck built-in controls DualSense / DualSense Edge DualShock 4 Switch Pro Controller Joy-Con The original 2015 Steam Controller would also be a welcome addition if feasible, although PrimeRecomp's referenced direct reader does not currently implement it. PrimeRecomp identifies the 2026 Steam Controller using Valve vendor ID 0x28DE and product IDs 0x1302–0x1305. **Suggested behavior:** Prefer native SDL motion sensors whenever available. Fall back to direct HID motion when Steam Input's virtual controller lacks gyro data. Keep Steam Input responsible for buttons and analog controls. Avoid modifying the physical controller's operating mode or settings. Provide a toggle to disable direct HID reading for troubleshooting. Display the active motion source in Longshot's controller settings or logs. Avoid double-counting motion if both SDL and HID provide sensor readings. Re-detect sensors after disconnect/reconnect or sleep/resume. **Suggested acceptance criteria:** A user can launch Longshot through Steam on Windows with Steam Input enabled. A supported physical controller's gyroscope works for native aiming without gyro-to-mouse mapping. Steam Input's regular button, stick and trackpad mappings continue functioning. The same behavior works under Linux where supported HID access is available. Unsupported controllers fall back gracefully to existing input handling. _Thanks for considering it!_ ### Anything else _No response_
Member

Possibly related, for context:

  • issue #2733 Idea: Add custom DSU (Cemuhook UDP) server support for gyroscope input — Related request for DSU as a separate gyro source under Steam Input; this asks for direct HID instead.
  • PR #2660 fix(input): the Steam Deck's own gyro when Steam Input hides it — Merged direct-IMU fallback solves the Steam Input gyro issue for Steam Deck only.
  • PR #2802 fix(host): the Deck's IMU setting is read where the reply puts it, so its sensors are turned on — Merged follow-up fixes the Deck-specific IMU fallback's sensor activation.
Possibly related, for context: - issue #2733 Idea: Add custom DSU (Cemuhook UDP) server support for gyroscope input — Related request for DSU as a separate gyro source under Steam Input; this asks for direct HID instead. - PR #2660 fix(input): the Steam Deck's own gyro when Steam Input hides it — Merged direct-IMU fallback solves the Steam Input gyro issue for Steam Deck only. - PR #2802 fix(host): the Deck's IMU setting is read where the reply puts it, so its sensors are turned on — Merged follow-up fixes the Deck-specific IMU fallback's sensor activation.
Member

From Discord:

A user on Bazzite reports an 8BitDo Pro 3 is not detected in Direct Input mode in Longshot (including menu movement and binding setup), although it worked in Direct Input with gyro in the last Hookshot release. Enabling Switch Pro Controller mode on the pad makes it work without Steam Input. This is a report of non-Steam-Input controller detection, distinct from the Steam Input gyro issue tracked here.

From [Discord](https://discord.com/channels/1569849200047427645/1577931433488556062/1577931433488556062): A user on Bazzite reports an 8BitDo Pro 3 is not detected in Direct Input mode in Longshot (including menu movement and binding setup), although it worked in Direct Input with gyro in the last Hookshot release. Enabling Switch Pro Controller mode on the pad makes it work without Steam Input. This is a report of non-Steam-Input controller detection, distinct from the Steam Input gyro issue tracked here.
Member

From Discord:

The reporter confirms that disabling Steam Input / using the workaround made motion aiming work.

From [Discord](https://discord.com/channels/1569849200047427645/1569849200617726065/1578943339422556243): The reporter confirms that disabling Steam Input / using the workaround made motion aiming work.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot#2974
No description provided.