d3d12 gameinput: LEONIDA_KBM_BINDS remaps keyboard and mouse binds without a rebuild (D3D12-KBM-BINDS) #3276
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!3276
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/kbm-binds"
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?
Pull request successfully merged and closed
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/main 1a163523d + this change), diag profile.
git merge-treeagainst the current main d15e048a7 is 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
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.
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).
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)
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)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.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)
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)