Isolate controller-only modes from M&K and native mouse (#2836, #2505, #2489) #2866

Open
github-bot wants to merge 1 commit from github-bot/gh-2866 into main AGit
Owner

@⁠steven-seagull27 on GitHub · 2026-11-29 18:21 UTC · original
steven-seagull27:fix/2836-gamepad-prompts-and-controls → main · +289 −18 · 5 files · 1 commits · open

Related: #2836, #2505, #2489, #2537

Summary

Ensures explicit controller-only modes (VICTORY_CONTROLS=gamepad and VICTORY_CONTROLS=dualsense) completely isolate controller input from leftover mouse-and-keyboard settings (VICTORY_MNK=1 / VICTORY_MNK_BINDINGS), while preserving AUTO-mode keyboard fallback (Enter -> A on the stand-in pad when no gamepad is connected):

  • Controller-only modes cleanly disable M&K, native mouse, and mouse capture (crates/victory-hle/src/modules/{gameinput,mnk,lifecycle}.rs, crates/victory-hle/src/mousehook.rs):
    • mnk_allowed_for(controls) gates mnk::enabled(), mnk::sample(), NATIVE_MOUSE_ON (native_mouse_enabled_for), and xinput_suppressed_for, so a leftover VICTORY_MNK=1 never hijacks the mouse cursor/camera hook or suppresses XInput gamepads in CONTROLS=gamepad mode (while DUALSENSE continues to suppress XInput in favor of native DualSense HID).
    • Host::keys() gates live keyboard polling (GetAsyncKeyState) on live_keyboard_enabled_for(controls(), mnk_on()) (!matches!(controls, Controls::Gamepad | Controls::DualSense)), suppressing live keyboard polling in explicit GAMEPAD / DUALSENSE modes while keeping AUTO-mode keyboard fallback (Enter -> A on the fallback pad when no pad is connected) and KEYBOARD mode working.
    • lifecycle::mouse_capture_enabled() checks !gameinput::pads_only() so legacy cursor capture never traps the pointer in controller-only or default AUTO (M&K off) modes.
  • Launcher parity for default bindings.ini attachment (apps/victory/src/play.rs, scripts/play-foxhound.ps1):
    • Extracted should_emit_mnk_bindings in play.rs and updated scripts/play-foxhound.ps1 so default VICTORY_MNK_BINDINGS is never attached when VICTORY_CONTROLS is gamepad or dualsense.

(Note: Prompt-hook changes from an earlier revision of this PR were superseded by 3222c1eb on main and dropped during the rebase onto cec481f4.)

Verification

All checks run with --locked and synthetic unit tests only:

  • cargo test --locked -j 2 -p victory-hle --lib -- gameinput --test-threads=1 — 88 passed, 0 failed, 2 ignored (includes unit tests for controller-only M&K/native-mouse/XInput policy, live keyboard polling policy including AUTO fallback, and pads-only State::poll device isolation + fallback pad behavior).
  • cargo test --locked -j 2 -p victory --bin victory -- --test-threads=1 — 80 passed, 0 failed (includes should_emit_mnk_bindings unit test in play.rs).
  • cargo clippy --locked -j 2 -p victory-hle -p victory --bins --tests — 0 new warnings in touched files.
  • git diff --check — clean.
**@⁠steven-seagull27** on GitHub · 2026-11-29 18:21 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2866) `steven-seagull27:fix/2836-gamepad-prompts-and-controls` → `main` · +289 −18 · 5 files · 1 commits · open Related: #2836, #2505, #2489, #2537 ## Summary Ensures explicit controller-only modes (`VICTORY_CONTROLS=gamepad` and `VICTORY_CONTROLS=dualsense`) completely isolate controller input from leftover mouse-and-keyboard settings (`VICTORY_MNK=1` / `VICTORY_MNK_BINDINGS`), while preserving `AUTO`-mode keyboard fallback (`Enter` -> A on the stand-in pad when no gamepad is connected): - **Controller-only modes cleanly disable M&K, native mouse, and mouse capture** (`crates/victory-hle/src/modules/{gameinput,mnk,lifecycle}.rs`, `crates/victory-hle/src/mousehook.rs`): - `mnk_allowed_for(controls)` gates `mnk::enabled()`, `mnk::sample()`, `NATIVE_MOUSE_ON` (`native_mouse_enabled_for`), and `xinput_suppressed_for`, so a leftover `VICTORY_MNK=1` never hijacks the mouse cursor/camera hook or suppresses XInput gamepads in `CONTROLS=gamepad` mode (while `DUALSENSE` continues to suppress XInput in favor of native DualSense HID). - `Host::keys()` gates live keyboard polling (`GetAsyncKeyState`) on `live_keyboard_enabled_for(controls(), mnk_on())` (`!matches!(controls, Controls::Gamepad | Controls::DualSense)`), suppressing live keyboard polling in explicit `GAMEPAD` / `DUALSENSE` modes while keeping `AUTO`-mode keyboard fallback (`Enter` -> A on the fallback pad when no pad is connected) and `KEYBOARD` mode working. - `lifecycle::mouse_capture_enabled()` checks `!gameinput::pads_only()` so legacy cursor capture never traps the pointer in controller-only or default `AUTO` (M&K off) modes. - **Launcher parity for default `bindings.ini` attachment** (`apps/victory/src/play.rs`, `scripts/play-foxhound.ps1`): - Extracted `should_emit_mnk_bindings` in `play.rs` and updated `scripts/play-foxhound.ps1` so default `VICTORY_MNK_BINDINGS` is never attached when `VICTORY_CONTROLS` is `gamepad` or `dualsense`. *(Note: Prompt-hook changes from an earlier revision of this PR were superseded by `3222c1eb` on `main` and dropped during the rebase onto `cec481f4`.)* ## Verification All checks run with `--locked` and synthetic unit tests only: - `cargo test --locked -j 2 -p victory-hle --lib -- gameinput --test-threads=1` — **88 passed, 0 failed, 2 ignored** (includes unit tests for controller-only M&K/native-mouse/XInput policy, live keyboard polling policy including `AUTO` fallback, and pads-only `State::poll` device isolation + fallback pad behavior). - `cargo test --locked -j 2 -p victory --bin victory -- --test-threads=1` — **80 passed, 0 failed** (includes `should_emit_mnk_bindings` unit test in `play.rs`). - `cargo clippy --locked -j 2 -p victory-hle -p victory --bins --tests` — **0 new warnings** in touched files. - `git diff --check` — clean.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 18:23:25 +00:00
github-bot changed title from Keep gamepad prompts by default and isolate controller-only modes (#2836, #2505, #2489) to Isolate controller-only modes from M&K and native mouse (#2836, #2505, #2489) 2026-11-29 20:13:04 +00:00
github-bot force-pushed github-bot/gh-2866 from 32fe388fae to cb11b17de6 2026-11-29 20:13:05 +00:00 Compare
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-29 20:12 UTC · original · edited 2026-11-29 20:35 UTC

Rebased onto cec481f4 (cb11b17d):

  • Dropped the superseded apps/victory/src/run.rs and README.md prompt-hook hunks in favor of 3222c1eb already on main.
  • Fixed live_keyboard_enabled_for in crates/victory-hle/src/modules/gameinput.rs so live keyboard polling stays active in Controls::Auto | Controls::Keyboard (preserving keyboard fallback such as Enter -> A on the stand-in pad in default AUTO mode when no pad is connected) and is suppressed only in explicit controller-only modes (Controls::Gamepad | Controls::DualSense).
  • Kept the controller-only M&K / native-mouse / XInput isolation across gameinput.rs, mnk.rs, lifecycle.rs, mousehook.rs, play.rs, and play-foxhound.ps1.

Re-verified with synthetic unit tests (victory-hle gameinput: 88 passed / 0 failed / 2 ignored; victory bin: 80 passed / 0 failed), cargo clippy (0 new warnings in touched files), and git diff --check.

**@⁠steven-seagull27** on GitHub · 2026-11-29 20:12 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2866#issuecomment-7261890309) · edited 2026-11-29 20:35 UTC Rebased onto `cec481f4` (`cb11b17d`): - Dropped the superseded `apps/victory/src/run.rs` and `README.md` prompt-hook hunks in favor of `3222c1eb` already on `main`. - Fixed `live_keyboard_enabled_for` in `crates/victory-hle/src/modules/gameinput.rs` so live keyboard polling stays active in `Controls::Auto | Controls::Keyboard` (preserving keyboard fallback such as `Enter` -> A on the stand-in pad in default `AUTO` mode when no pad is connected) and is suppressed only in explicit controller-only modes (`Controls::Gamepad | Controls::DualSense`). - Kept the controller-only M&K / native-mouse / XInput isolation across `gameinput.rs`, `mnk.rs`, `lifecycle.rs`, `mousehook.rs`, `play.rs`, and `play-foxhound.ps1`. Re-verified with synthetic unit tests (`victory-hle` `gameinput`: 88 passed / 0 failed / 2 ignored; `victory` bin: 80 passed / 0 failed), `cargo clippy` (0 new warnings in touched files), and `git diff --check`.
github-bot force-pushed github-bot/gh-2866 from cb11b17de6 to 1bf8c27e1d 2026-11-30 18:46:42 +00:00 Compare
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-30 18:40 UTC · original

Rebased cleanly onto latest main (e1251c31), updating the launcher guard to scripts/play-nvidia.ps1, extending the controller-only mnk guard to cover bound_buttons and prompt_keys, and harmonizing with #2583 (XInputRoute) and #2734 (InputRouting). Re-verified victory-hle lib tests, victory binary tests, Clippy, and xtask policy --staged.

**@⁠steven-seagull27** on GitHub · 2026-11-30 18:40 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2866#issuecomment-7288192947) Rebased cleanly onto latest `main` (`e1251c31`), updating the launcher guard to `scripts/play-nvidia.ps1`, extending the controller-only `mnk` guard to cover `bound_buttons` and `prompt_keys`, and harmonizing with `#2583` (`XInputRoute`) and `#2734` (`InputRouting`). Re-verified `victory-hle` lib tests, `victory` binary tests, Clippy, and `xtask policy --staged`.
github-bot force-pushed github-bot/gh-2866 from 1bf8c27e1d to 5b1131e65f 2026-12-01 01:03:26 +00:00 Compare
This pull request has changes conflicting with the target branch.
  • crates/victory-hle/src/modules/gameinput.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2866/head:github-bot/gh-2866'
git switch 'github-bot/gh-2866'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2866'
git switch 'github-bot/gh-2866'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2866'
git switch 'github-bot/gh-2866'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2866'
git switch 'main'
git merge --squash 'github-bot/gh-2866'
git switch 'main'
git merge --ff-only 'github-bot/gh-2866'
git switch 'main'
git merge 'github-bot/gh-2866'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
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
github/trustno1-coder--VIctory-NVIDIA!2866
No description provided.