mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 06:29:58 -04:00
Merge the audit: its map and ledger, the perf-trace markers and size lines, and the fixes of its Phase 4.
Verified by runs in the audit: the Market's periodic stall (a pool slot was listed once per refresh pass instead of once; the list fell from 160,385 entries to at most 3,192 and no frame over 20 ms remained while standing), orderly exits delete the pipeline prebuild's running marker (left behind, the next start wrote a skip file and every later start skipped the prebuild), the log and crash report name an area a save asks for that the game does not have, and the menu atlas hash no longer overflows a signed multiply. The other fixes compile and pass the regression route but their faults were never reproduced: see AUDIT.md section 13 for each. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,7 @@ static CfgEntry entries[CFG_MAX_KEYS];
|
||||
static int n_entries;
|
||||
static unsigned version;
|
||||
static PlatMutex set_lock = PLAT_MUTEX_INIT; // cfg_set, cfg_reset, cfg_save
|
||||
static uint64_t kept_n, kept_bytes; // set_lock: values cfg_set replaced and kept for readers (cfg_sizes)
|
||||
static int save_ok = 1; // the last cfg_save_to wrote (or had nothing to write)
|
||||
|
||||
// Every name the runtime reads (and the patch sets in generated/), without the prefix. A file key outside this list is
|
||||
@@ -541,6 +542,7 @@ void cfg_set(const char *name, const char *value) {
|
||||
while (i < n && strcmp(entries[i].key, key)) i++;
|
||||
if (i < n) {
|
||||
if (!entries[i].value || strcmp(entries[i].value, value)) {
|
||||
if (entries[i].value) kept_n++, kept_bytes += strlen(entries[i].value) + 1; // cfg_sizes
|
||||
__atomic_store_n(&entries[i].value, strdup(value), __ATOMIC_RELEASE); // the old string stays for readers
|
||||
entries[i].dirty = 1;
|
||||
}
|
||||
@@ -1017,3 +1019,12 @@ void cfg_init(void) {
|
||||
"turns it off)");
|
||||
start_values();
|
||||
}
|
||||
|
||||
// NX2NAVI_TRACE=perf "mem: sizes" (perf.c): settings entries, and the replaced values cfg_set keeps for readers.
|
||||
void cfg_sizes(PerfSizes *s) {
|
||||
plat_mutex_lock(&set_lock);
|
||||
uint64_t n = (uint64_t)n_entries, kn = kept_n, kb = kept_bytes;
|
||||
plat_mutex_unlock(&set_lock);
|
||||
perf_size(s, "settings", n, CFG_MAX_KEYS, PERF_SIZE_NONE);
|
||||
perf_size(s, "replaced setting values kept", kn, 0, kb);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user