Mouse wheel as bindable inputs (WheelUp / WheelDown) in the MNK bindings #1791

Merged
Jesper-Andersson merged 2 commits from upstream-pr/1791 into main 2026-11-29 08:16:53 +00:00
Jesper-Andersson commented 2026-11-29 00:05:43 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Jesper-Andersson on 2026-11-29T00:05:43Z.


Draft, not yet run in game.

Relates to #1485 (this PR does only the wheel part; raw-input mouse motion is not part of it).

Related: #1739 (a full MNK layout with an F5 editor) draws the wheel and binds the wheel click but has no WheelUp/WheelDown scroll binding; this PR adds only the scroll binding.

What it changes

VICTORY_MNK bindings could use keys and mouse buttons 1-5, but not the wheel. This adds WheelUp and WheelDown as binding names in bindings.ini (for example DpadUp = Up, WheelUp).

  • A wheel has no held state, so each whole 120-delta notch is one short press (about 70 ms, then a 40 ms gap). Notches queued behind each other are separate presses; at most 16 wait, so a wild spin is not played back for seconds. Fractional deltas (smooth-scroll wheels, touchpads) add up to a notch; a turn the other way drops the remainder.
  • The window procedure in lifecycle.rs reads WM_MOUSEWHEEL and passes the delta to mnk.rs. It counts only while MNK is on, the game window is the foreground window and F1 is closed. The queue is cleared when focus is lost or F1 opens.
  • The wheel is two pseudo virtual keys (0x0E, 0x0F: unassigned, so they cannot collide with a real key), so they also work as raw codes.
  • Default bindings are unchanged: the wheel is bound to nothing. Nothing else in the shipped bindings.ini changes except a comment documenting the names.

Related PRs, checked: #1549 (closed, not merged; keyboard prompts and raw mouse look), #1570 / #1356 (the wheel there cycles the radial-wheel sub-slots in the native mouse path, and does not touch mnk.rs), #652 (wheel as D-pad in its own mapping, not in the MNK bindings), #1002 (touches mnk.rs and lifecycle.rs for title-bar capture; different hunks).

How it was tested

  • Before / After: not measured; no game run was made for this change.
  • Unit tests (synthetic, no window): name parsing, one notch = one press then a gap, two queued notches = two presses, fractions add up, a reversal drops the remainder, the queue cap.
  • Not tested in game: that a wheel press reaches the title on the pad poll as intended; the 70 ms / 40 ms timing at the title's frame rate; a high-resolution (free-spinning) wheel.
  • cargo test passed for the crates it touches: yes: cargo test --locked -p victory-hle mnk, 5 passed.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #1002, #1570, #1356, #652, #1739

This was written with AI assistance (Claude Code).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5545879154 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1791). Originally posted by [Jesper-Andersson](https://github.com/Jesper-Andersson) on 2026-11-29T00:05:43Z. --- Draft, not yet run in game. Relates to #1485 (this PR does only the wheel part; raw-input mouse motion is not part of it). Related: #1739 (a full MNK layout with an F5 editor) draws the wheel and binds the wheel click but has no WheelUp/WheelDown scroll binding; this PR adds only the scroll binding. ## What it changes `VICTORY_MNK` bindings could use keys and mouse buttons 1-5, but not the wheel. This adds `WheelUp` and `WheelDown` as binding names in `bindings.ini` (for example `DpadUp = Up, WheelUp`). - A wheel has no held state, so each whole 120-delta notch is one short press (about 70 ms, then a 40 ms gap). Notches queued behind each other are separate presses; at most 16 wait, so a wild spin is not played back for seconds. Fractional deltas (smooth-scroll wheels, touchpads) add up to a notch; a turn the other way drops the remainder. - The window procedure in `lifecycle.rs` reads `WM_MOUSEWHEEL` and passes the delta to `mnk.rs`. It counts only while MNK is on, the game window is the foreground window and F1 is closed. The queue is cleared when focus is lost or F1 opens. - The wheel is two pseudo virtual keys (0x0E, 0x0F: unassigned, so they cannot collide with a real key), so they also work as raw codes. - Default bindings are unchanged: the wheel is bound to nothing. Nothing else in the shipped `bindings.ini` changes except a comment documenting the names. Related PRs, checked: #1549 (closed, not merged; keyboard prompts and raw mouse look), #1570 / #1356 (the wheel there cycles the radial-wheel sub-slots in the native mouse path, and does not touch `mnk.rs`), #652 (wheel as D-pad in its own mapping, not in the MNK bindings), #1002 (touches `mnk.rs` and `lifecycle.rs` for title-bar capture; different hunks). ## How it was tested - Before / After: not measured; no game run was made for this change. - Unit tests (synthetic, no window): name parsing, one notch = one press then a gap, two queued notches = two presses, fractions add up, a reversal drops the remainder, the queue cap. - Not tested in game: that a wheel press reaches the title on the pad poll as intended; the 70 ms / 40 ms timing at the title's frame rate; a high-resolution (free-spinning) wheel. - `cargo test` passed for the crates it touches: yes: `cargo test --locked -p victory-hle mnk`, 5 passed. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #1002, #1570, #1356, #652, #1739 This was written with AI assistance (Claude Code).
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!1791
No description provided.