Input: report the character each held key types #656
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/656"
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 Marvisak/VIctory. Originally posted by lameloball2813-ui on 2026-11-24T06:21:31Z.
Held keys reported code point 0 (the
shortcut:ingameinput.rs's host source). They now report the character they type, as GameInput's keyboard state does:ToUnicodeExwith the foreground window's keyboard layout, so it follows the user's layout.GetKeyState.dead_key, with the accent's spacing form as the code point. Keys that type nothing, or several characters at once, report 0.Grand Theft Auto VI reads scan codes and virtual keys only, so nothing changes for it. This fills in the platform side for titles that read characters.
Testing
Windows 11, RTX 5060 Ti. Not tested in a title (I don't have one to run).
gameinput::host: modifier sides set the generic modifier and Caps Lock sets its toggle; Space and Enter type0x20/0x0Dand F1 types nothing in the machine's layout (layout-independent keys only).cargo test --workspace: everything passes exceptvictory-loader'sload_probe, which fails before and after this change on my machine. It builds the fixture intotarget/fixturesinside the checkout, and my checkout's path is long enough thatlink.exehits LNK1104 (MAX_PATH). Unrelated to this change.cargo clippy -p victory-hle --all-targets: no warnings ingameinput.rs.cargo xtask policy: ok.Not covered: dead keys and Caps Lock have no automated test (they depend on the machine's layout and toggle state), and I haven't checked them by hand on a layout with dead keys.
Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T06:25:07Z.
Review: APPROVED
LGTM! Tested on Windows 11 with MSVC Rust 1.98.1. All 88 unit tests in ictory-hle pass cleanly, including the new keyboard_held_keys_return_typed_characters test. Keystroke typing mapping properly differentiates control keys and character typing.
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T10:51:34Z.
Review: APPROVED
Tested
3b001edon Windows 11, RTX 5070, MSVC:cargo test -p victory-hle89 passed, includingeither_sides_modifier_holds_the_generic_one. Clippy's 1 warning is the existing one at xmem.rs:747. I didn't drive real key input here, soToUnicodeExoutput is checked by reading the code, not by a run.GetKeyboardState, keeps the result independent of which thread polls. Flag 4 keeps the thread's dead-key state intact, so a title's own text input isn't disturbed.ToUnicodeExtreats as AltGr on layouts that have it. Good.ToUnicodeExreturns control characters (Ctrl+A gives U+0001), so those now come back ascode_point1–26 instead of 0. If GameInput reports 0 or the plain letter in that case, it would be worth filteringc < ' 'back to 0. I don't have a reference capture to say which is right.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T11:39:34Z.
Independent verification & code review on Windows 11 Pro (build 26100, Rust
1.98.1), cleanly merged ontomain(ffe310e):cargo xtask policy: PASS (154 files ok)cargo clippy -p victory-hle --all-targets --locked -- -D warnings: PASScargo clippy -p victory-hle --all-targets --features diagnostics --locked -- -D warnings: PASScargo test -p victory-hle --locked: 96 passed + 1 integration test (no_dll_planting), 0 failed (including neweither_sides_modifier_holds_the_generic_oneandkeys_type_their_characters)Diff review (
crates/victory-hle/src/modules/gameinput.rs): clean and thoughtful — usingToUnicodeExwith flag4(KEEP_STATE) avoids mutating keyboard dead-key state, and populating generic0x10..=0x12from sided0xA0..=0xA5ensures Shift/Ctrl/Alt modifiers work accurately.ToUnicodeExreturnsn < 0(dead key),&text[..1]covers BMP dead keys; usingn.unsigned_abs() as usize(clamped totext.len()) would also preserve a 2-unit surrogate pair if a layout ever emits a non-BMP dead-key spacing character.AI-assisted; synthetic tests only, no game files.
Imported from Marvisak/VIctory. Originally posted by molodayamama on 2026-11-24T14:04:26Z.
Independent Windows check of
3b001ed80c97a9da158696ae06c4961548953a53(Windows 10 22H2 19045, Rust 1.98.1, MSVC x64).cargo test -p victory-hle --locked --lib either_sides_modifier_holds_the_generic_one -- --test-threads=1 --nocapture: 1 passed.cargo test -p victory-hle --locked --lib keys_type_their_characters -- --test-threads=1 --nocapture: 1 passed.The focused checks passed for left/right modifier aliases and the characters produced from held keys.
Only source-built synthetic fixtures were used. AI-assisted verification.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:16:51Z.
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-hle/src/modules/gameinput.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.