HLE: handle WM_CLOSE alongside WM_SYSCOMMAND/SC_CLOSE in lifecycle (#168) #208
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!208
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-208"
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?
@AscilCH on GitHub · 2026-11-24 22:33 UTC · original
AscilCH:fix/lifecycle-handle-wm-close→main· +85 −3 · 1 files · 1 commits · openProblem
Fixes the
WM_CLOSEissue reported in #168:In
crates/victory-hle/src/modules/lifecycle.rs,window_proconly interceptedWM_SYSCOMMANDwithSC_CLOSE. WhenWM_CLOSEis sent directly to the window (e.g.taskkill, Task Manager "End task", or automated scripts), it passed through to the title's procedure /DefWindowProcW, which destroys the window without suspending or terminating the title process.Fix
wm::WM_CLOSEalongsidewm::WM_SYSCOMMAND/wm::SC_CLOSEinwindow_proc(is_close_message) to callend_title("window closed", ...)and return0(end_titleis already idempotent viaENDING).WM_CLOSEandWM_SYSCOMMAND/SC_CLOSEare recognised as close requests while other messages (such asSC_MINIMIZE) are not, and verifyingWM_CLOSEdoes not reach the title's window procedure or destroy the window.Verification
rustfmt --edition 2024 --check crates/victory-hle/src/modules/lifecycle.rs: cleancargo test -p victory-hle --locked lifecycle: passedcargo xtask policy: 169 files okcargo clippy -p victory-hle --all-targets --locked -- -D warnings: cleancargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings: clean(AI-assisted; synthetic unit tests only, no game data.)
@rafaconvaitis on GitHub · 2026-11-25 22:42 UTC · original
Native Windows validation on the pinned Flamingo 63d976b base. In the previous local build, .NET Process.CloseMainWindow left the game process running. The same process and window handled the SC_CLOSE path when posted directly.
Adding the WM_CLOSE predicate here caused CloseMainWindow to enter the existing lifecycle and exit without termination from the wrapper, with two suspend routines registered. That first test still reached the existing suspend deadline. I then included Marvisak #1080 for constrained notifications before suspend. At the live title window during startup, the same CloseMainWindow request logged one constrained routine, two suspend routines, and "title suspended; ending the title" about 98 ms after entering the lifecycle. The process was observed exited in 1.23 seconds without a forced stop. The five lifecycle tests passed with the combined fix.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.