Mouse: Alt turns the capture on and off, and the captured mouse moves the camera #731

Open
Alexr03 wants to merge 1 commit from upstream-pr/731 into main
Alexr03 commented 2026-11-28 04:37:29 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Alexr03 on 2026-11-28T04:37:29Z.


Why

With MOUSE CAPTURE on, the pointer was hidden and held but the camera did not move: the title registers GameInput callbacks for pads (kind=0x40000) and the keyboard (kind=0x10) only, never for a mouse. And once captured, the only way to get the pointer back was to leave the window.

What

  • Alt turns the capture on and off while playing. A tap of Alt alone (the SC_KEYMENU the window hook already swallows) flips it; the F1 setting is now only what a start begins with. F10 sends the same system command, so it toggles too.
  • The captured mouse is the stand-in pad's right stick, its left button the right trigger and its right button the left trigger, merged with the keyboard and any real pad as those already merge.
  • The stick is a speed: counts per second, measured over the real time between two polls, so it does not change with the poll rate. Any motion starts past the title's dead zone. VICTORY_MOUSE_SENSITIVITY scales it (default 1).
  • The hidden pointer goes back to the middle after each sample by default, or turning stopped at the window's edge. VICTORY_MOUSE_WARP=0 keeps the old behaviour.

+68 lines in gameinput.rs and lifecycle.rs, one label in menu.rs. No new file, page or settings format.

Next to the other open mouse PRs

#142, #581, #482 and #652 all make the same right-stick mapping, so this overlaps with them; take whichever fits. What differs here:

This PR #142 #581 #482 #652
Release and retake the pointer while playing Alt not described not described not described not described (its middle button switches look/menu mode, not the capture)
Mouse look once captured always on, VICTORY_MOUSE_STICK=0 off off by default, F1 switch on on
Stick from counts per second pixels per poll – carry-over past full deflection smoothed
Size +68 +92 +246 +1289 +1138

What the others have and this does not: smoothing across polls (#142, #652), inverted Y (#142, #482), a mouse mode for menus and the map (#652), and key remapping with a page for it (#482, #652). The Alt toggle is independent of all of that and could sit on top of any of them.

Testing

  • New unit test mouse_motion_deflects_the_stick; cargo test -p victory-hle --lib: 189 passed.
  • Played on Windows 11 at 2560x1440: Alt hides and frees the pointer, and the build with the stick mapping was run. The camera's feel at the default sensitivity has not been tuned.
  • Not tried: a real pad connected at the same time, and VICTORY_ONE_PAD=0.

https://claude.ai/code/session_01QmkPjpdyRtUQoYdtCcv7fU

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5536708369 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/731). Originally posted by [Alexr03](https://github.com/Alexr03) on 2026-11-28T04:37:29Z. --- ## Why With MOUSE CAPTURE on, the pointer was hidden and held but the camera did not move: the title registers GameInput callbacks for pads (`kind=0x40000`) and the keyboard (`kind=0x10`) only, never for a mouse. And once captured, the only way to get the pointer back was to leave the window. ## What - **Alt turns the capture on and off while playing.** A tap of Alt alone (the `SC_KEYMENU` the window hook already swallows) flips it; the F1 setting is now only what a start begins with. F10 sends the same system command, so it toggles too. - **The captured mouse is the stand-in pad's right stick**, its left button the right trigger and its right button the left trigger, merged with the keyboard and any real pad as those already merge. - The stick is a speed: counts per second, measured over the real time between two polls, so it does not change with the poll rate. Any motion starts past the title's dead zone. `VICTORY_MOUSE_SENSITIVITY` scales it (default 1). - **The hidden pointer goes back to the middle after each sample by default**, or turning stopped at the window's edge. `VICTORY_MOUSE_WARP=0` keeps the old behaviour. +68 lines in `gameinput.rs` and `lifecycle.rs`, one label in `menu.rs`. No new file, page or settings format. ## Next to the other open mouse PRs #142, #581, #482 and #652 all make the same right-stick mapping, so this overlaps with them; take whichever fits. What differs here: | | This PR | #142 | #581 | #482 | #652 | | --- | --- | --- | --- | --- | --- | | Release and retake the pointer while playing | Alt | not described | not described | not described | not described (its middle button switches look/menu mode, not the capture) | | Mouse look once captured | always | on, `VICTORY_MOUSE_STICK=0` off | off by default, F1 switch | on | on | | Stick from | counts per second | pixels per poll | – | carry-over past full deflection | smoothed | | Size | +68 | +92 | +246 | +1289 | +1138 | What the others have and this does not: smoothing across polls (#142, #652), inverted Y (#142, #482), a mouse mode for menus and the map (#652), and key remapping with a page for it (#482, #652). The Alt toggle is independent of all of that and could sit on top of any of them. ## Testing - New unit test `mouse_motion_deflects_the_stick`; `cargo test -p victory-hle --lib`: 189 passed. - Played on Windows 11 at 2560x1440: Alt hides and frees the pointer, and the build with the stick mapping was run. The camera's feel at the default sensitivity has not been tuned. - Not tried: a real pad connected at the same time, and `VICTORY_ONE_PAD=0`. https://claude.ai/code/session_01QmkPjpdyRtUQoYdtCcv7fU
Dukestar69 commented 2026-11-28 04:44:47 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-28T04:44:47Z.

Review: APPROVED


LGTM — verified on Windows:

  • cargo test -p victory-hle --lib gameinput passed (27/27, including mouse_motion_deflects_the_stick)
  • cargo test -p victory-gpu --lib host::menu:: passed (7/7)
  • 0 new compiler warnings in touched files
  • cargo xtask policy passed (294 files ok)

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review:6095862075 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/731#pullrequestreview-6095862075). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-28T04:44:47Z. **Review:** APPROVED --- LGTM — verified on Windows: - `cargo test -p victory-hle --lib gameinput` passed (27/27, including `mouse_motion_deflects_the_stick`) - `cargo test -p victory-gpu --lib host::menu::` passed (7/7) - 0 new compiler warnings in touched files - `cargo xtask policy` passed (`294 files ok`) Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/731:upstream-pr/731'
git switch 'upstream-pr/731'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/731'
git switch 'upstream-pr/731'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/731'
git switch 'upstream-pr/731'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/731'
git switch 'main'
git merge --squash 'upstream-pr/731'
git switch 'main'
git merge --ff-only 'upstream-pr/731'
git switch 'main'
git merge 'upstream-pr/731'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
trustno1-coder/VIctory-NVIDIA!731
No description provided.