mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 08:19:56 -04:00
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:
@@ -28,6 +28,7 @@
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "mods.h"
|
#include "mods.h"
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
|
#include "vk.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define SEP "\\"
|
#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");
|
rt_log("cheats: the rebuild did not start; the game starts with the code it has");
|
||||||
return;
|
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();
|
rtss_limit_restore();
|
||||||
|
vk_pipeline_prewarm_marker_clear();
|
||||||
|
vk_pipeline_boot_abandon();
|
||||||
|
prof_write(); // plat_exit runs no atexit handlers
|
||||||
plat_exit(0);
|
plat_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
// 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.
|
// 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_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
|
// 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.
|
// 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);
|
void vk_pipeline_prewarm_detach(void);
|
||||||
|
|||||||
@@ -8978,6 +8978,10 @@ void vk_pipeline_save_exit(void) {
|
|||||||
save_with(SAVE_WAIT_MS, 1);
|
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
|
// 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
|
// 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),
|
// asked as the save asks it, at a moment no build runs into either cache (cache_rw, tried once and never waited for),
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
"""The orderly end of the process (runtime/gfx_present.c rt_exit_begin and rt_exit_steps): the steps run in one order,
|
"""The orderly end of the process (runtime/gfx_present.c rt_exit_begin and rt_exit_steps): the steps run in one order,
|
||||||
with what a kill of the process must not lose (a save Commit in flight, RivaTuner Statistics Server's profile, the
|
with what a kill of the process must not lose (a save Commit in flight, RivaTuner Statistics Server's profile, the
|
||||||
controller's rumble, the settings, the frame-time summary) before the slow pipeline save and the final save flush
|
controller's rumble, the settings, the frame-time summary) before the slow pipeline save and the final save flush
|
||||||
last; it runs once, and a second caller on another thread stays where it is. The frame-time summary of the exit
|
last; it runs once, and a second caller on another thread stays where it is. The cheats rebuild's end, before the
|
||||||
|
guest runs, puts away the boot prebuild's crash marker and journal (runtime/cheats.c rebuild_if_needed). The frame-time summary of the exit
|
||||||
(runtime/perf.c ft_stop) waits for a present thread's update under way and keeps later ones out. Builds those
|
(runtime/perf.c ft_stop) waits for a present thread's update under way and keeps later ones out. Builds those
|
||||||
functions into a test program against stand-ins, and checks statically that every orderly end goes through them.
|
functions into a test program against stand-ins, and checks statically that every orderly end goes through them.
|
||||||
No game files.
|
No game files.
|
||||||
@@ -150,6 +151,16 @@ def static_checks():
|
|||||||
print(f'{name}: {"rt_exit_begin, then " + steps + ", then plat_exit" if ok else "FAIL"}'
|
print(f'{name}: {"rt_exit_begin, then " + steps + ", then plat_exit" if ok else "FAIL"}'
|
||||||
+ (f'; calls exit steps of its own: {", ".join(own)}' if own else ''), flush=True)
|
+ (f'; calls exit steps of its own: {", ".join(own)}' if own else ''), flush=True)
|
||||||
bad += not ok
|
bad += not ok
|
||||||
|
# the cheats rebuild's end, before the guest runs: the guard, RTSS, the boot's marker and journal, the summary
|
||||||
|
cheats = (RT / 'cheats.c').read_text(encoding='utf-8')
|
||||||
|
body = strip_comments(function(cheats, 'static void rebuild_if_needed(const char *dir)'))
|
||||||
|
tail = body[body.rfind('plat_spawn('):]
|
||||||
|
want = ['rt_exit_begin', 'rtss_limit_restore', 'vk_pipeline_prewarm_marker_clear', 'vk_pipeline_boot_abandon',
|
||||||
|
'prof_write', 'plat_exit']
|
||||||
|
pos = calls_in_order(tail, want[:-1]) + [tail.rfind('plat_exit(')] # the last plat_exit is the end's
|
||||||
|
ok = None not in pos and pos == sorted(pos)
|
||||||
|
print(f'cheats.c rebuild_if_needed: {", ".join(want)} in that order: {"ok" if ok else "FAIL " + str(pos)}', flush=True)
|
||||||
|
bad += not ok
|
||||||
steps = function(gp, 'void rt_exit_steps(unsigned what)')
|
steps = function(gp, 'void rt_exit_steps(unsigned what)')
|
||||||
pos = calls_in_order(steps, ['rtss_limit_restore', 'vk_pipeline_save_exit'])
|
pos = calls_in_order(steps, ['rtss_limit_restore', 'vk_pipeline_save_exit'])
|
||||||
ok = None not in pos and pos[0] < pos[1]
|
ok = None not in pos and pos[0] < pos[1]
|
||||||
|
|||||||
Reference in New Issue
Block a user