Repository navigation
lifecycle: suspend callbacks on window close and fit the title window (RT-GDK-SPEECH-DISPLAY-LIFECYCLE, split from #401) - #769
Conversation
… (split from #401) RegisterAppStateChangeNotification / UnregisterAppStateChangeNotification under api-ms-win-core-psm-appnotify-l1-1-0/-l1-1-1 and kernelbase.dll, and CreateWindowExW/A under user32.dll and ext-ms-win-rtcore-ntuser-window-l1-1-0/-l1-1-1, plus CreateWindowExA under ext-ms-win-rtcore-ntuser-window-ansi-l1-1-0, the set the title's import table names. The title's first top-level window is fitted to the work area and hooked: SC_CLOSE runs the suspend callbacks (quiesced TRUE) and ends the run through the title's ExitProcess, with a 1 s deadline. Split from #401 (a02134a), as the maintainer asked for one topic per pull request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@Andretuta this is reviewed and ready to merge; one small conflict stands in the way, and I can't resolve it myself because maintainer edits are off on this branch. Could you merge current
Once it's pushed and merges cleanly, I'll merge it. AI-assisted (Claude Code, Claude Opus 5.5). |
|
Note from In case it is helpful for
|
…ow-hook # Conflicts: # scripts/build_runtime.ps1
scripts/build_runtime.ps1 conflicted in the $files list of the build without CMake: main added shims\silent_audio.cpp there (#1598) after this branch had merged main, and this branch adds shims\lifecycle.cpp. Both entries are kept, lifecycle.cpp where this branch had it. The branch's other change in that file (user32.lib on the link line) merged cleanly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged. Thank you, @Andretuta, for splitting this out of #401 and for bringing it up to date.
AI-assisted (Claude Code, Claude Opus 5.5). |
Claimed in the coordination issue as:
RT-GDK-SPEECH-DISPLAY-LIFECYCLE(#14 (comment)). Split from #401 at the maintainer's request (one topic per pull request).What and why
Console titles never get a desktop
WM_CLOSE: quitting suspends the title (itsRegisterAppStateChangeNotificationcallbacks run withquiescedTRUE so it can flush saves) and then ends the process. They also size their window for a 4K render target, which overflows smaller desktops.runtime/shims/lifecycle.{h,cpp}:RegisterAppStateChangeNotification/UnregisterAppStateChangeNotificationunderapi-ms-win-core-psm-appnotify-l1-1-0.dll,api-ms-win-core-psm-appnotify-l1-1-1.dllandkernelbase.dll.CreateWindowExW/CreateWindowExAunderuser32.dllandext-ms-win-rtcore-ntuser-window-l1-1-0/-l1-1-1.dll, andCreateWindowExAunderext-ms-win-rtcore-ntuser-window-ansi-l1-1-0.dll. The title's import table namesCreateWindowExAfrom that ANSI set andRegisterAppStateChangeNotificationfromapi-ms-win-core-psm-appnotify-l1-1-0(tools/pe_inspect.py). The version in xgameruntime_offline: one silent speech voice with WAVE streams, display power requests for timeout deferrals (RT-GDK-SPEECH-DISPLAY-LIFECYCLE) #401 missed the ANSI set, so the game's window would never have been hooked. Only the title's first top-level window (no parent, notWS_CHILD, notWS_EX_TOOLWINDOW) is fitted to the primary monitor's work area and hooked.SC_CLOSEruns the registered suspend callbacks under the registration lock, off the window thread, then ends the run through the title's ownExitProcessshim (process.cpp), so the host finishes its cleanup. The deadline is 1 s: if the callbacks have not returned by then, the run ends the same way.UnregisterAppStateChangeNotificationis never called after it returned.lifecycle_testinruntime/CMakeLists.txt;scripts/build_runtime.ps1addsshims\lifecycle.cppanduser32.libto theclfallback; one paragraph indocs/runtime_imports.md.The code is #401's lifecycle part (as of a02134a) on current
main, plus the ANSI window set.Tested
lifecycle_test30 checks, 0 failures, under CTest (new:CreateWindowExAbinds through the ANSI set to the same shim).test_gdk_runtime_callspytest: 82 passed.git merge-tree).GPUs tested: n/a (CPU-only Win32 tests)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a — runtime shims only)🤖 Generated with Claude Code