Input: opt-in mouse look on the stand-in pad's right stick #2182

Open
github-bot wants to merge 2 commits from github-bot/gh-2182 into main AGit
Owner

@⁠denkencar-sketch on GitHub · 2026-11-25 07:07 UTC · original
denkencar-sketch:mouse-look → main · +178 −10 · 2 files · 2 commits · open

Summary

Adds opt-in mouse look to the keyboard stand-in pad. With VICTORY_MOUSE_LOOK=<sensitivity> set, mouse movement pushes the stand-in pad's right stick while the title's window has focus. The README lists "no mouse look" as missing input; this is a small step toward it.

  • VICTORY_MOUSE_LOOK=0.05: stick push per pixel moved in one 8 ms poll (20 pixels is full tilt). Unset, zero or invalid: off, behaviour unchanged.
  • Follows the existing rule: a connected host pad turns the stand-in pad off, mouse included.
  • The cursor is put back at the centre of the window each poll while it has focus, so movement never stops at a screen edge. The first sample after gaining focus is ignored.
  • Mouse buttons are not mapped (Z and C still give the triggers).

Changes

  • crates/victory-hle/src/modules/gameinput.rs: Source::mouse (default: no movement), with_mouse, and the Windows host implementation (mouse_sensitivity, stick_push, window_centre).
  • README.md: one paragraph under Input.

Testing

  • cargo test --workspace --locked passes. New tests: pixel-to-stick maths and clamping, and the mouse pushing only the stand-in pad's right stick (not a connected host pad).
  • Not tried in the game. I have not run it in the world, so the sensitivity default and the feel of stick-based look are untested. Treat the value as a starting point.

AI-assisted.

**@⁠denkencar-sketch** on GitHub · 2026-11-25 07:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/2182) `denkencar-sketch:mouse-look` → `main` · +178 −10 · 2 files · 2 commits · open ## Summary Adds opt-in mouse look to the keyboard stand-in pad. With `VICTORY_MOUSE_LOOK=<sensitivity>` set, mouse movement pushes the stand-in pad's right stick while the title's window has focus. The README lists "no mouse look" as missing input; this is a small step toward it. - `VICTORY_MOUSE_LOOK=0.05`: stick push per pixel moved in one 8 ms poll (20 pixels is full tilt). Unset, zero or invalid: off, behaviour unchanged. - Follows the existing rule: a connected host pad turns the stand-in pad off, mouse included. - The cursor is put back at the centre of the window each poll while it has focus, so movement never stops at a screen edge. The first sample after gaining focus is ignored. - Mouse buttons are not mapped (Z and C still give the triggers). ## Changes - `crates/victory-hle/src/modules/gameinput.rs`: `Source::mouse` (default: no movement), `with_mouse`, and the Windows host implementation (`mouse_sensitivity`, `stick_push`, `window_centre`). - `README.md`: one paragraph under Input. ## Testing - `cargo test --workspace --locked` passes. New tests: pixel-to-stick maths and clamping, and the mouse pushing only the stand-in pad's right stick (not a connected host pad). - **Not tried in the game.** I have not run it in the world, so the sensitivity default and the feel of stick-based look are untested. Treat the value as a starting point. AI-assisted.
VICTORY_MOUSE_LOOK=<sensitivity> turns mouse movement into a right-stick push on the keyboard stand-in pad while the window has focus. Off when unset or when a host pad is connected.
The mouse only drives the stand-in pad, which a connected pad turns off, but
poll still called Source::mouse(), so the Windows source kept re-centring the
cursor. Skip it then, and reset the centring state so the first sample after
the pad goes away is discarded.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:57:40 +00:00
Author
Owner

@⁠Dathinel on GitHub · 2026-11-25 07:31 UTC · original

On e31ff5f, connecting a physical pad suppresses the fallback reading, but the poll still calls Source::mouse(). The Windows implementation can therefore keep calling SetCursorPos while the pad is in use, provided mouse look is enabled and the window has focus.

I added a counter to the existing fake mouse and polled once per state: no physical pad → slot 0 connected → disconnected. Calls per poll were 1, 1, 1. Sampling only when all pad slots were empty gave 1, 0, 1 and the existing right-stick test still passed. When disabling sampling, please also reset the centering state so the first poll after unplugging the pad discards any cursor displacement.

AI-assisted Windows unit test with simulated inputs. The cursor effect follows from the Windows implementation; the test did not move the desktop cursor.

**@⁠Dathinel** on GitHub · 2026-11-25 07:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/2182#issuecomment-7155957350) On e31ff5f, connecting a physical pad suppresses the fallback reading, but the poll still calls `Source::mouse()`. The Windows implementation can therefore keep calling `SetCursorPos` while the pad is in use, provided mouse look is enabled and the window has focus. I added a counter to the existing fake mouse and polled once per state: no physical pad → slot 0 connected → disconnected. Calls per poll were **1, 1, 1**. Sampling only when all pad slots were empty gave **1, 0, 1** and the existing right-stick test still passed. When disabling sampling, please also reset the centering state so the first poll after unplugging the pad discards any cursor displacement. AI-assisted Windows unit test with simulated inputs. The cursor effect follows from the Windows implementation; the test did not move the desktop cursor.
Author
Owner

@⁠denkencar-sketch on GitHub · 2026-11-25 08:09 UTC · original

Thanks @⁠Dathinel, confirmed and fixed in 3b0f52d. poll now calls Source::mouse() only while no host pad is connected; otherwise it calls a new Source::mouse_idle(), which resets the Windows centring state so the first sample after unplugging is discarded. The existing pad test now also asserts the fake mouse is not polled while a pad is connected. cargo test -p victory-hle gameinput passes (11 tests); not run in-game.

**@⁠denkencar-sketch** on GitHub · 2026-11-25 08:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/2182#issuecomment-7156671151) Thanks @⁠Dathinel, confirmed and fixed in 3b0f52d. `poll` now calls `Source::mouse()` only while no host pad is connected; otherwise it calls a new `Source::mouse_idle()`, which resets the Windows centring state so the first sample after unplugging is discarded. The existing pad test now also asserts the fake mouse is not polled while a pad is connected. `cargo test -p victory-hle gameinput` passes (11 tests); not run in-game.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 12:40 UTC · original · edited 2026-11-26 01:24 UTC

Automated triage for the maintainers.

Merge candidate. Rebased cleanly. VICTORY_MOUSE_LOOK=<sensitivity> adds the mouse to the stand-in pad's right stick (with_mouse, Host::mouse in crates/victory-hle/src/modules/gameinput.rs); unset, behaviour is unchanged. Following Dathinel's finding, Hub::poll now samples the mouse only while no host pad is active (same seen_input rule as State::poll) and calls mouse_idle otherwise, so the cursor is not re-centred while a pad is in use; the tests cover both. Not tried in the game, as the description says.

Minor: the diff also reflows a few unrelated lines in the tests and unregister_callback; dropping those would keep it focused. #927 also adds a field to host::Host, so whichever lands second needs a trivial rebase.

CI: passing (check).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 12:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/2182#issuecomment-7162699458) · edited 2026-11-26 01:24 UTC <!-- victory-triage v1 head=ab0620061265c59324730959c264b5f56a5ef44e verdict=merge-candidate at=2026-11-26T01:24:40Z --> Automated triage for the maintainers. **Merge candidate.** Rebased cleanly. `VICTORY_MOUSE_LOOK=<sensitivity>` adds the mouse to the stand-in pad's right stick (`with_mouse`, `Host::mouse` in `crates/victory-hle/src/modules/gameinput.rs`); unset, behaviour is unchanged. Following Dathinel's finding, `Hub::poll` now samples the mouse only while no host pad is active (same `seen_input` rule as `State::poll`) and calls `mouse_idle` otherwise, so the cursor is not re-centred while a pad is in use; the tests cover both. Not tried in the game, as the description says. Minor: the diff also reflows a few unrelated lines in the tests and `unregister_callback`; dropping those would keep it focused. #927 also adds a field to `host::Host`, so whichever lands second needs a trivial rebase. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2182'
git switch 'github-bot/gh-2182'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2182'
git switch 'github-bot/gh-2182'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2182'
git switch 'main'
git merge --squash 'github-bot/gh-2182'
git switch 'main'
git merge --ff-only 'github-bot/gh-2182'
git switch 'main'
git merge 'github-bot/gh-2182'
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/Marvisak--VIctory!2182
No description provided.