[pr-fix][input] Keyboard: a bound key drives only its binding, letters as printed, defaults for the player's layout #364

Open
EmberReD wants to merge 1 commit from EmberReD/Darner:fix/keys-by-printed-letter into main
First-time contributor

Contributor role (optional)

  • Fluxer ID:

What it changes

  • The problem on main: seen in the game on v2026.12.03.02 with an AZERTY keyboard, mouse and keyboard on, bindings.ini set to MoveUp = Z, MoveLeft = Q, MoveDown = S, MoveRight = D, RB = A. Pressing Q moved left and also took cover; the bindings did not apply as written, with ENGLISH KEYBOARD on or off.

Two things caused it:

  1. A key bound in bindings.ini still reached the title's own keyboard handling (the GameInput keyboard device), so the title also ran its native action for that key. Q is the title's own Take Cover key.
  2. Letters were read by their place on a US keyboard (LETTER_POSITIONS), both the built-in table's and the file's. A file written with the letters the keyboard prints (ZQSD on AZERTY) named other keys than the ones pressed.

What this does:

  • Bound keys are kept from the title (unbound in gameinput.rs): a key the file binds to a button, trigger or stick drives only that binding. Keys the file does not bind still reach the title as before.
  • Letters are read as the layout prints them (pad_key is the virtual key; mnk::sample reads the bound key itself). A file naming Q means the key marked Q, on any layout.
  • The file's move, look and trigger keys count beside the built-in table in the default mode (before, only its buttons did, so a rebound move key did nothing unless DARNER_BINDINGS_ONLY=1). A table key the file uses for anything else is let go, as buttons already were (#5): Q bound to move left is no longer also the left shoulder. DARNER_BINDINGS_ONLY keeps its meaning and stays off by default.
  • The default bindings.ini is written for the player's layout: its one-letter keys go through gameinput::printed_letters (the existing letter_in_layout with the layout Windows reports), so AZERTY gets Z/Q/S/D and RB = A. With ENGLISH KEYBOARD on and the US layout loaded, the US letters are kept, since the game window then reads US letters. A bindings.ini byte for byte as shipped holds none of the player's keys and is written again for the layout once; any other file is never written over (the existing test is extended for both).
  • The prompts' letter translation (prompts::use_printed_letters) is removed: the prompts now show letters as the file and the table name them, which is what is pressed.

What a player notices:

  • AZERTY, QWERTZ and other layouts: new installs get bindings under the same fingers as WASD on US; a file kept as shipped is moved over once. A file the player edited is read as written, letter for letter.
  • The built-in table's letters are also read as printed now: on AZERTY the table's W (forward) is the key marked W. With the layout's default file in place, forward is Z from the file.
  • A bound key no longer reaches the title's own keyboard handling, so a native keyboard action on that key is gone (the point of the fix). Text entry is not affected: it goes through the host's text entry dialog.

How it was tested

  • Tested revision: e56ae682c6 (one commit on main f3840d7).

  • Commands and results: see the gates below; new tests the_files_move_keys_count_beside_the_tables and bound_keys_are_kept_from_the_title; the_stand_in_pad_reads_letters_by_their_place became the_stand_in_pad_reads_letters_as_printed; the_default_bindings_are_never_written_over_a_file_that_is_there covers the layout and the shipped-file case.

  • Changes a default: yes, for mouse and keyboard players on a layout other than US, and for anyone with a bindings.ini (see "What a player notices").

  • A/B result: not a speed change. Checked in the game (below) with the change off (the v2026.12.03.02 release: Q moved left and took cover) and on (Q moves left only; A is the right shoulder; E, left in the table, is still the right shoulder; prompts show the bound letters).

    A (off) B (on)
    Q (MoveLeft) left + Take Cover left only
  • Gates run on that revision (Windows 10 22H2): gate 1 and gate 2 clean. Gate 3 with --no-fail-fast: darner-hle 495 passed (15 ignored), darner 148 passed, darner-game and the other crates pass. Two crates fail here the same way they would on main, since neither depends on a changed crate (cargo tree): darner-shader, 65 card and WARP cases with "no SM 6.6 device available", and darner-gpu, whose test process exits with code 3.

  • Gameplay: RTX 3070 Ti, Series S profile, 1080p to 1440p, DLSS quality, frame generation off, no ray tracing. AZERTY (French) keyboard, ENGLISH KEYBOARD on with no US layout loaded.

  • Shader wave sizes tested: not relevant (input only).

  • Hardware dependence: none expected; keyboard layout dependent, tested on AZERTY only.

  • Coverage gaps: QWERTZ and other layouts, and ENGLISH KEYBOARD with the US layout loaded, are covered by reading the code and tests only. A bindings.ini written by a launcher with its own defaults is not rewritten (it is not the shipped file).

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: #302, #276, #216, #185 (also change gameinput.rs, other parts); #5 (merged, the same rule for buttons this extends to sticks and triggers).
  • Replaces or overlaps: none found
## Contributor role (optional) - Fluxer ID: ## What it changes - The problem on main: seen in the game on v2026.12.03.02 with an AZERTY keyboard, mouse and keyboard on, `bindings.ini` set to MoveUp = Z, MoveLeft = Q, MoveDown = S, MoveRight = D, RB = A. Pressing Q moved left and also took cover; the bindings did not apply as written, with ENGLISH KEYBOARD on or off. Two things caused it: 1. A key bound in `bindings.ini` still reached the title's own keyboard handling (the GameInput keyboard device), so the title also ran its native action for that key. Q is the title's own Take Cover key. 2. Letters were read by their place on a US keyboard (`LETTER_POSITIONS`), both the built-in table's and the file's. A file written with the letters the keyboard prints (ZQSD on AZERTY) named other keys than the ones pressed. What this does: - **Bound keys are kept from the title** (`unbound` in `gameinput.rs`): a key the file binds to a button, trigger or stick drives only that binding. Keys the file does not bind still reach the title as before. - **Letters are read as the layout prints them** (`pad_key` is the virtual key; `mnk::sample` reads the bound key itself). A file naming Q means the key marked Q, on any layout. - **The file's move, look and trigger keys count beside the built-in table** in the default mode (before, only its buttons did, so a rebound move key did nothing unless `DARNER_BINDINGS_ONLY=1`). A table key the file uses for anything else is let go, as buttons already were (#5): Q bound to move left is no longer also the left shoulder. `DARNER_BINDINGS_ONLY` keeps its meaning and stays off by default. - **The default `bindings.ini` is written for the player's layout**: its one-letter keys go through `gameinput::printed_letters` (the existing `letter_in_layout` with the layout Windows reports), so AZERTY gets Z/Q/S/D and RB = A. With ENGLISH KEYBOARD on and the US layout loaded, the US letters are kept, since the game window then reads US letters. A `bindings.ini` byte for byte as shipped holds none of the player's keys and is written again for the layout once; any other file is never written over (the existing test is extended for both). - The prompts' letter translation (`prompts::use_printed_letters`) is removed: the prompts now show letters as the file and the table name them, which is what is pressed. What a player notices: - AZERTY, QWERTZ and other layouts: new installs get bindings under the same fingers as WASD on US; a file kept as shipped is moved over once. A file the player edited is read as written, letter for letter. - The built-in table's letters are also read as printed now: on AZERTY the table's W (forward) is the key marked W. With the layout's default file in place, forward is Z from the file. - A bound key no longer reaches the title's own keyboard handling, so a native keyboard action on that key is gone (the point of the fix). Text entry is not affected: it goes through the host's text entry dialog. ## How it was tested - Tested revision: e56ae682c6 (one commit on main f3840d7). - Commands and results: see the gates below; new tests `the_files_move_keys_count_beside_the_tables` and `bound_keys_are_kept_from_the_title`; `the_stand_in_pad_reads_letters_by_their_place` became `the_stand_in_pad_reads_letters_as_printed`; `the_default_bindings_are_never_written_over_a_file_that_is_there` covers the layout and the shipped-file case. - Changes a default: yes, for mouse and keyboard players on a layout other than US, and for anyone with a `bindings.ini` (see "What a player notices"). - A/B result: not a speed change. Checked in the game (below) with the change off (the v2026.12.03.02 release: Q moved left and took cover) and on (Q moves left only; A is the right shoulder; E, left in the table, is still the right shoulder; prompts show the bound letters). | | A (off) | B (on) | |---|---|---| | Q (MoveLeft) | left + Take Cover | left only | - Gates run on that revision (Windows 10 22H2): gate 1 and gate 2 clean. Gate 3 with `--no-fail-fast`: darner-hle 495 passed (15 ignored), darner 148 passed, darner-game and the other crates pass. Two crates fail here the same way they would on main, since neither depends on a changed crate (`cargo tree`): darner-shader, 65 card and WARP cases with "no SM 6.6 device available", and darner-gpu, whose test process exits with code 3. - Gameplay: RTX 3070 Ti, Series S profile, 1080p to 1440p, DLSS quality, frame generation off, no ray tracing. AZERTY (French) keyboard, ENGLISH KEYBOARD on with no US layout loaded. - Shader wave sizes tested: not relevant (input only). - Hardware dependence: none expected; keyboard layout dependent, tested on AZERTY only. - Coverage gaps: QWERTZ and other layouts, and ENGLISH KEYBOARD with the US layout loaded, are covered by reading the code and tests only. A `bindings.ini` written by a launcher with its own defaults is not rewritten (it is not the shipped file). ## Checklist - [x] 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: #302, #276, #216, #185 (also change `gameinput.rs`, other parts); #5 (merged, the same rule for buttons this extends to sticks and triggers). - Replaces or overlaps: none found
With mouse and keyboard on, a key bound in bindings.ini also reached the title's own
keyboard handling: on AZERTY, Q bound to move left also took cover. Bound keys are now
kept from the title, letters are read as the layout prints them, bindings.ini's move and
trigger keys count beside the built-in table (a table key the file uses elsewhere is let
go), and the default file is written for the player's layout (Z/Q/S/D on AZERTY).
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 'fix/keys-by-printed-letter:EmberReD-fix/keys-by-printed-letter'
git switch 'EmberReD-fix/keys-by-printed-letter'

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 'EmberReD-fix/keys-by-printed-letter'
git switch 'EmberReD-fix/keys-by-printed-letter'
git rebase 'main'
git switch 'main'
git merge --ff-only 'EmberReD-fix/keys-by-printed-letter'
git switch 'EmberReD-fix/keys-by-printed-letter'
git rebase 'main'
git switch 'main'
git merge --no-ff 'EmberReD-fix/keys-by-printed-letter'
git switch 'main'
git merge --squash 'EmberReD-fix/keys-by-printed-letter'
git switch 'main'
git merge --ff-only 'EmberReD-fix/keys-by-printed-letter'
git switch 'main'
git merge 'EmberReD-fix/keys-by-printed-letter'
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!364
No description provided.