[pr-fix][input] Native mouse: Mouse4, Mouse5, WheelUp and WheelDown in bindings.ini press their bindings #405

Open
ElGibbone wants to merge 1 commit from elgibbone/native-mouse-bindings into main AGit
First-time contributor

What it changes

  • The problem on main: read from the code only. bindings.ini takes Mouse4, Mouse5, WheelUp and WheelDown, and F1's KEY BINDINGS lets the player bind them, but with the native mouse on (the default for mouse and keyboard) none of them presses anything in play:
    • mnk::sample, the only reader of them, runs only when DARNER_NATIVE_MOUSE=0 (fallback_for_seat).
    • Host::keys reads 0x08..=0xFE, so the mouse buttons never reach the stand-in pad, and overlay_mouse_mapping gives only left, right and middle a fixed use.
    • WM_MOUSEWHEEL still queues notches in mnk::wheel_scroll, but nothing polls the queue, so it fills to 16 and stays full.

What this does, on the native mouse path in play (InputMode::Gameplay and RadialWheel):

  • mnk::native_mouse_keys returns Mouse4 and Mouse5 while held (the async state, or the message loop's LATCHED record, as mnk::sample reads them) and the wheel notch being pressed, polled from the same queue and pulse timing as mnk::sample.
  • mouse_key_pad reads those keys against the file's buttons, triggers and stick keys with bound_only_pad, so LB = Mouse4, RT = WheelUp or MoveUp = Mouse5 work as they do with DARNER_NATIVE_MOUSE=0, driving rules included. That pad is merged into the overlay with the fixed left, right and middle mapping.
  • Outside play (F1, a menu, the map, idle) and while the weapon wheel is open, the wheel's queue is dropped each poll (mnk::forget_wheel). Notches that scrolled a menu or the weapon wheel don't press WheelUp or WheelDown later.
  • mnk::sample and the native path share one wheel clock (clock_ms).

Not changed: left, right and middle keep their fixed use on the native path. A bindings.ini line that moves Mouse1…Mouse3 to another control is still not followed there (the driver seat's fixed shoulders depend on it). Mouse4 and Mouse5 in menus and on the map keep their current UI handling. The shipped bindings.ini binds none of these keys, so nothing changes for a player who hasn't bound them.

How it was tested

  • Tested revision: 7f40324 (one commit on main f3840d7)
  • Commands and results: new test mouse4_mouse5_and_the_wheel_press_their_bindings_on_the_native_path (a button, a trigger from the wheel, the left stick and the driving rule from Mouse5, and Mouse1's binding left to the fixed mapping).
  • Changes a default: no (the shipped bindings.ini binds none of these keys).
  • A/B result: not applicable.
  • Gates run on that revision: cargo clippy --workspace --all-targets --locked -- -D warnings clean, the same with --all-features clean, cargo xtask policy passed, cargo test -p darner-hle --locked 497 passed, 0 failed, 15 ignored, cargo test -p darner --locked 160 passed, 1 ignored. Not the whole cargo test --workspace.
  • Gameplay, when relevant: not run in the game yet.
  • Hardware dependence: needs a mouse with side buttons for Mouse4 and Mouse5.
  • Coverage gaps: the wheel queue's timing and the LATCHED record are covered by the existing mnk code and tests, not by a new test on the native path.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only).
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #364 also changes gameinput.rs and mnk.rs (stand_in_pad, fallback_for_seat, the layout read in mnk::sample); this one merges with it without conflicts (git merge-tree). #399 and #402 also change gameinput.rs; no conflict with either.
  • Replaces or overlaps: none found
## What it changes - The problem on main: read from the code only. `bindings.ini` takes `Mouse4`, `Mouse5`, `WheelUp` and `WheelDown`, and F1's KEY BINDINGS lets the player bind them, but with the native mouse on (the default for mouse and keyboard) none of them presses anything in play: - `mnk::sample`, the only reader of them, runs only when `DARNER_NATIVE_MOUSE=0` (`fallback_for_seat`). - `Host::keys` reads `0x08..=0xFE`, so the mouse buttons never reach the stand-in pad, and `overlay_mouse_mapping` gives only left, right and middle a fixed use. - `WM_MOUSEWHEEL` still queues notches in `mnk::wheel_scroll`, but nothing polls the queue, so it fills to 16 and stays full. What this does, on the native mouse path in play (`InputMode::Gameplay` and `RadialWheel`): - `mnk::native_mouse_keys` returns Mouse4 and Mouse5 while held (the async state, or the message loop's `LATCHED` record, as `mnk::sample` reads them) and the wheel notch being pressed, polled from the same queue and pulse timing as `mnk::sample`. - `mouse_key_pad` reads those keys against the file's buttons, triggers and stick keys with `bound_only_pad`, so `LB = Mouse4`, `RT = WheelUp` or `MoveUp = Mouse5` work as they do with `DARNER_NATIVE_MOUSE=0`, driving rules included. That pad is merged into the overlay with the fixed left, right and middle mapping. - Outside play (F1, a menu, the map, idle) and while the weapon wheel is open, the wheel's queue is dropped each poll (`mnk::forget_wheel`). Notches that scrolled a menu or the weapon wheel don't press `WheelUp` or `WheelDown` later. - `mnk::sample` and the native path share one wheel clock (`clock_ms`). Not changed: left, right and middle keep their fixed use on the native path. A `bindings.ini` line that moves `Mouse1`…`Mouse3` to another control is still not followed there (the driver seat's fixed shoulders depend on it). Mouse4 and Mouse5 in menus and on the map keep their current UI handling. The shipped `bindings.ini` binds none of these keys, so nothing changes for a player who hasn't bound them. ## How it was tested - Tested revision: 7f40324 (one commit on main f3840d7) - Commands and results: new test `mouse4_mouse5_and_the_wheel_press_their_bindings_on_the_native_path` (a button, a trigger from the wheel, the left stick and the driving rule from Mouse5, and Mouse1's binding left to the fixed mapping). - Changes a default: no (the shipped `bindings.ini` binds none of these keys). - A/B result: not applicable. - Gates run on that revision: `cargo clippy --workspace --all-targets --locked -- -D warnings` clean, the same with `--all-features` clean, `cargo xtask policy` passed, `cargo test -p darner-hle --locked` 497 passed, 0 failed, 15 ignored, `cargo test -p darner --locked` 160 passed, 1 ignored. Not the whole `cargo test --workspace`. - Gameplay, when relevant: not run in the game yet. - Hardware dependence: needs a mouse with side buttons for Mouse4 and Mouse5. - Coverage gaps: the wheel queue's timing and the `LATCHED` record are covered by the existing `mnk` code and tests, not by a new test on the native path. ## Checklist - [ ] I ran this change in the game, or say below why it can't be (docs, tests only). - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #364 also changes `gameinput.rs` and `mnk.rs` (`stand_in_pad`, `fallback_for_seat`, the layout read in `mnk::sample`); this one merges with it without conflicts (`git merge-tree`). #399 and #402 also change `gameinput.rs`; no conflict with either. - Replaces or overlaps: none found
bindings.ini takes Mouse4, Mouse5, WheelUp and WheelDown, but only
mnk::sample read them, and it is off while the native mouse is on: the
native path gives left, right and middle a fixed use, Host::keys skips the
mouse buttons, and the wheel's notches were queued and never polled.

In play, mnk::native_mouse_keys gives Mouse4 and Mouse5 while held and the
wheel notch being pressed, and mouse_key_pad reads them against the file's
bindings with bound_only_pad; the pad is merged into the overlay. Outside
play and while the weapon wheel is open the wheel's queue is dropped, so
notches that scrolled something else don't press WheelUp/WheelDown later.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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/405/head:elgibbone/native-mouse-bindings'
git switch 'elgibbone/native-mouse-bindings'

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 'elgibbone/native-mouse-bindings'
git switch 'elgibbone/native-mouse-bindings'
git rebase 'main'
git switch 'main'
git merge --ff-only 'elgibbone/native-mouse-bindings'
git switch 'elgibbone/native-mouse-bindings'
git rebase 'main'
git switch 'main'
git merge --no-ff 'elgibbone/native-mouse-bindings'
git switch 'main'
git merge --squash 'elgibbone/native-mouse-bindings'
git switch 'main'
git merge --ff-only 'elgibbone/native-mouse-bindings'
git switch 'main'
git merge 'elgibbone/native-mouse-bindings'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
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
TrustNo1/Darner!405
No description provided.