Game: draw keyboard key caps over the title's button prompts #3433

Open
imjustprism wants to merge 4 commits from upstream-pr/3433 into main
imjustprism commented 2026-11-27 01:39:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by imjustprism on 2026-11-27T01:39:15Z.


with --prompts keys the title's button prompts show the keys of the keyboard's stand-in pad (enter, backspace, esc, wasd and so on) instead of xbox buttons. the icon movie is redrawn in memory when the streaming store hands it over: each known icon becomes a white key cap with its label, outlined at run time from segoe ui bold and segoe ui symbol on the host. nothing of the game is stored. the movie is recognised by its structure, and the hook sits on one pointer whose per-build offset is in victory-game. the default stays --prompts gamepad, which places no hook.

the stand-in pad's bindings move to victory-core so victory-game can name them without depending on victory-hle, and the loader gets checked helpers to read and write one pointer slot and to resolve a code address.

tested on an rx 9070 xt with a diag build, together with #2427 for a faster start: the first screen shows the y and enter keys, and a playthrough of the menus logged one redraw, the title using it, and no errors. unit tests cover the movie reader, the shape writer, the outline parser and the hook with stand-in title functions. animated hold prompts keep their pad pictures, and the prompts don't switch back when a pad is plugged in.

#3399 takes another route, for playstation glyphs from the user's files; this one draws its own pictures and needs no files.

refs #187

<!-- greyfinch-sync:Marvisak/VIctory:issue:5519684751 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3433). Originally posted by [imjustprism](https://github.com/imjustprism) on 2026-11-27T01:39:15Z. --- with `--prompts keys` the title's button prompts show the keys of the keyboard's stand-in pad (enter, backspace, esc, wasd and so on) instead of xbox buttons. the icon movie is redrawn in memory when the streaming store hands it over: each known icon becomes a white key cap with its label, outlined at run time from segoe ui bold and segoe ui symbol on the host. nothing of the game is stored. the movie is recognised by its structure, and the hook sits on one pointer whose per-build offset is in victory-game. the default stays `--prompts gamepad`, which places no hook. the stand-in pad's bindings move to victory-core so victory-game can name them without depending on victory-hle, and the loader gets checked helpers to read and write one pointer slot and to resolve a code address. tested on an rx 9070 xt with a diag build, together with #2427 for a faster start: the first screen shows the y and enter keys, and a playthrough of the menus logged one redraw, the title using it, and no errors. unit tests cover the movie reader, the shape writer, the outline parser and the hook with stand-in title functions. animated hold prompts keep their pad pictures, and the prompts don't switch back when a pad is plugged in. #3399 takes another route, for playstation glyphs from the user's files; this one draws its own pictures and needs no files. refs #187
imjustprism commented 2026-11-27 01:40:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by imjustprism on 2026-11-27T01:40:09Z.


all 38 key caps as the redraw makes them, drawn from the hand-built test movie in the fixtures (no game pixels), with the pad control each one stands for:

key caps

<!-- greyfinch-sync:Marvisak/VIctory:comment:7207481379 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3433#issuecomment-7207481379). Originally posted by [imjustprism](https://github.com/imjustprism) on 2026-11-27T01:40:09Z. --- all 38 key caps as the redraw makes them, drawn from the hand-built test movie in the fixtures (no game pixels), with the pad control each one stands for: ![key caps](https://raw.githubusercontent.com/imjustprism/VIctory/319644dda4eebacde0a6e139052e472ab6f9ea4a/key-caps.png)
fuzeofficlal commented 2026-11-27 02:00:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-27T02:00:28Z.

Review: APPROVED


Looks good to me — thorough, clean-room implementation with well-bounded parsing, safe pointer-hook validation, and solid test coverage across the affected crates.

Review & Verification Notes

  • Clean-room & dependencies: cargo xtask policy passes (asset policy: 196 files ok), no new external dependencies are added, and key-cap glyphs are outlined at runtime from host Windows fonts (Segoe UI / Segoe UI Symbol) via GetGlyphOutlineW with no bundled retail or font assets.
  • Safety & bounds:
    • victory-core/src/pad.rs, victory-formats/src/gfx.rs, and victory-game/src/prompts.rs are pure safe Rust, with checked arithmetic and explicit bit-width bounds (WIDEST_FIELD_BITS=31, WIDEST_EDGE_BITS=17) throughout GFx/SWF parsing and rewriting.
    • victory-loader/src/windows.rs validates 8-byte alignment, image bounds, and data vs. executable section flags (SCN_MEM_EXECUTE) on read_pointer/write_pointer/code_address; prompts/hook.rs verifies the dereferenced original function pointer points into an executable image section before installing and stays completely inactive unless --prompts keys --execute is explicitly requested for a matching known build.
  • Local verification on 4f7fdb5d:
    • cargo clippy -p victory-core -p victory-formats -p victory-game -p victory-hle -p victory-loader -p victory --lib --bins --tests -- -D warnings and cargo clippy -p victory-hle -p victory --features diagnostics --tests -- -D warnings are both clean.
    • Tests pass across all touched crates: victory-core (14/14), victory-formats (64/64, 5 ignored benchmarks/external), victory-game (50/50, including live Windows GDI font outline tests and prompts::hook::tests), victory-loader (35 unit + crash_log + load_probe pointer-swap integration tests + title_dlls), and victory-hle modules::gameinput (11/11).
<!-- greyfinch-sync:Marvisak/VIctory:review:6082524254 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3433#pullrequestreview-6082524254). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-27T02:00:28Z. **Review:** APPROVED --- Looks good to me — thorough, clean-room implementation with well-bounded parsing, safe pointer-hook validation, and solid test coverage across the affected crates. ### Review & Verification Notes - **Clean-room & dependencies**: `cargo xtask policy` passes (`asset policy: 196 files ok`), no new external dependencies are added, and key-cap glyphs are outlined at runtime from host Windows fonts (`Segoe UI` / `Segoe UI Symbol`) via `GetGlyphOutlineW` with no bundled retail or font assets. - **Safety & bounds**: - `victory-core/src/pad.rs`, `victory-formats/src/gfx.rs`, and `victory-game/src/prompts.rs` are pure safe Rust, with checked arithmetic and explicit bit-width bounds (`WIDEST_FIELD_BITS=31`, `WIDEST_EDGE_BITS=17`) throughout GFx/SWF parsing and rewriting. - `victory-loader/src/windows.rs` validates 8-byte alignment, image bounds, and data vs. executable section flags (`SCN_MEM_EXECUTE`) on `read_pointer`/`write_pointer`/`code_address`; `prompts/hook.rs` verifies the dereferenced original function pointer points into an executable image section before installing and stays completely inactive unless `--prompts keys --execute` is explicitly requested for a matching known build. - **Local verification on `4f7fdb5d`**: - `cargo clippy -p victory-core -p victory-formats -p victory-game -p victory-hle -p victory-loader -p victory --lib --bins --tests -- -D warnings` and `cargo clippy -p victory-hle -p victory --features diagnostics --tests -- -D warnings` are both clean. - Tests pass across all touched crates: `victory-core` (`14/14`), `victory-formats` (`64/64`, 5 ignored benchmarks/external), `victory-game` (`50/50`, including live Windows GDI font outline tests and `prompts::hook::tests`), `victory-loader` (`35` unit + `crash_log` + `load_probe` pointer-swap integration tests + `title_dlls`), and `victory-hle` `modules::gameinput` (`11/11`).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3433:upstream-pr/3433'
git switch 'upstream-pr/3433'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/3433'
git switch 'upstream-pr/3433'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3433'
git switch 'upstream-pr/3433'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3433'
git switch 'main'
git merge --squash 'upstream-pr/3433'
git switch 'main'
git merge --ff-only 'upstream-pr/3433'
git switch 'main'
git merge 'upstream-pr/3433'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!3433
No description provided.