WIP: [pr-fix][input] A key bound to a button in bindings.ini no longer also drives its built-in trigger or stick #5
Loading…
Reference in a new issue
No description provided.
Delete branch "Jesper-A/Darner:up-key-trigger-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Contributor role (optional)
What it changes
Re-filed from an earlier CodeFloe PR (that repo is gone; nothing was migrated). Same branch and commit.
Base: the branch (1 commit) is on
28ef3ddb3, themaincommit it was cut from.mainis nowdd2f061d5. Not rebased (we rebase only if you ask). A text-only trial merge (git merge-tree --write-tree trustno1/main up-key-trigger-fix) is clean, also withmain's newest input commitd77869c52(look keys inbindings.ini), which changes another function.With MOUSE AND KEYBOARD on and a
bindings.ini, a key you bind to a button could still also press the trigger or stick the built-in key table has on that key. Example: C is the right trigger in the table. WithB = C, pressing C pressed B and the right trigger.Buttons were already handled on
main(the F case: the left stick click in the table, Y in the file). This extends the same rule to the table's triggers and sticks. A key bound to a button now drives only that button.What changed, in
crates/darner-hle/src/modules/gameinput.rs:fallback_for_seatnow readsmnk::bound_buttons()and passes it to a new function,stand_in_pad(keys, seat, bound). The rest of the old body moved there, so a test can call it without the Windows-only file reader.stand_in_pad, the closure that reads the table's controls (on) returns 0 for a key the file binds to a button. That covers the triggers, the left stick and the right stick. At the wheel (driver seat) the table's gas and brake keys go through the same closure.a_key_bound_to_a_button_does_not_also_drive_its_trigger_or_stick, covers C and I bound to buttons, with Z and W unbound, for no seat, passenger and driver.Not changed:
DARNER_BINDINGS_ONLY=1(c3824b341; from an earlier report, not migrated) returns before the table is read. Its path is the same as before.main'sd77869c52(LookUp,LookDown,LookLeftandLookRightinbindings.inipush the right stick) is in that same path,bound_only_pad, which this PR does not touch.DARNER_BINDINGS_ONLY=1the native mouse path does not read them (bound_axesis used only atgameinput.rs:541onmain).bindings.ini, nothing changes: the table works as before.Why there is no switch: our own rule is that new behaviour goes behind a default-off switch. I read this as the fix of an existing rule instead. The comment on
mainalready says a key the file binds "drives only what it binds there", and the buttons already follow it; triggers and sticks were missed. Still, it does change what the default path does for anyone with such a file, so this is for the maintainer to judge. A switch is easy to add if you prefer one.This partly answers an earlier report (not migrated; the reporter's other points, such as keys bound to axes or a mouse button as X, are not touched). There is no matching issue on this host, so there is no
FixesorRefsline.How it was tested
8b95f46f3(one commit onmain28ef3ddb3; not retested ondd2f061d5).8b95f46f3:cargo test -p darner-hle --locked --lib gameinput: 99 passed, 0 failed, 2 ignored.cargo clippy --workspace --all-targets --locked -- -D warnings: clean.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean.cargo xtask policy: ok.cargo test --workspace --locked: not run.main'sDARNER_BINDINGS_ONLY/stand_in_padhunk) with abindings.inithat hasB = C, Ctrl, R, Backspace. The player saw it fixed: C no longer also pulled the right trigger. This PR's head (8b95f46f3) was not run in game.cargo test --workspace --lockednot run; head not run in game; keys bound to triggers or sticks not tested; non-Windows build (the file reader is Windows-only) not built.Checklist
main.docs/asset-policy.md.Spec dependence
Checked for overlap
host/menu.rs,host/panel.rsandhwrt.rs, notgameinput.rs. Our own re-filed wheel PR (branchpr4-wheel-hold) also changesgameinput.rs, in another place (the radial wheel); it does not touchfallback_for_seat.This change was made with AI assistance (Claude Code).
Merged into main as
30887eb03("Merge PR #5"):30887eb03. Closing.Pull request closed