Skip to content

feat(profiles): expose rear paddles on the generic gamepad - #240

Open
iphikles3000 wants to merge 2 commits into
LizardByte:masterfrom
iphikles3000:generic-rear-paddles
Open

iphikles3000 wants to merge 2 commits into
LizardByte:masterfrom
iphikles3000:generic-rear-paddles

Conversation

@iphikles3000

@iphikles3000 iphikles3000 commented Nov 30, 2026 •

Copy link
Copy Markdown

Description

Moonlight can send four rear paddles (PADDLE1-4), but none of the built-in profiles exposes them, so controllers with extra buttons (Xbox Elite paddles, 8BitDo Ultimate 2 L4/R4/PL/PR, ...) lose those inputs on the host. This PR adds four rear paddles to the generic gamepad profile, which does not need to match a real controller's report layout.

  • HID descriptor: buttons 17-20 plus 4 bits of padding after the six axes. The generic input report grows from 9 to 10 bytes.
  • Support flags: gamepad_profile_support() reports supported_rear_paddle_count = 4 for GamepadProfileKind::generic (all other profiles unchanged).
  • Linux uinput: generic paddles use BTN_TRIGGER_HAPPY5-BTN_TRIGGER_HAPPY8 (xpad's Elite paddle convention).
  • Windows VHF queue: the paddle byte is treated as discrete state, so short paddle presses are not coalesced away.

Note for reviewers: the generic report layout changes (one byte appended, buttons 1-16 and the axes keep their positions). Games with a saved DirectInput mapping for the generic controller should be unaffected, but it is a visible change in joy.cpl (20 instead of 16 buttons).

Screenshot

Issues Fixed or Closed

Roadmap Issues

Testing

Added/updated tests:

  • ReportTest.PacksStandardGamepadPaddles (new): paddle bits land in byte 9.
  • ReportTest.PacksStandardGamepadReport: checks the new paddle byte is zero.
  • GamepadAdapterTest.RejectsUnsupportedPartialUpdates: paddle1 is now accepted on the generic profile.
  • WindowsVhfInputReportQueueTest.PreservesGenericRearPaddleTransitions (new); existing generic queue tests use the 10-byte report.

Run locally on Linux (Ubuntu 24.04, GCC 13): all report, adapter, profile and Windows VHF queue unit tests pass. Tests that need a writable /dev/uinput or /dev/uhid could not run in that environment, so the Linux uinput paddle path is compiled but not exercised. The build used LIBVIRTUALHID_WARNINGS_AS_ERRORS=OFF because of a pre-existing GCC 13 unused-parameter warning in uhid_backend.cpp, unrelated to this change.

Manual validation on Windows: an earlier version of the descriptor/report change (without the Linux and VHF queue parts) was built into Sunshine and streamed from Moonlight on an LG webOS TV with an 8BitDo Ultimate 2 in D-input mode. joy.cpl showed the generic controller with 20 buttons; the extra buttons registered as buttons 17-20: R4 = 17 (paddle1), L4 = 18 (paddle2), PR = 19 (paddle3), PL = 20 (paddle4). This matches SDL's paddle order (upper right, upper left, lower right, lower left). macOS was not tested.

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Tests have been added or updated for new or modified functionality, including regression tests for bug fixes

AI Usage

See our AI usage policy.

  • AI tools were used while preparing this PR

Code, tests and this description were written by Claude; I reviewed and tested the result on my setup.

This pull request was generated by Claude (Anthropic), model Claude Opus 5.5, low thinking level

The Generic Controller now reports four rear paddles so streaming hosts
can forward controllers with extra buttons (e.g. Xbox Elite paddles or
8BitDo L4/R4/PL/PR) without impersonating a specific controller.

- HID descriptor: buttons 17-20 plus 4 bits of padding after the axes;
  the input report grows from 9 to 10 bytes.
- gamepad_profile_support() reports four rear paddles for generic.
- Linux uinput: paddles use BTN_TRIGGER_HAPPY5-8 (xpad Elite convention).
- Windows VHF queue: the paddle byte counts as discrete state so short
  paddle presses are not coalesced away.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011RbsW5KwLNXUJBNjp2Rz5B
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Address SonarCloud findings: build the generic paddle byte with
std::byte and use "using enum" in the paddle report test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011RbsW5KwLNXUJBNjp2Rz5B
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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.

3 participants