Skip to content

Conversation

@ruffsl
Copy link
Owner

@ruffsl ruffsl commented Dec 29, 2025

Allows user to dynamically change mux mode and rumble setting while mux is running, avoiding the need to recreate the virtual device and subsequently throwing off any games or programs actively interfacing with the virtual gamepad.

Also make it simpler to try and swap between mux modes for experimenting or context switching.

- Refactor mux_manager to return runtime-updatable settings (Arc<RuntimeSettings>) alongside MuxHandle
- Remove all attempts to clone or store MuxHandle for live updates; only use for shutdown
- Update tray state and logic to store and use Arc<RuntimeSettings> for dynamic changes
- Allow system tray and CLI to change mux mode and rumble settings on the fly, without restarting the mux
- Add PartialEq to ModeType and RumbleTarget for runtime comparison
- Implement manual Clone for GamepadResource to support resource management
- Fix shutdown logic to use tuple return from start_mux
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enables live runtime updates for mux mode and rumble settings while the application is running. Previously, these settings were disabled in the system tray when the mux was active, requiring users to stop and restart to change them.

Key changes:

  • Introduces a new RuntimeSettings struct with thread-safe Arc<RwLock<>> storage for dynamic configuration updates
  • Modifies the tray UI to keep mode and rumble menus enabled during runtime
  • Implements live polling in both input and FF loops to detect and apply setting changes

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/mux_runtime.rs Adds RuntimeSettings struct for thread-safe live updates; modifies run_input_loop and run_ff_loop to check for configuration changes; adds build_ff_targets helper function
src/tray/state.rs Adds runtime_settings field to TrayState for sharing configuration with running threads
src/tray/app.rs Enables mode and rumble menus during runtime; adds live update logic with notifications when settings change
src/mux_manager.rs Updates start_mux to return RuntimeSettings alongside MuxHandle; passes runtime settings to both threads
src/mux_modes/mod.rs Adds PartialEq derive to ModeType for comparison in change detection
src/main.rs Updates to handle new tuple return type from start_mux
src/gilrs_helper.rs Implements Clone for GamepadResource to support resource sharing across threads
README.md Updates documentation to reflect live configuration capabilities

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.

Comments suppressed due to low confidence (1)

src/tray/app.rs:421

  • The is_selected logic uses verbose pattern matching instead of the simpler equality check that would work now that PartialEq is implemented for ModeType. Consider replacing the match pattern with a direct comparison: state.mode == mode
    let is_selected = matches!(
        (&state.mode, &mode),
        (ModeType::Priority, ModeType::Priority)
            | (ModeType::Average, ModeType::Average)
            | (ModeType::Toggle, ModeType::Toggle)
    );

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Changed the signatures of RuntimeSettings::update_mode and update_rumble to return () instead of the previous value. Their return values were unused by all callers, which already track the old value separately. This improves clarity and consistency.
Replaced verbose pattern matching with a direct equality check (state.mode == mode) in create_mode_item, leveraging PartialEq for ModeType. This makes the code more concise and idiomatic.
@ruffsl ruffsl merged commit 7b103f6 into main Dec 30, 2025
1 check passed
@ruffsl ruffsl deleted the feature/dynamic_modes branch December 30, 2025 05:53
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.

2 participants