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

Merged
itsRevela merged 1 commit from upstream-pr/419 into main 2026-11-24 08:10:57 +00:00
itsRevela commented 2026-11-24 03:10:47 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by itsRevela on 2026-11-24T03:10:47Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:issue:6573753849 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/419). Originally posted by [itsRevela](https://github.com/itsRevela) on 2026-11-24T03:10:47Z. --- ## 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)
mercuryVM commented 2026-11-24 06:52:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T05:41:21Z.

Review: APPROVED


Tested ff8694a on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (265 passed, 0 failed), including the new the_keyboard_menu_never_reaches_the_title. Not tested in game.

  • wparam & 0xFFF0 == SC_KEYMENU is the documented way to test system commands, since the low four bits are the system's. The test covers that with SC_KEYMENU | 1.
  • Only SC_KEYMENU is dropped. The title still gets WM_SYSKEYDOWN/WM_SYSKEYUP for Alt, Alt+F4 still arrives as SC_CLOSE, and the mouse path to the system menu is unchanged. Alt+Space (the keyboard system menu) is dropped too, which is fine for a window without one.

No issues found.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6034259950 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/419#pullrequestreview-6034259950). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T05:41:21Z. **Review:** APPROVED --- Tested ff8694a on Windows 11, RTX 5070, MSVC: `cargo test --workspace --no-fail-fast` passes (265 passed, 0 failed), including the new `the_keyboard_menu_never_reaches_the_title`. Not tested in game. - `wparam & 0xFFF0 == SC_KEYMENU` is the documented way to test system commands, since the low four bits are the system's. The test covers that with `SC_KEYMENU | 1`. - Only `SC_KEYMENU` is dropped. The title still gets `WM_SYSKEYDOWN`/`WM_SYSKEYUP` for Alt, Alt+F4 still arrives as `SC_CLOSE`, and the mouse path to the system menu is unchanged. Alt+Space (the keyboard system menu) is dropped too, which is fine for a window without one. No issues found. AI-assisted (Claude Code).
jeremygold02 commented 2026-11-24 06:55:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T04:39:03Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7122213252 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/419#issuecomment-7122213252). Originally posted by [jeremygold02](https://github.com/jeremygold02) on 2026-11-24T04:39:03Z. --- 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.
upstream-sync closed this pull request 2026-11-24 09:05:29 +00:00
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!419
No description provided.