[pr-fix][input] Native mouse aiming reads Sensitivity in bindings.ini and F1 KEY BINDINGS #402

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

What it changes

  • The problem on main: read from the code, and visible in the startup log attached to #189 (Bindings.ini had Sensitivity = 0.2, while darner_hle::mousehook logged sens=0.001500000013038516, the hardcoded default).
  • With F1 > CONTROLS > MOUSE AND KEYBOARD (DARNER_MNK=1), native mouse aiming (DARNER_NATIVE_MOUSE != 0) is on by default, and mousehook::look_returned reads gameinput::mouse_sensitivity(). That function read only DARNER_MOUSE_SENS and never consulted bindings.ini, so editing Sensitivity in bindings.ini or stepping F1 > CONTROLS > KEY BINDINGS > MOUSE SENSITIVITY (MNK_BINDINGS_CHANGED) did nothing unless DARNER_NATIVE_MOUSE=0 was set.
  • mnk::Bindings now records an explicit Sensitivity line separately from the legacy sampler's 0.045 fallback (mnk::sensitivity_with_count), and gameinput::mouse_sensitivity scales it by 0.0015 / 0.135 when DARNER_MOUSE_SENS is not set at startup:
    • The shipped Sensitivity = 0.135 maps bit-for-bit to 0.0015, and a bindings.ini without a Sensitivity line keeps 0.0015, so existing defaults are unchanged.
    • F1's 0.015..=1.5 range (±0.015 per step, ±11.1% around 0.135) stays inside MIN_MOUSE_SENS..=MAX_MOUSE_SENS (0.00005..=0.05) and applies live on MNK_BINDINGS_CHANGED.
    • Reloading bindings.ini updates native sensitivity only when Sensitivity itself changed, so rebinding a key in F1 leaves in-game [ / ] adjustments and an explicit DARNER_MOUSE_SENS startup override intact.

How it was tested

  • Tested revision: c01892d (full head c01892dff4ed4d6538d98e9931f9647b4fc1d56b, on main f3840d7)
  • Commands and results (Windows 11, Rust 1.98.1 x86_64-pc-windows-msvc):
    • cargo clippy --workspace --all-targets --locked -- -D warnings: clean
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean
    • cargo xtask policy: 555 files ok
    • cargo test --locked -p darner-core -p darner-pe -p darner-simd -p darner-formats -p darner-pipeline -p darner-loader -p darner-game -p darner-hle -p darner: all passed (darner-hle: 495 passed, 0 failed, 15 ignored; no_dll_planting: 2 passed)
    • cargo test --locked -p darner-gpu --lib host::menu::tests: 50 passed, 0 failed, 2 ignored
  • Changes a default: no (Sensitivity = 0.135 and a file omitting Sensitivity both keep 0.0015, and DARNER_MOUSE_SENS still overrides at startup)
  • Gates run on that revision: the two clippy gates and cargo xtask policy; cargo test on the nine crates above plus darner-gpu's host::menu::tests, not the full --workspace GPU/shader suite.
  • Gameplay, when relevant: not run in the game yet.
  • Shader wave sizes tested, when relevant: not applicable (host input only).
  • Hardware dependence: likely general.
  • Coverage gaps: live in-game check of stepping F1 > CONTROLS > KEY BINDINGS > MOUSE SENSITIVITY while aiming.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only). Not run in the game yet.
  • 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 (keyboard bindings; merges cleanly via git merge-tree against its head e56ae68), #302 (launcher window). #189's attached startup log showed Sensitivity = 0.2 ignored.
  • Replaces or overlaps: none found (searched issues and pull requests for DARNER_MOUSE_SENS and Sensitivity)
## What it changes - The problem on main: read from the code, and visible in the startup log attached to #189 (`Bindings.ini` had `Sensitivity = 0.2`, while `darner_hle::mousehook` logged `sens=0.001500000013038516`, the hardcoded default). - With **F1 > CONTROLS > MOUSE AND KEYBOARD** (`DARNER_MNK=1`), native mouse aiming (`DARNER_NATIVE_MOUSE != 0`) is on by default, and `mousehook::look_returned` reads `gameinput::mouse_sensitivity()`. That function read only `DARNER_MOUSE_SENS` and never consulted `bindings.ini`, so editing `Sensitivity` in `bindings.ini` or stepping **F1 > CONTROLS > KEY BINDINGS > MOUSE SENSITIVITY** (`MNK_BINDINGS_CHANGED`) did nothing unless `DARNER_NATIVE_MOUSE=0` was set. - `mnk::Bindings` now records an explicit `Sensitivity` line separately from the legacy sampler's `0.045` fallback (`mnk::sensitivity_with_count`), and `gameinput::mouse_sensitivity` scales it by `0.0015 / 0.135` when `DARNER_MOUSE_SENS` is not set at startup: - The shipped `Sensitivity = 0.135` maps bit-for-bit to `0.0015`, and a `bindings.ini` without a `Sensitivity` line keeps `0.0015`, so existing defaults are unchanged. - F1's `0.015..=1.5` range (`±0.015` per step, ±11.1% around `0.135`) stays inside `MIN_MOUSE_SENS..=MAX_MOUSE_SENS` (`0.00005..=0.05`) and applies live on `MNK_BINDINGS_CHANGED`. - Reloading `bindings.ini` updates native sensitivity only when `Sensitivity` itself changed, so rebinding a key in F1 leaves in-game `[` / `]` adjustments and an explicit `DARNER_MOUSE_SENS` startup override intact. ## How it was tested - Tested revision: `c01892d` (full head `c01892dff4ed4d6538d98e9931f9647b4fc1d56b`, on `main` `f3840d7`) - Commands and results (Windows 11, Rust 1.98.1 `x86_64-pc-windows-msvc`): - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: clean - `cargo xtask policy`: 555 files ok - `cargo test --locked -p darner-core -p darner-pe -p darner-simd -p darner-formats -p darner-pipeline -p darner-loader -p darner-game -p darner-hle -p darner`: all passed (`darner-hle`: 495 passed, 0 failed, 15 ignored; `no_dll_planting`: 2 passed) - `cargo test --locked -p darner-gpu --lib host::menu::tests`: 50 passed, 0 failed, 2 ignored - Changes a default: no (`Sensitivity = 0.135` and a file omitting `Sensitivity` both keep `0.0015`, and `DARNER_MOUSE_SENS` still overrides at startup) - Gates run on that revision: the two clippy gates and `cargo xtask policy`; `cargo test` on the nine crates above plus `darner-gpu`'s `host::menu::tests`, not the full `--workspace` GPU/shader suite. - Gameplay, when relevant: not run in the game yet. - Shader wave sizes tested, when relevant: not applicable (host input only). - Hardware dependence: likely general. - Coverage gaps: live in-game check of stepping **F1 > CONTROLS > KEY BINDINGS > MOUSE SENSITIVITY** while aiming. ## Checklist - [ ] I ran this change in the game, or say below why it can't be (docs, tests only). Not run in the game yet. - [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 (keyboard bindings; merges cleanly via `git merge-tree` against its head `e56ae68`), #302 (launcher window). #189's attached startup log showed `Sensitivity = 0.2` ignored. - Replaces or overlaps: none found (searched issues and pull requests for `DARNER_MOUSE_SENS` and `Sensitivity`)
With DARNER_MNK=1, native mouse aiming is on by default (DARNER_NATIVE_MOUSE != 0),
and mousehook::look_returned reads gameinput::mouse_sensitivity(). That path read
only DARNER_MOUSE_SENS (0.0015 default) and ignored Sensitivity in bindings.ini,
so editing Sensitivity in bindings.ini or changing F1 > CONTROLS > KEY BINDINGS >
MOUSE SENSITIVITY had no effect unless DARNER_NATIVE_MOUSE=0 was set.

Scale an explicit Sensitivity line in bindings.ini by DEFAULT_MOUSE_SENS / 0.135
(keeping the shipped 0.135 bit-identical to 0.0015 and F1's 0.015..=1.5 inside
0.00005..=0.05) when DARNER_MOUSE_SENS is not set at startup, and reload on
MNK_BINDINGS_CHANGED only when Sensitivity itself changed so key rebinds leave
in-game [ / ] adjustments and DARNER_MOUSE_SENS intact. A bindings.ini that omits
Sensitivity keeps the 0.0015 default.
ElGibbone changed title from gameinput: wire bindings.ini Sensitivity and F1 MOUSE SENSITIVITY into native mouse aiming to [pr-fix][input] Native mouse aiming reads Sensitivity in bindings.ini and F1 KEY BINDINGS 2026-12-04 20:05:45 +00:00
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/402/head:elgibbone/native-mouse-sensitivity'
git switch 'elgibbone/native-mouse-sensitivity'

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-sensitivity'
git switch 'elgibbone/native-mouse-sensitivity'
git rebase 'main'
git switch 'main'
git merge --ff-only 'elgibbone/native-mouse-sensitivity'
git switch 'elgibbone/native-mouse-sensitivity'
git rebase 'main'
git switch 'main'
git merge --no-ff 'elgibbone/native-mouse-sensitivity'
git switch 'main'
git merge --squash 'elgibbone/native-mouse-sensitivity'
git switch 'main'
git merge --ff-only 'elgibbone/native-mouse-sensitivity'
git switch 'main'
git merge 'elgibbone/native-mouse-sensitivity'
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!402
No description provided.