Put away the boot prebuild's crash marker and journal when the cheats rebuild ends the process.

cheats.c rebuild_if_needed runs in rt_boot after the prewarm thread has started, and ended the process with only
prof_write and rtss_limit_restore. By then vk_pipeline.c may have written pipeline-prewarm-running.txt (pm_set) and
opened the boot's journal of library builds; left in place, the next start took the rebuild's end for a driver crash
in the boot's builds (pm_skipped counts it as a quiet end; three of them skip the prebuild). The rebuild.skip file
keeps it to one quiet end per rebuild.

The rebuild's end now takes the orderly end's guard (rt_exit_begin), puts RTSS's profile back, clears the prewarm
marker, closes the boot's journal through the new vk_pipeline.c vk_pipeline_boot_abandon (journal_close, as
vk_pipeline_save_exit does), writes the summary and ends. No save is mounted and no menu has run yet, so the saves and
nx2navi.ini have nothing to write. A narrow race stays: pm_set writes the marker and then sets pm_on, so a clear in
between leaves the file; the window's close has the same one.

tests/exit_order_check.py checks that order in rebuild_if_needed. Not reproduced before the change;
exit_order_check and the compile checks of every runtime file pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 17:42:42 -05:00
parent c040ca6c5f
commit f9033dce64
4 changed files with 26 additions and 2 deletions

View File

@@ -28,6 +28,7 @@
#include "input.h"
#include "mods.h"
#include "platform/platform.h"
#include "vk.h"
#ifdef _WIN32
#define SEP "\\"
@@ -505,8 +506,15 @@ static void rebuild_if_needed(const char *dir) {
rt_log("cheats: the rebuild did not start; the game starts with the code it has");
return;
}
prof_write(); // plat_exit runs no atexit handlers
// The orderly end's steps a start needs before the guest runs (gfx_present.c rt_exit_steps): no save is mounted
// and no menu has run, so the saves and nx2navi.ini have nothing to write. The prewarm builds meanwhile, so its
// crash marker and the boot's journal are put away: left in place, the next start took this end for a driver
// crash in the boot's builds (vk_pipeline.c pm_skipped, skip_init).
if (!rt_exit_begin()) plat_exit(0);
rtss_limit_restore();
vk_pipeline_prewarm_marker_clear();
vk_pipeline_boot_abandon();
prof_write(); // plat_exit runs no atexit handlers
plat_exit(0);
}

View File

@@ -1074,6 +1074,7 @@ void vk_pipeline_prewarm(void);
// Ends the boot prebuild's crash marker (vk_pipeline.c, "boot prebuild crash marker"): boot_wait calls it when it lets
// the game start while the prewarm goes on, so a crash in play is not taken for one in the boot's builds.
void vk_pipeline_prewarm_marker_clear(void);
void vk_pipeline_boot_abandon(void); // an end before the guest starts that saves nothing: the boot's journal closed
// boot_wait calls it when it lets the game start while the prewarm goes on: the builders of the whole warm after a
// driver change (vk_pipeline.c bf_decide) go on as in play, at idle priority and in the background's numbers.
void vk_pipeline_prewarm_detach(void);

View File

@@ -8978,6 +8978,10 @@ void vk_pipeline_save_exit(void) {
save_with(SAVE_WAIT_MS, 1);
}
// An orderly end before the guest starts that saves no pipelines (cheats.c's rebuild exit): the boot's journal closed
// as vk_pipeline_save_exit closes it, so the next start does not take the end for a driver crash in the library warm.
void vk_pipeline_boot_abandon(void) { journal_close(); }
// The memory report's figure for the pipeline caches the driver keeps in process memory (vk_pipeline_mem): the size of
// each cache's data, asked once a minute here on the autosave thread, and by every save (cache_save_one). The size is
// asked as the save asks it, at a moment no build runs into either cache (cache_rw, tried once and never waited for),