Window: keep Alt and F10 from freezing the title in menu mode #419

Manually merged
github merged 1 commit from gh-pr/419/head into gh-pr/419/base 2026-11-26 04:03:10 +00:00
Owner

@⁠itsRevela on GitHub · 2026-11-24 03:10 UTC · original
itsRevela:fix/swallow-keyboard-menu → main · +69 −0 · 1 files · 1 commits · merged 2026-11-24 08:10 UTC

What

The title window procedure (lifecycle.rs, window_proc) now drops WM_SYSCOMMAND / SC_KEYMENU, next to the SC_CLOSE handling it already has. Everything else still goes to the title's procedure.

Why

Pressing and releasing Alt (or F10) on a window makes DefWindowProc send SC_KEYMENU. The default handling for that puts the window into menu mode, which runs a modal menu loop on the thread that owns the window, and that thread is the title's. The title window has no menu bar, so nothing appears on screen. The title just stops: no frames, no input. Grand Theft Auto VI then aborts itself about half a minute later, with the deliberate write to 0x0 already discussed in #68, at +0x23cf683 / +0x2215c35. Its crash reporter then tries to upload a minidump, which VIctory's network filter blocks.

So a single Alt tap, for example a half-pressed Alt+Tab, ends the game. A console title never sees a window menu, so dropping it loses nothing. Alt+F4 still closes the window: it arrives as SC_CLOSE, not SC_KEYMENU. The mouse can still open the window menu from the title bar; this PR doesn't change that path.

This removes one trigger of that abort that has nothing to do with the GPU. It doesn't touch the GPU stalls that lead to the same abort in #71 and #59.

Tested

Windows 11 Pro 10.0.26200, NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.1088), Ryzen 9 5900X, Rust 1.98.1 from rust-toolchain.toml, on d2a4bae.

  • New test modules::lifecycle::tests::the_keyboard_menu_never_reaches_the_title:
    • it puts a recording procedure in place of the title's, then sends SC_KEYMENU (Alt alone, Alt+Space, and with low bits set) and SC_MINIMIZE;
    • it checks that only SC_MINIMIZE reaches the title;
    • without the fix it fails, with left: [61696, 61696, 61696, 61472]; with the fix it passes.
  • cargo test -p victory-hle: 88 passed, 0 failed.
  • cargo clippy -p victory-hle --tests: nothing in lifecycle.rs. The one warning, in xmem.rs, is already on main.
  • rustfmt --check passes, and cargo xtask policy reports 151 files ok.
  • With the title, a release build with --features diagnostics ran in Windows Sandbox with vGPU. Each run had the start screen up at 30 fps, put the title window in front, sent one Alt tap and nothing else, and then watched for 75 s:
    Build After the Alt tap
    d2a4bae the frame-rate log stops 2 s later; the title aborts 33 s after the tap (0xc0000005, write 0x0), and its crash reporter tries to upload
    this PR 30 fps throughout (83 s logged after the tap); no abort, no crash report

AI-assisted (Claude Code). The title runs used my own copy; no game data is in this PR.

🤖 Generated with Claude Code

**@⁠itsRevela** on GitHub · 2026-11-24 03:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/419) `itsRevela:fix/swallow-keyboard-menu` → `main` · +69 −0 · 1 files · 1 commits · merged 2026-11-24 08:10 UTC ## What The title window procedure (`lifecycle.rs`, `window_proc`) now drops `WM_SYSCOMMAND` / `SC_KEYMENU`, next to the `SC_CLOSE` handling it already has. Everything else still goes to the title's procedure. ## Why Pressing and releasing Alt (or F10) on a window makes `DefWindowProc` send `SC_KEYMENU`. The default handling for that puts the window into menu mode, which runs a modal menu loop on the thread that owns the window, and that thread is the title's. The title window has no menu bar, so nothing appears on screen. The title just stops: no frames, no input. Grand Theft Auto VI then aborts itself about half a minute later, with the deliberate write to `0x0` already discussed in #68, at `+0x23cf683` / `+0x2215c35`. Its crash reporter then tries to upload a minidump, which VIctory's network filter blocks. So a single Alt tap, for example a half-pressed Alt+Tab, ends the game. A console title never sees a window menu, so dropping it loses nothing. Alt+F4 still closes the window: it arrives as `SC_CLOSE`, not `SC_KEYMENU`. The mouse can still open the window menu from the title bar; this PR doesn't change that path. This removes one trigger of that abort that has nothing to do with the GPU. It doesn't touch the GPU stalls that lead to the same abort in #71 and #59. ## Tested Windows 11 Pro 10.0.26200, NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.1088), Ryzen 9 5900X, Rust 1.98.1 from `rust-toolchain.toml`, on `d2a4bae`. - New test `modules::lifecycle::tests::the_keyboard_menu_never_reaches_the_title`: - it puts a recording procedure in place of the title's, then sends `SC_KEYMENU` (Alt alone, Alt+Space, and with low bits set) and `SC_MINIMIZE`; - it checks that only `SC_MINIMIZE` reaches the title; - without the fix it fails, with `left: [61696, 61696, 61696, 61472]`; with the fix it passes. - `cargo test -p victory-hle`: 88 passed, 0 failed. - `cargo clippy -p victory-hle --tests`: nothing in `lifecycle.rs`. The one warning, in `xmem.rs`, is already on `main`. - `rustfmt --check` passes, and `cargo xtask policy` reports 151 files ok. - With the title, a release build with `--features diagnostics` ran in Windows Sandbox with vGPU. Each run had the start screen up at 30 fps, put the title window in front, sent one Alt tap and nothing else, and then watched for 75 s: | Build | After the Alt tap | |---|---| | `d2a4bae` | the frame-rate log stops 2 s later; the title aborts 33 s after the tap (`0xc0000005`, write `0x0`), and its crash reporter tries to upload | | this PR | 30 fps throughout (83 s logged after the tap); no abort, no crash report | AI-assisted (Claude Code). The title runs used my own copy; no game data is in this PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Alt or F10 sends WM_SYSCOMMAND SC_KEYMENU, and the default handling runs
a modal menu loop on the thread that owns the window, which is the
title's. The title stops drawing and reading input until a key ends the
loop, with nothing on screen to say so, and Grand Theft Auto VI aborts
itself about half a minute later (the deliberate write to 0 at
+0x23cf683). The window procedure now drops SC_KEYMENU, next to its
SC_CLOSE handling. The mouse can still open the window menu.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:03:09 +00:00
github manually merged commit ff8694a69a into gh-pr/419/base 2026-11-26 04:03:10 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 04:39 UTC · original

Thanks @⁠itsRevela for filtering the keyboard-menu command before it reaches the title procedure. I tested head ff8694a69a3444bbbbdc37668181708a87d5b5cc with:

cargo test --locked -p victory-hle --lib the_keyboard_menu_never_reaches_the_title -- --test-threads=1

Result: 1 passed, 0 failed (86 filtered out). The test sends SC_KEYMENU variants and SC_MINIMIZE to a recording title procedure, verifies the menu commands are dropped, and confirms minimize still reaches it. This validates the window-procedure routing in a unit test; I did not run a title.

**@⁠jeremygold02** on GitHub · 2026-11-24 04:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/419#issuecomment-7122213252) Thanks @⁠itsRevela for filtering the keyboard-menu command before it reaches the title procedure. I tested head `ff8694a69a3444bbbbdc37668181708a87d5b5cc` with: ``` cargo test --locked -p victory-hle --lib the_keyboard_menu_never_reaches_the_title -- --test-threads=1 ``` Result: 1 passed, 0 failed (86 filtered out). The test sends `SC_KEYMENU` variants and `SC_MINIMIZE` to a recording title procedure, verifies the menu commands are dropped, and confirms minimize still reaches it. This validates the window-procedure routing in a unit test; I did not run a title.
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!419
No description provided.