Skip to content

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

Open
denkencar-sketch wants to merge 2 commits into
Marvisak:mainfrom
denkencar-sketch:mouse-look
Open

denkencar-sketch wants to merge 2 commits into
Marvisak:mainfrom
denkencar-sketch:mouse-look

Conversation

@denkencar-sketch

Copy link
Copy Markdown
Contributor

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.

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Static review only: victory-hle is Windows-only — nothing compiles or runs on macOS; source review of the diff.

Opt-in mouse look on stand-in pad's right stick — input feature behind a flag; docs half included.

@Dathinel

Copy link
Copy Markdown
Contributor

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.

@denkencar-sketch

Copy link
Copy Markdown
Contributor Author

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.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

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

…OUSE_LOOK)

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.
Steenax6 added a commit to Steenax6/VIctory-NVID that referenced this pull request Nov 26, 2026
…, every key can be rebound

The title reads pads and keyboards only. The keyboard's stand-in pad had
a fixed table and no mouse. The keyboard and mouse now act as a pad
(modules::controls): on the first connected host pad, both at once (each
stick follows whichever moved it last, a resting pad's drift never takes
it), or on the stand-in pad while none is connected.

- The mouse is the right stick. Raw input (no pointer acceleration) on a
  thread and message-only window of its own; the counts since the
  title's last pad read over the time since then are the stick at that
  read, so the same hand movement turns the same angle at any frame rate
  (spans up to 1 s). The title's stick dead zone is skipped (0.3 by
  default, measured by the source in the title), a flick past full stick
  is turned in full a little later. A title pad read makes a reading of
  its own for that.
- The cursor is captured by a click in the window (hidden, held 16 px
  inside it), freed and captured again by Esc, freed by losing focus or
  by sizing or moving the window. Unlike the source, gaining focus alone
  does not capture: starting the title or keys.ps1 bringing it forward
  leave the cursor alone. The capturing click is no shot.
- Mouse buttons are the triggers (left RT, right LT, middle RS); a click
  shorter than a frame is held for the next read (the latch of the
  previous commit holds buttons, not triggers).
- [controls] in victory.toml rebinds every key and mouse button and the
  wheel, sets sensitivity, inversion, dead zone, curve, walk speed,
  letters by their place on a US keyboard, and a second layout a key can
  switch to. victory-core hands the section over as name = value
  entries, so victory-hle needs no TOML parser.
- The default bindings are the old stand-in table exactly (Enter A,
  Backspace B, Esc Menu, Tab View, Q/E LB/RB, arrows D-pad, W A S D and
  I J K L sticks, Z/C triggers, F/H stick clicks), plus the mouse; keys
  go by letter, not by place, so nothing moves on a QWERTZ keyboard.
  The source's own layout (the series' PC keys, Q on RB, E on the D-pad)
  is not the default here: the measuring tools rely on the old one.
- VICTORY_KEYS keys are keys like the others: the keyboard has them and
  the bindings make them pad input (by default as before).
  VICTORY_AUTO_START / VICTORY_AUTO_SKIP press A on the pad directly,
  whatever Enter is bound to, and Enter on the keyboard.
- Diagnostics: VICTORY_KBM plays keys, mouse motion and wheel steps into
  the controls; gameinput=debug logs each pad state the title reads.
  The old fixed stand-in path is gone (the defaults are it).

Tests: the controls (old table kept, rates at reads, slow frames, close
reads, shaping, flicks, pad and mouse together, wheel, clicks, config
and its errors) and the hub (stand-in pad, by place, riding on a host
pad, the mouse at a title read, the cursor around a size loop, the
[controls] entries in victory-core). Not tried in the title here.

Source: ExoCalibra/victory-exo 76b65b6805 (also in grosterr and real69xaros; first written
for Marvisak#1529) with its follow-ups cb3163c6ef (sizing frees
the cursor) and b675e1d050 (the 0.3 dead zone), ported by hand onto our
latch, receivers and automatic presses. Marvisak/VIctory PR Marvisak#2182
(cursor re-centring on the stand-in pad only) is the smaller version of
the same idea and is not taken.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants