HLE: constrain the title before suspending it (window close never suspended) #1080
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1080
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1080/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@giusepperainone on GitHub · 2026-11-24 15:34 UTC · original
giusepperainone:fix/constrained-before-suspend→main· +100 −14 · 1 files · 1 commits · merged 2026-11-25 00:09 UTCClosing the title's window never suspended Grand Theft Auto VI: every close logged
title did not finish suspending in time; ending the title, one second later, so the title was always killed before its suspend completed (seen in passing in the logs of #417 and #784).Cause
The title registers two life-cycle routines with the same context:
RegisterAppStateChangeNotification(HLE'd here);RegisterAppConstrainedChangeNotification(api-ms-win-core-psm-appnotify-l1-1-1), which we did not HLE, so it bound to the host's version, which never calls it: a desktop app is never constrained.On the console a title that is suspended is constrained first. The title relies on that: its suspend routine blocks until the title reaches a state that only its constrained routine starts (the constrained routine posts an event that the title's own loop turns into that state). Called alone, the suspend routine never returns.
How I narrowed it down, on a diagnostics build with local logging only:
RegisterAppConstrainedChangeNotification.Change
RegisterAppConstrainedChangeNotification/UnregisterAppConstrainedChangeNotificationare HLE'd inlifecycle, with their own registry (same shape as the suspend one; the registration code is shared).end_titleruns the constrained-change routines (constrained) and then the suspend routines (quiesced), under the existing one-second deadline.Results
Windows 11 26200, RTX 4060 Ti,
ffe310e+ this change, window closed from the account screen:window closed: suspending the title routines=2window closed: suspending the title constrained=1 routines=2title did not finish suspending in timeafter 1.0 s (also with the deadline at 15 s)title suspendedafter ~0.1 sWith the suspend completing, the title now reaches the command queue's suspend method (
method not implemented object="command queue" slot=0xb8, already noted inqueue.rs). It returnsE_NOTIMPLand the title still finishes suspending; implementing it is left for a follow-up.Testing
constrained_registrations_come_and_go,constrained_routines_run_before_suspend_routines(synthetic routines, no game data).cargo clippy --workspace --all-targets --locked -- -D warnings, the same with--all-features, andcargo test --workspace --locked: all pass.cargo xtask policy: 154 files ok.end_title, and other titles.🤖 Generated with Claude Code
@MichaelSmithAI on GitHub · 2026-11-24 15:47 UTC · original
We tested the window-close path on Wine/GE 3.2 with a test-only fixture over
a7847a5. A child process resolved both notification registrations through the guest HLE resolver with host fallback disabled. It registered the suspend callback first, then the constrained callback, and sentWM_SYSCOMMAND / SC_CLOSEto a hooked Win32 window.The parent verified that the child exited successfully and that its trace contained exactly two callbacks, in this order: constrained with flag 1, then suspend with the quiesced flag 1. Registering them in the opposite order to delivery checks that the close path enforces the lifecycle order. All seven focused tests passed. On
ffe310e, the same fixture stopped before creating the window because the guest resolver lackedRegisterAppConstrainedChangeNotification. This exercises synthetic guest callbacks; the account-screen shutdown timing comes from your native title run.@Zipettte on GitHub · 2026-11-24 16:29 UTC · original
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
a7847a5:cargo test -p victory-hlepasses, 97 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).