Skip to content

Input: add mouse camera control to the fallback pad - #33

Merged
devin-ai-integration[bot] merged 1 commit into
mainfrom
devin/1795587769-mouse-input
Nov 25, 2026
Merged

devin-ai-integration[bot] merged 1 commit into
mainfrom
devin/1795587769-mouse-input

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

  • Ports upstream #1157: VICTORY_MOUSE=1 (or a numeric sensitivity) makes mouse movement drive the keyboard stand-in pad's right stick.
  • Maps the left mouse button to the right trigger and the right mouse button to the left trigger; cursor capture releases when the title window loses focus.
  • Keeps mouse input limited to the fallback pad, so an active physical controller still takes priority.

Validation

  • cargo fmt --all -- --check
  • cargo run --locked --quiet --package xtask -- policy
  • cargo test --locked -p victory-hle --lib modules::gameinput::tests::the_mouse -- --nocapture
  • CARGO_FEATURE_PURE=1 RUSTFLAGS='-D warnings' cargo check --locked -p victory-hle --target x86_64-pc-windows-msvc
  • CARGO_FEATURE_PURE=1 RUSTFLAGS='-D warnings' cargo clippy --locked -p victory-hle --all-targets --target x86_64-pc-windows-msvc

Notes

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot merged commit c6d4a4e into main Nov 25, 2026
4 checks passed
devin-ai-integration Bot added a commit that referenced this pull request Nov 25, 2026
…1430/#33) (#50)

* input: keyboard stand-in engagement + mouse camera control (#1430/#33)

Two cherry-picks that apply clean on the fxceless base:
- 70f3bbc (upstream #1430): virtual or idle XInput pads no longer
  disable keyboard controls; real input outside the deadzones engages
  pad mode, fallback keys regain control once host pads go idle.
- d34c4c9 (re-port #33): the mouse as the stand-in pad's camera under
  VICTORY_MOUSE — movement as right-stick deflection (cursor re-centred
  per poll while focused), left/right buttons as triggers.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* input: mouse fixes — decay accumulator, dialog release, left-stick threshold

- Polls outnumber the title's frames, so movement sliced over several
  polls mostly never reached a frame: the stick now reports a decaying
  accumulator, spreading the movement instead of dropping it.
- Re-centring pauses while a window other than the one capture started
  on is in front: the text-entry dialog shares the process, so the
  focus check alone passed it and the cursor could not reach its
  buttons.
- The left stick engages pad mode at XInput's left-thumb threshold
  (7849) instead of the right stick's.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* input: drop buffered mouse movement on focus loss, decay by time

- Switching windows mid-turn no longer sends the buffered movement to
  the camera on return; the accumulator clears with capture.
- The capture window re-latches once the window it started on closes,
  so a startup dialog cannot hold capture forever.
- The accumulator halves per 100 ms of wall time instead of per poll:
  at high poll rates the per-poll halving erased movement long before
  the title's slow frames could read it.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* input: mouse velocity as an exponential moving average

Replaces the decaying sum, which saturated on steady sweeps and kept
residual motion alive: the stick now reports an EMA (half-life 50 ms of
wall time) of per-poll deltas. Steady motion converges to the full
per-poll speed, flicks smooth out, and the estimate reaches zero within
a few hundred ms of the mouse stopping — brief enough not to steal pad
mode back from a controller.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* input: mouse speed in pixels per second, poll-interval independent

The EMA now averages velocity (delta divided by the measured poll
interval, floor 1 ms) instead of raw per-poll distances: the same hand
speed yields the same camera turn regardless of how long polls take.
Full stick at 4000 px/s, scaled by VICTORY_MOUSE sensitivity.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: stoltembergg <stoltembergg@gmail.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration Bot pushed a commit that referenced this pull request Nov 25, 2026
input: keyboard stand-in engagement + mouse camera control (re-port #1430/#33)
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