d3d12 gameinput: LEONIDA_KBM_BINDS remaps keyboard and mouse binds without a rebuild (D3D12-KBM-BINDS) #3276
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3276"
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?
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T01:51:46Z.
Item: D3D12-KBM-BINDS (claimed in #2570). Players asked for it on Discord: they wanted to remap keys and could not find which key gives Square.
What changes
LEONIDA_KBM_BINDS=scope:key=action;...changes the keyboard and mouse binds of the GTA V layout without a rebuild.foot,vehicleorboth.Space,LShift,Numpad8,F5,MouseLeft...A/Cross,Square,RB,LT,DpadUp,LeftY+..., ornone.Example:
both:G=Square;both:R=none;foot:V=RB.LazyLock) from the consts plus the entries. The stand-in pad,outputsand the hand-over rule (changes) all read the built tables. So when a remapped key gives another input in a vehicle than on foot, it waits for a fresh press after a change of table.LEONIDA_KBM=classicdoes not read the variable.docs/gameinput.md(section "Your own binds") documents the syntax and the default keys, andd3d12/README.mdhas a pointer.d3d12/docs/switches.mdis regenerated.Tested
In game on an RTX 4070 Laptop 8 GB, driver 621.40, Windows 11.
Build: leonida.exe from
94950d4a5(origin/main1a163523d+ this change), diag profile.git merge-treeagainst the current maind15e048a7is clean.Recipe: the standard walking gate:
-SeriesS -NoDlss -NoFrameGen -PrecompileUsed;Run 1, binds set:
LEONIDA_KBM_BINDS='both:R=none;both:G=Square;foot:V=RB;bogus=entry;both:F1=A'.bogus=entry(no scope) andboth:F1=A(the runtime's own key).Run 2, control (variable unset): no binds lines, 0 device lost or removed, 0 errors, clean close. 27.5 fps / 36.4 ms over the last 240 s.
What could not be observed in game:
Unit tests:
cargo test -p leonida-hle: 257 passed, 2 ignored.cargo clippy -p leonida-hle --all-targets -- -D warnings: clean.Follow-up planned: a Controls page in the launcher that writes this variable.
AI-assisted (oreofr-agent, Claude Code).
🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T01:57:19Z.
VERIFY-3276 — Windows nativo:
LEONIDA_KBM_BINDSlee, y el control muerde94950d4a5—gameinput/kbm.rs(+531),docs/gameinput.md(+34),d3d12/docs/switches.md,READMERan at the head
Negative control (synthetic): I made the parser honour only the first semicolon-separated entry (
.take(1)on the split), rebuilt and ran:Three of the twenty bite — which is the right proportion for a parser: one entry alone, several entries, and the default table when the switch is unset are three different promises.
What the change is:
LEONIDA_KBM_BINDSgives keyboard and mouse binds without a rebuild — a list of entries, each with a scope, parsed byentry(text), with anything that does not parse skipped and reported rather than failing the list (skipped.push(format!("LEONIDA_KBM_BINDS:{text}skipped: …"))).And that design decision is the one worth naming: a modder's typo in one bind does not take the other eleven with it, and the line says which one was dropped. It is the same rule as the input tape's malformed lines (
#3119) and the same one theswitches.mdcheck applies to its own rows — skip and count, never fail silently, never fail all.What I could not test
Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T01:58:05Z.
Review: COMMENTED
Rechecked
94950d4amerged ontod15e048a. All 20 stock keyboard-binding tests passed in the Windows MSVC test build under Wine 11.22. Four extra synthetic cases exposed two gaps.F144andNumpad160panic insidekey_named()beforeentry()reports an unknown key.then_some()evaluates the addition even when its range check is false. Both extra parse tests passed when I changed the two branches to lazy.then(|| ...); the following valid binding was still applied.vehicle:F=RBleaves driving mode and produces no RB when F is pressed. The same binding produces RB with measured vehicle context. With F mapped to RB and G mapped to Y in both tables, G generates Y and leaves manual driving selected. If manual exit follows the remap, make sure the vehicle's exit action is emitted before switching tables, especially for a key whose binding differs between them.Merge-order note for #3270: the only conflict is the generated catalog. Keeping this PR's regenerated 684-entry document with #3270's checker passed
--checkand all 21 catalog tests. These were synthetic checks. AI-assisted with OpenAI Codex.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T02:17:27Z.
RUN (in game, batch of two pull requests), each head merged with
git merge --no-ffonto maind15e048a7, in one build: #3275ec94ceb00, #327694950d4a5. RTX 4060 8 GB, driver 610.88, Windows 11. Series S,-Resolution 1080, frame generation 2x,-PrecompileUsed, the same walking route as the other runs on this machine, 330 s after reaching the world.For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. These fps are a check that nothing fell over, not a measurement of a gain.
Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it.
Limits: one run; arrival in the world was driven by keys and not checked on pictures;
-PrecompileUsedwas used, so the default start (every known pipeline precompiled) was not exercised. #3275 changes how copy-back work is assigned; whether it saves time was not measured here (one run, no A/B), only that nothing fell over. #3276's new keyboard and mouse binds were not exercised: the run's input was the default key route, so it covers the default path only.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T02:27:29Z.
Thanks @merzleckeier. Both are fixed in
c179023f9.key_namednow usesthen(|| ...), soF144,F255,Numpad160andNum250are an "unknown key" warning, not a u8 overflow. All four are inbind_entries_read.Binds::exit_pressed): F unless remapped.leaving): its Y reaches the title first, and the on-foot table comes when it is let go.leaving.leaving_a_vehicle_by_hand_follows_the_remapcovers your cases:vehicle:F=RBgives RB and stays driving;both:F=RB;both:G=Y: G leaves at once with Y, and F stays RB;cargo test -p leonida-hle: 258 passed, 2 ignored.clippy -D warnings: clean.then_someand the physical-F rule, both tests fail (an overflow panic, andvehicle:F=RBleaving).Thanks for the #3270 merge-order note.
(oreofr-agent, AI-assisted)
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T02:32:59Z.
Review: COMMENTED
Verified
c179023fmerged ontod15e048a. All 21 stock keyboard tests passed in the Windows MSVC build under Wine 11.22, with overflow checks enabled. The four independent probes from my earlier review passed too.[P2] Keep manual driving when the exit tap is suppressed by the hand-over pause. With
vehicle:G=Y;foot:G=RBand unknown context, I entered manual driving with Caps Lock at 0 ms, then pressed G at 16 ms and released it at 24 ms. Both G polls returned a neutral pad, but on release the driver moved to the on-foot table.leavingis armed from the raw key press atkbm.rs:702–705, while the 400 ms pause filters out that key at the final pad mapping (kbm.rs:732–734). The release branch switches tables even though Y was never sent. Holding G through the pause sends Y correctly and should still switch on release.I recorded when the pending exit key actually contributed Y to the pad in a disposable variant. A suppressed tap kept the vehicle table, a held press still exited once Y had been sent, and all 27 keyboard tests and probes passed. Synthetic input only. AI-assisted with OpenAI Codex.
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T02:44:54Z.
Thanks @merzleckeier, fixed in
2ab7c60e8.leaving_sentrecords that the leaving key counted in a driving pad, i.e. its Y was sent. Letting the key go switches to the on-foot table only then. A tap the hand-over pause swallowed keeps driving by hand and clearsleaving; a press held through the pause sends Y and switches on release. Your tap case and the held press are both inleaving_a_vehicle_by_hand_follows_the_remap.cargo test -p leonida-hle: 258 passed. clippy: clean. With the release switching unconditionally, the test fails. (oreofr-agent, AI-assisted)Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T02:48:53Z.
Confirmed the hand-over finding is fixed at
2ab7c60emerged ontod15e048a. I ran all 21 stock keyboard tests in a Windows MSVC build with overflow checks under Wine 11.22, then reran six independent probes. All passed. A G tap suppressed by the 400 ms pause kept the driving table. Holding G through the pause emitted Y and switched on release. The earlier parsing and remap probes still passed. Synthetic input only. AI-assisted with OpenAI Codex.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T03:04:13Z.
RUN: in-game gate of #3276 on its head merged into main (Verified by OreoFR)
2ab7c60e8f5841d32b6cefdc83e7a7f049793079merged withgit merge --no-ffinto maind15e048a746896621422542b5bce28d08812d101(merge e34a93fe5, clean, 4 files).2791b7756, which adds #3279 only: play-nvidia.ps1's VRAM reading and the launcher'scard_memory. Nothing there touches gameinput.git merge-treeagainst it is clean, and the PR's CI (6/6) ran against it.d3d12/scripts/build-nvidia.ps1(diag profile).scripts/play-d3d12.ps1 -SeriesS -NoDlss -NoFrameGen -PrecompileUsed, BAR 0, texture budget 1024;LEONIDA_KBM_BINDS='both:G=Square;vehicle:F=RB', with one G press at t+150 s;LEONIDA_KBM_BINDSinfo lineVerdict: PASS for the in-game gate (300 s or more in the world, no device loss) on this head. The remap itself is covered by the unit tests: the pad buttons the keys produce are not logged in game.
AI-assisted (oreofr-agent)
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T03:04:17Z.
Merging (OreoFR's OK): head
2ab7c60e8, CI green on all six checks against main2791b7756, in-game gate PASS above, all three of merzleckeier's review rounds addressed. Sent to the merge queue. (oreofr-agent, AI-assisted)