Skip to content

Consume inputtino's runtime joypad factory (Xbox/PS5/Switch Pro/Joy-Con) - #445

Open
kmreisi wants to merge 1 commit into
games-on-whales:stablefrom
kmreisi:feature/runtime-uhid-uinput-joypads
Open

Consume inputtino's runtime joypad factory (Xbox/PS5/Switch Pro/Joy-Con)#445
kmreisi wants to merge 1 commit into
games-on-whales:stablefrom
kmreisi:feature/runtime-uhid-uinput-joypads

Conversation

@kmreisi

@kmreisi kmreisi commented Jun 24, 2026

Copy link
Copy Markdown

Consolidates the controller work into one change: wolf opts into inputtino's runtime joypad factory, and Switch Pro + Joy-Con come along for free from inputtino (this supersedes #385, which I closed).

Adopting the factory is optional — inputtino keeps the per-type API (PS5Joypad::create, set_motion, …) working, so this is wolf choosing to migrate, not a forced change.

What it does

  • Creates joypads via inputtino::Joypad::create(Joypad::TYPE, def, prefer_uhid) — one code path for Xbox / PS5 / Switch Pro / Joy-Con, using the rich uhid pad when /dev/uhid is present and the uinput fallback otherwise. Drops wolf's hand-rolled uinput joypad wrapper.
  • Maps wolf ControllerTypeJoypad::TYPE, incl. JOYCON_LEFT/JOYCON_RIGHT. Device identities come from inputtino::Joypad::default_definition() — no hard-coded vendor/product ids in wolf (it only stamps a per-session uniq on the Nintendo pads).
  • Motion via the generic set_gyro() / set_accel().
  • JoypadTypes is now the generic inputtino::Joypad (not a variant); the lobby plug/unplug sites call the base methods directly.

Joy-Con selection is wired through the existing per-client override (controllers_override / motion_controller_override) — the wire protocol only carries XBOX/PS/NINTENDO, so a Joy-Con is opt-in via that override for now (a future Moonlight extension could send individual Joy-Cons).

Scope / dependencies

Built locally against the inputtino branch (full wolf binary links clean).

@kmreisi
kmreisi force-pushed the feature/runtime-uhid-uinput-joypads branch 3 times, most recently from 346011c to 9ff2504 Compare June 26, 2026 14:18
@kmreisi kmreisi changed the title [Draft] Use inputtino runtime joypad factory; drop joypad wrappers + per-app uhid Consume inputtino's runtime joypad factory (Xbox/PS5/Switch Pro/Joy-Con) Jun 26, 2026
@kmreisi
kmreisi marked this pull request as ready for review June 26, 2026 14:22
Comment thread src/core/CMakeLists.txt
# Repoint to games-on-whales/inputtino once those land on stable.
FetchContent_Declare(
inputtino
GIT_REPOSITORY https://github.com/games-on-whales/inputtino.git

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't merge until this has been changed.

@kmreisi
kmreisi force-pushed the feature/runtime-uhid-uinput-joypads branch from 9ff2504 to 79d5f1c Compare June 28, 2026 06:05
Replace wolf's hand-rolled per-type joypad creation with the inputtino runtime
factory, so Xbox / PS5 / Switch Pro / Joy-Con all come from one code path and the
rich uhid pads are used when the host exposes /dev/uhid (uinput fallback
otherwise). The Switch Pro and Joy-Con support lives in inputtino now, so the old
wolf-side per-controller workarounds are gone.

- create joypads via inputtino::Joypad::create(Joypad::TYPE, def, prefer_uhid);
  drop the wolf uinput joypad wrapper (platforms/linux/uinput/joypad.cpp).
- map wolf ControllerType -> Joypad::TYPE, including JOYCON_LEFT / JOYCON_RIGHT;
  device identities come from inputtino::Joypad::default_definition() instead of
  hard-coded vendor/product ids (wolf only stamps a per-session uniq on the
  Nintendo pads).
- motion uses the generic set_gyro() / set_accel() (deg/s, m/s^2).
- JoypadTypes is now the generic inputtino::Joypad (not a variant): adapt the
  lobby plug/unplug sites to call the base methods directly.

Selecting a Joy-Con is wired through the existing per-client controller override
(controllers_override / motion_controller_override); the wire protocol still only
carries XBOX/PS/NINTENDO, so Joy-Cons are opt-in via that override for now.

Adopting the inputtino factory is optional (the per-type API still works); this is
wolf opting in. Depends on the inputtino runtime-joypad-factory stack
(games-on-whales/inputtino roadmap issue games-on-whales#44 -> PRs games-on-whales#42/games-on-whales#43/games-on-whales#40/games-on-whales#37/games-on-whales#41); the
FetchContent pin points at that fork's joycon branch tip until it lands on stable.

Reconnect-related changes (CAP_NET_ADMIN, lobby joypad hand-off / games-on-whales#435 leak fix,
replace-on-rearrival) are intentionally out of scope and come as a separate set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant