mnk: allow empty bindings in bindings.ini, print reload errors, and fix F1/AZERTY notes #672

Open
MasterWolf wants to merge 1 commit from MasterWolf/Darner:pr/post-merge-bindings-ini-unbind-and-docs into post-merge
First-time contributor

Not run in the game (verified via cargo build, cargo test, and cargo clippy on d8e39a4; self-contained parser, console logging, and default bindings.ini comment fix).

Refs #655

Contributor role (optional)

  • Fluxer ID: 1577824307575267331

What it changes

  • The problem on post-merge: read from the code (crates/darner-hle/src/modules/gameinput/mnk.rs and bindings.ini) while investigating #655:
    1. mnk::parse splits each binding value on , without skipping empty items (input.split(',').map(|k| key(k)...)). Leaving a binding empty to unbind a control (e.g. RB = or LookUp =) or leaving a trailing comma fails parsing of the entire bindings.ini file.
    2. When bindings.ini fails to parse on load or hot-reload, mnk::config only emits tracing::warn! (unlike the println!("bindings ...") lines used when writing the file), so users editing bindings.ini get no obvious console feedback that their edits were rejected and the previous bindings were kept.
    3. The shipped bindings.ini header still refers to F10: Controls = mouse and keyboard instead of F1, CONTROLS: MOUSE AND KEYBOARD, and does not warn AZERTY users to keep W/A/S/D rather than replacing them with Z/Q/S/D (replacing MoveLeft = A with MoveLeft = Q maps to physical US-Q, i.e. A on AZERTY).

This PR:

  • Filters empty trimmed tokens in mnk::parse so empty values unbind a control and trailing commas parse cleanly, while unknown control names and invalid key names still return Err.
  • Prints bindings ... lines on parse failures (load/reload) and successful hot-reloads in mnk::config.
  • Updates bindings.ini comments (F1, CONTROLS: MOUSE AND KEYBOARD, AZERTY positional-key note, and empty-value unbinding note).
  • Adds unit test empty_binding_unbinds_and_trailing_comma_parses.

How it was tested

  • Tested revision: d8e39a4 (on top of post-merge 28a9b42)
  • Commands and results:
    • cargo build --offline -p darner — passed (0 errors)
    • cargo test --offline -p darner-hle --lib modules::gameinput::mnk — 7 passed; 0 failed (including new empty_binding_unbinds_and_trailing_comma_parses)
    • cargo clippy --offline -p darner-hle --tests — passed (0 warnings in darner-hle)
    • cargo check --offline --workspace — passed
  • Changes a default: no
  • A/B result: not applicable (bugfix/UX for bindings.ini parsing, console diagnostics, and comments; no runtime default or performance claim changed).
  • Checks run on that revision: cargo build, cargo test, cargo clippy, cargo check --workspace
  • Gameplay, when relevant: not run in the game
  • Hardware dependence: likely general
  • Coverage gaps: hot-reload console output was verified by code inspection and compilation; parser behaviour is covered by unit tests.

Checklist

  • I ran this change in the game, or say below why it can't be (not run in the game; parser/logging/comment fix verified by unit tests, build, and clippy).
  • This PR contains one change based on post-merge.
  • The diff contains no game files, code or assets.
  • 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: none found
  • Replaces or overlaps: none found
**Not run in the game** (verified via `cargo build`, `cargo test`, and `cargo clippy` on `d8e39a4`; self-contained parser, console logging, and default `bindings.ini` comment fix). Refs #655 ## Contributor role (optional) - Fluxer ID: 1577824307575267331 ## What it changes - The problem on `post-merge`: read from the code (`crates/darner-hle/src/modules/gameinput/mnk.rs` and `bindings.ini`) while investigating #655: 1. `mnk::parse` splits each binding value on `,` without skipping empty items (`input.split(',').map(|k| key(k)...)`). Leaving a binding empty to unbind a control (e.g. `RB =` or `LookUp =`) or leaving a trailing comma fails parsing of the entire `bindings.ini` file. 2. When `bindings.ini` fails to parse on load or hot-reload, `mnk::config` only emits `tracing::warn!` (unlike the `println!("bindings ...")` lines used when writing the file), so users editing `bindings.ini` get no obvious console feedback that their edits were rejected and the previous bindings were kept. 3. The shipped `bindings.ini` header still refers to `F10: Controls = mouse and keyboard` instead of `F1, CONTROLS: MOUSE AND KEYBOARD`, and does not warn AZERTY users to keep `W/A/S/D` rather than replacing them with `Z/Q/S/D` (replacing `MoveLeft = A` with `MoveLeft = Q` maps to physical US-`Q`, i.e. `A` on AZERTY). This PR: - Filters empty trimmed tokens in `mnk::parse` so empty values unbind a control and trailing commas parse cleanly, while unknown control names and invalid key names still return `Err`. - Prints `bindings ...` lines on parse failures (load/reload) and successful hot-reloads in `mnk::config`. - Updates `bindings.ini` comments (`F1, CONTROLS: MOUSE AND KEYBOARD`, AZERTY positional-key note, and empty-value unbinding note). - Adds unit test `empty_binding_unbinds_and_trailing_comma_parses`. ## How it was tested - Tested revision: `d8e39a4` (on top of `post-merge` `28a9b42`) - Commands and results: - `cargo build --offline -p darner` — passed (0 errors) - `cargo test --offline -p darner-hle --lib modules::gameinput::mnk` — `7 passed; 0 failed` (including new `empty_binding_unbinds_and_trailing_comma_parses`) - `cargo clippy --offline -p darner-hle --tests` — passed (0 warnings in `darner-hle`) - `cargo check --offline --workspace` — passed - Changes a default: no - A/B result: not applicable (bugfix/UX for `bindings.ini` parsing, console diagnostics, and comments; no runtime default or performance claim changed). - Checks run on that revision: `cargo build`, `cargo test`, `cargo clippy`, `cargo check --workspace` - Gameplay, when relevant: not run in the game - Hardware dependence: likely general - Coverage gaps: hot-reload console output was verified by code inspection and compilation; parser behaviour is covered by unit tests. ## Checklist - [ ] I ran this change in the game, or say below why it can't be (not run in the game; parser/logging/comment fix verified by unit tests, build, and clippy). - [x] This PR contains one change based on `post-merge`. - [x] The diff contains no game files, code or assets. - [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: none found - Replaces or overlaps: none found
TrustNo1 changed title from [pr-fix][input] mnk: allow empty bindings in bindings.ini, print reload errors, and fix F1/AZERTY notes to mnk: allow empty bindings in bindings.ini, print reload errors, and fix F1/AZERTY notes 2026-12-06 03:25:19 +00:00
This pull request can be merged automatically.
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 'pr/post-merge-bindings-ini-unbind-and-docs:MasterWolf-pr/post-merge-bindings-ini-unbind-and-docs'
git switch 'MasterWolf-pr/post-merge-bindings-ini-unbind-and-docs'

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 'post-merge'
git merge --no-ff 'MasterWolf-pr/post-merge-bindings-ini-unbind-and-docs'
git switch 'MasterWolf-pr/post-merge-bindings-ini-unbind-and-docs'
git rebase 'post-merge'
git switch 'post-merge'
git merge --ff-only 'MasterWolf-pr/post-merge-bindings-ini-unbind-and-docs'
git switch 'MasterWolf-pr/post-merge-bindings-ini-unbind-and-docs'
git rebase 'post-merge'
git switch 'post-merge'
git merge --no-ff 'MasterWolf-pr/post-merge-bindings-ini-unbind-and-docs'
git switch 'post-merge'
git merge --squash 'MasterWolf-pr/post-merge-bindings-ini-unbind-and-docs'
git switch 'post-merge'
git merge --ff-only 'MasterWolf-pr/post-merge-bindings-ini-unbind-and-docs'
git switch 'post-merge'
git merge 'MasterWolf-pr/post-merge-bindings-ini-unbind-and-docs'
git push origin 'post-merge'
Sign in to join this conversation.
No reviewers
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!672
No description provided.