fix: give a slowly running title the time to suspend before it is ended #259
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!259
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-259"
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?
@Skyfrye on GitHub · 2026-11-25 21:57 UTC · original
Skyfrye:nep/suspend-deadline→main· +167 −27 · 2 files · 1 commits · draftDraft: the in-game check on this base is pending (the test machine's GPU is in use for a few hours). Everything else below is done.
Change
Closing the title's window suspends the title first, as the console does before it ends a game: its suspend routines run, and it is ended when they return or after a deadline. The deadline was a fixed 1 s (
SUSPEND_DEADLINEinvictory-hle/src/modules/lifecycle.rs), which is also the console's figure ("The limit is 1 second for an exclusive app", Microsoft Learn, GDK reference forIXtfApplicationClient::DebugEnable). In wall-clock time that is right; in frames it is not. A title hands the suspend to the threads that make its frames and waits for them. On the console it gets about 30 frames in that second. At the 2 to 4 frames a second we reach today it gets 2 to 4, and the routines do not finish: in one log of the previous base the title is cut off at 1,013 ms (routines=2), and a frame is presented 26 ms later.Now a title still suspending after the console's second, which presented between 1 and 29 frames in it, gets the time to present 30 at the rate it showed: 15 s at 2 fps, 10 s at 3 fps, 30 s at most. Nothing changes for a title at console speed (1 s), nor for one that presented no frame in that second (it may be stuck, and is ended at 1 s as before).
VICTORY_SUSPEND_MS=<milliseconds>sets a fixed time with no stretching (1000gives the old behaviour).title suspended in N msor, at WARN,title did not finish suspending, timed out after N ms, and, when stretched, the frames counted and the time granted.suspend(), which is what the tests drive.victory_gpu::queue::presented()becomespubso the life-cycle module can count frames.XLaunchNewGamerelaunch path.To know: a script that closes the window and waits a fixed time for the process may now need up to 15 s at 2 fps. The 30 fps figure is an assumed console frame rate.
Linked issue: none.
Verification
Windows 11 26300, Rust 1.98.1 (MSVC), builds and tests at below-normal priority, RTX 5080, on upstream
mainataffaf15(the Neptune base, PR #243), fromthird_party/victory.With the fixed deadline put back and the new tests kept, 3 of the 5 fail.
One run in about 24 of
cargo test -p victory-hleon this branch failed infiles::tests::long_title_paths_work_on_the_host(a test of the virtual drive;files.rsis not touched here); 20 runs onmainand the other 23 here passed. Not investigated further.In game: pending. My previous-base runs closed the window with
WM_CLOSE, which the engine does not treat as closing the window (it acts onWM_SYSCOMMAND/SC_CLOSE, the title bar's button), so the suspend path was not reached; the next run sendsSC_CLOSEafter 300 s in the prologue's first interior and reads the new log lines.Oracle and test data
None involved. Failure cases (5 new tests in
lifecycle.rs): routines that return early end the suspend at once; routines still running at the deadline get the longer time; routines that never return are given up on; the stretch table (2, 3, 1, 0, 30 and more frames); parsing of the variable.Checklist
E_NOTIMPL), never a fake success. (Not concerned.)AI assistance: written with Claude Code. Claude Fable 5.2 wrote the change and its tests; Claude Sonnet 5.5 ported it to the Neptune base and ran the checks there; Claude Opus 5.5 reviewed the port, ran the game on my machine and wrote this description.
🤖 Generated with Claude Code
@LooperSalty on GitHub · 2026-11-26 00:06 UTC · original
Reviewed: this looks good to merge (tests pass, only the 3 known victory-gpu failures from main). Please mark it ready for review when you are happy with it and we will merge it.
@KainanP on GitHub · 2026-11-26 10:32 UTC · original
Test report for #259.
Merges cleanly onto current main. Setup: current
origin/main(c4c93bd) merged with this PR, Windows 11 on the RTX 4060 Laptop machine.cargo test --locked -p victory-hle(CPU only, so I did not repeat it per adapter). Since the PR makesvictory_gpu::queue::presentedpublic, I also ran victory-gpu on the RTX.victory-hleunitno_dll_plantingvictory-gpu --lib, RTXFlake check: 30 more runs of the victory-hle unit binary on the PR had 0 failures (
files::tests::long_title_paths_work_on_the_hostincluded).Notes from reading the diff:
suspend/stretched/askedbut notend_titleitself (thatthen()andend()run once). That is hard to unit-test becauseend()ends the process.AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.