Skip to content

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

Open
imjustprism wants to merge 4 commits into
Marvisak:mainfrom
imjustprism:hle/keyboard-prompts
Open

imjustprism wants to merge 4 commits into
Marvisak:mainfrom
imjustprism:hle/keyboard-prompts

Conversation

@imjustprism

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

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

@fuzeofficlal fuzeofficlal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants