Write the sampling profile when the window closes or the game exits, which skip atexit handlers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-10-25 11:55:32 +03:00
1 parent 6b1d15534e
commit 5d7958cbb1
2 files changed
+4 -2

No files matched your search

+1
View File
@@ -217,6 +217,7 @@ static LRESULT CALLBACK wnd_proc(HWND h, UINT m, WPARAM w, LPARAM l) {
// The process ends with the window, as in MNG. Save writes go straight to files (runtime/fs_host.c).
rt_log("gfx: window closed; exiting");
vk_pipeline_save();
prof_write(); // ExitProcess runs no atexit handlers
ExitProcess(0);
case WM_ERASEBKGND:
return 1;
+3 -2
View File
@@ -200,11 +200,12 @@ void rt_svc(Cpu *c, uint32_t imm, uint64_t pc) {
return;
}
case 0x29: get_info(c, pc); return;
case 0x07: { // ExitProcess, as closing the window (gfx_window.c WM_CLOSE): pipeline cache and shader records
// saved, logs flushed, exit code 0
case 0x07: { // ExitProcess, as closing the window (gfx_window.c WM_CLOSE): pipeline cache, shader records and
// profile saved, logs flushed, exit code 0
char at[160];
rt_log("guest ExitProcess at %s; exiting", ldr_describe(pc, at, sizeof at));
vk_pipeline_save();
prof_write();
fflush(NULL);
if (svc_test_exit_hook) return svc_test_exit_hook(0);
ExitProcess(0);