Skip to content

feat(input): configure a held Guide button combination - #6188

Open
MaomaoADHD wants to merge 1 commit into
SunshineStream:masterfrom
MaomaoADHD:feat/guide-chord-for-moonlight
Open

MaomaoADHD wants to merge 1 commit into
SunshineStream:masterfrom
MaomaoADHD:feat/guide-chord-for-moonlight

Conversation

@MaomaoADHD

Copy link
Copy Markdown

Description

Some controllers expose ordinary buttons to Moonlight but do not deliver a usable Home/Guide button to the host. On my 8BitDo Ultimate 2C Wireless over Bluetooth, Home is not forwarded as Xbox Guide; holding it powers off the controller. Sunshine receives the other gamepad inputs normally through Moonlight and ViGEmBus with Xbox 360 emulation.

Sunshine already offers back_button_timeout, but its long-Back path emits a roughly 100 ms Guide press. That cannot serve interactions that need Guide to stay down, such as Guide plus stick mouse control in Steam. Back/Select also cannot be assigned to R4 in my controller setup. Remapping the physical Home button is not a workable solution because it powers off the controller.

This PR adds the opt-in guide_button_combo setting. The Inputs tab lets users select any combination of at least two buttons from A, B, X, Y, L1, L2, R1, and R2. The setting is disabled by default. While all selected buttons remain pressed, Sunshine sends a continuously held Home/Guide state and suppresses the selected buttons. Releasing any selected button immediately releases Guide and restores normal button behavior. Other controls, including the D-pad and sticks, continue to pass through. L2/R2 count as pressed at half travel. The existing Back/Select timeout remains independent; users can set it to -1 if they do not want its separate long-press shortcut.

My tested controller layout uses L4 for Moonlight's Start+Select+L1+R1 quit-session combination and R4 for X+Y+L1+R1. With guide_button_combo = x+y+l1+r1, R4 produces a real, held Guide button for Steam, while L4 exits Moonlight. These are my mappings, not defaults imposed on other users. They let the Ultimate 2C Wireless remain usable without its physical Home button.

The implementation reuses the existing Home flag, which the Windows Xbox 360 backend maps to XUSB_GAMEPAD_GUIDE. It adds no new driver or dependency. The configuration parser rejects unknown, duplicate, and single-button combinations; the UI warns when only one button is selected.

Screenshot

The Inputs tab adds eight labeled checkboxes directly below the Back/Select timeout. The Vue test covers selection, serialization, clearing, and the disabled-gamepad state.

Issues Fixed or Closed

Roadmap Issues

Testing

  • Windows UCRT64: cmake --build ... --target sunshine test_sunshine passed.
  • test_sunshine --gtest_filter=InputGamepadSessionTest.*:ConfigParsingTest.*:ConfigPersistenceTest.*: 29 passed. New tests cover disabled default, continuous Guide hold, partial release, D-pad passthrough, L2/R2 thresholds, parsing, and configuration application.
  • npm run build passed. npm test: 220 passed after temporarily normalizing docs/configuration.md to LF; the file was restored byte-for-byte afterward. On this Windows checkout, one unrelated existing documentation test searches for LF after external_audio and fails with CRLF.
  • Manual validation of the earlier hardcoded four-button prototype on Windows with the 8BitDo Ultimate 2C Wireless, Moonlight, ViGEmBus, Xbox 360 emulation, and Steam: Guide opened and menu navigation worked after releasing the combination. The new configurable path has automated coverage but has not yet been deployed for a second hardware test.
  • The unfiltered C++ suite stopped progressing for about 14 minutes at RtspResponseTest.CommonDispatcherPreservesResponsesWithoutServerContext, unrelated to this change, so it was stopped. The 29 input and configuration tests above passed separately.

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

Codex helped inspect Sunshine and Moonlight code, implement the configuration and UI, and run the tests. The controller behavior and successful prototype test were reported by the user.

This pull request was generated by Codex (GPT-6; thinking level not exposed in this session).

@MaomaoADHD

Copy link
Copy Markdown
Author

This pull request was generated by Codex (GPT-6; thinking level not exposed in this session).

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
4 New issues

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

1 participant