mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 19:29:57 -04:00
Write the flight dump and the memory map through a temporary file and a rename.
The window's close ends the process under the detached threads, so a dump file the flight recorder's thread was writing stayed cut short under its own name. Its three files are now written as .part and renamed when complete (runtime/part_file.h, with a check that kills a writer in the middle), and the allocator's map goes through plat_file_write_cached. The shader identities and the other cache files already went through an atomic write. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -4497,9 +4497,9 @@ static void census_main(void *arg) {
|
||||
snprintf(path, sizeof path, "%.*svma-frame%llu.json", sl ? (int)(sl - lp) + 1 : 0, lp, (unsigned long long)j.frame);
|
||||
char *json = NULL;
|
||||
vmaBuildStatsString(j.c->vma, &json, VK_TRUE);
|
||||
FILE *f = json ? fopen(path, "wb") : NULL;
|
||||
int ok = f && fputs(json, f) >= 0;
|
||||
if (f && fclose(f)) ok = 0;
|
||||
// Through a temporary file and a rename: nobody waits for this thread when the game closes, and a map cut short
|
||||
// there would read as a whole one
|
||||
int ok = json && plat_file_write_cached(path, json, strlen(json));
|
||||
rt_log("mem: vma detailed map %s %s", ok ? "written to" : "not written:", path);
|
||||
if (json) vmaFreeStatsString(j.c->vma, json);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user