Repository navigation
GameInput: held keys are reported in the order they were pressed, as documented - #927
BastienRodz wants to merge 2 commits into
Conversation
DenRakEiw
left a comment
There was a problem hiding this comment.
Tested head 4ce99c1 (fast-forward on main ffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC):
cargo test -p victory-hle: 95 passed, 0 failed (plusno_dll_planting: 1 passed), includingmodules::gameinput::tests::held_keys_keep_their_press_ordercargo clippy -p victory-hle --all-targets: 0 warningscargo xtask policy: ok
Clean fix preserving press order for held keys. Approving.
AI-assisted (Gemini 4 Neon).
|
Rebased onto current |
4ce99c1 to
d8f9221
Compare
|
The CI failure is only |
d8f9221 to
bf0f22a
Compare
|
Still red on the same two |
bf0f22a to
cd16903
Compare
|
Automated triage for the maintainers. Verdict: merge candidate. Re-reviewed at CI: passing. Recommending a look, not approving. Generated by Claude Code |
…ey were pressed, as documented
Cover small output buffers, retained readings, and stable sequence numbers. The buffer and snapshot cases are adapted from MichaelSmithAI's BastienRodz#2 regression based on Marvisak#927. Place the test next to the keyboard reading tests so it can merge with Marvisak#2715.
…he indirect light has a floor
…) - halves_only active, half_views plumbing
…) - halves_only active, half_views plumbing
…ey were pressed, as documented
…documented Microsoft's GameInput documentation for IGameInputReading::GetKeyState states: "New keys are added at the end of the array, and when a key is released, everything shifts down to fill in the gap." Previously, host::Host::keys rebuilt the held-key list on every poll in ascending virtual-key order, so holding Z and then pressing A reported [A, Z] instead of [Z, A]. Remember the previous poll's held virtual keys on host::Host and order each poll's result with a pure press_order helper that keeps still-held keys in their prior order and appends newly pressed keys at the end. Co-Authored-By: Gemini 4 Neon <noreply@google.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cd16903 to
10dd254
Compare
|
Code review and Windows 11 verification at head
LGTM. |
|
Thanks, both notes taken in
|
From review: `press_order` appended a key as often as a reading listed it (scripted VICTORY_KEYS in diagnostics builds can). It now appends each key once. The test also releases a key in the middle of the held ones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6166c20 to
0832e0a
Compare
|
Removed: |
…ey were pressed, as documented
…r bits The network that animates faces moves its tensors with buffer_load_format_d16_* and buffer_store_format_d16_* through R16G16B16A16_UINT and R16_UINT views, half floats and 16-bit indices side by side. On the console each channel's 16 bits go as they are. The translation loaded and stored them as floats (bufferLoad.f32, then legacyF32ToF16; legacyF16ToF32, then bufferStore.f32) through those integer views: D3D12 leaves that undefined. On this machine's RTX 4070 Ti one of the 65,536 patterns survives the float round trip (the new device test prints it); the PR measured the network's arena all zeros on an RTX 5080. Now a d16 typed buffer access through a descriptor loaded from a fixed place in a table moves unsigned integers (bufferLoad.i32 and bufferStore.i32, the handle annotated u32), and so does a whole-dword format load whose every channel is read only as a half float (emit/ halves.rs: the head program reads the network's output that way), where every access through that place moves halves and the program picks nothing from that table at run time. HostShader::half_views names those places (the shader cache keeps them); State::tables makes a table with a 16-bit float or signed buffer view at such a place afresh, with that view in the unsigned format of its layout (descriptor::host::half_view), and the title's own slot keeps its format. A view whose values the console would convert (wider, normalised, signed 8-bit) is logged once; the first half place a draw binds is logged once too. Everything else keeps the float path: root views, heap-picked descriptors, places also read as whole floats. From fxceless/victory-fork PR Marvisak#927 (with its review fixes and tests), fitted to this tree: the d16 shortcut comments of lower.rs are now the fallback's, and normalised format loads (b2ec3df) and view formats are untouched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y are (pull request Marvisak#927), SDWA sign extension of 16-bit results (upstream VIctory Marvisak#3124); two switches off by default (clamp windows, occlusion queries) and offline tools - Marvisak#927 (tippythetaidum): a buffer_load_format whose every use takes a half as f16, and d16 typed loads and stores at a table's fixed places, move 16-bit integers bit-exactly through unsigned twin views (HostShader::half_views). The face network reads its indices this way: mouths open and move (confirmed in a test run on an RTX 4070). Thank you, tippythetaidum. - upstream Marvisak#3124: SDWA dst_unused 1 (sext) with WORD_0 copies bit 15 upward; the reserved dst_unused 3 is refused. - VICTORY_CLAMP_WINDOW=1|alt (after upstream Marvisak#3197): indirect draws clamped a window at a time. Measured on this layer: 1.0 draw a pass (nothing joins): stays off. - VICTORY_OCCLUSION=1|alt (after upstream Marvisak#3138): the title's occlusion queries answered by the card; a counter of queries by kind (the title begins thousands). Not yet measured: off. - translate: VICTORY_NATIVE_HEADS lists each container program's first bytes; an ignored test decodes a raw GFX10 code file; the native pipeline dump writes root signatures. (Device methods 0x1c8 / 0x218 turned out to be a precompiled-pipeline cache the title falls back from.) The shader translator changed: delete both shader caches before the first run.
What's wrong
Microsoft's GameInput keyboard and mouse documentation specifies the order of the array returned by
IGameInputReading::GetKeyState:In
crates/victory-hle/src/modules/gameinput.rs:1158-1163,host::Host::keysrebuilds the held-key list on every poll by scanning virtual-key codes in ascending numerical order:key_state(crates/victory-hle/src/modules/gameinput.rs:1003-1014) copies that list directly into the caller'sGameInputKeyStatebuffer. If the player holdsZ(0x5A) and then also pressesA(0x41), GameInput documents[Z, A], while VIctory reports[A, Z].Impact
Key-binding screens and any title code that identifies the most recently pressed key from the end of the
GetKeyStatearray read the wrong key whenever a newly pressed key has a lower virtual-key code than a key already held (for example, bindingZwhen the player pressedA).What the fix does
Track the previous poll's held virtual keys on
host::Hostand compute the next ordered list with a small purepress_order(previous, down)helper: keep keys frompreviousthat are still indownin their existing order, then append keys indownthat were not inprevious. Because PR #656 also editsHost::keys, the helper lives outsidekeysand the change insidekeysis limited to applyingpress_orderand iteratingself.held_keys, leaving key scanning, filtering, andKeyStateconstruction untouched.Tests
held_keys_keep_their_press_orderexercisespress_orderwith these sequences:[Z, A]. Today's scan gives[A, Z].[Z, A, B].[A].[A, Z].On GitHub's
windows-latest, with the upstream CI's commands (clippy-D warningswith and without--all-features, thencargo test --workspace --locked), everything passes:victory-hle95 passed, 0 failed (https://github.com/BastienRodz/VIctory/actions/runs/45399104790).Not tested: a title's key-binding screen.
No game data used. AI-assisted: found with GPT-6.2 Astra, written with Gemini 4 Neon, reviewed and verified with Claude Code.
Fixes #874.
🤖 Generated with Claude Code