mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 17:29:57 -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:
@@ -21,6 +21,7 @@
|
||||
#include "menu_assets.h"
|
||||
#include "sarc.h"
|
||||
#include "tex.h"
|
||||
#include "platform/platform.h"
|
||||
|
||||
#define MAX_RAW (512u << 20)
|
||||
|
||||
@@ -33,7 +34,8 @@ static ZSTD_DDict *dicts[8];
|
||||
static unsigned dict_ids[8];
|
||||
static int ndicts = -1;
|
||||
|
||||
static void dicts_load(void) {
|
||||
static void dicts_read(void *unused) {
|
||||
(void)unused;
|
||||
ndicts = 0;
|
||||
size_t zn = 0;
|
||||
uint64_t zn64 = 0;
|
||||
@@ -55,6 +57,14 @@ static void dicts_load(void) {
|
||||
free(z);
|
||||
}
|
||||
|
||||
// Once, whichever thread asks first (the "menu-art" thread and the present path both do in the first frames); the
|
||||
// others wait for it. Checking ndicts < 0 instead let a second caller see the 0 set at the start of the read, take it
|
||||
// for "no dictionaries" and fail its asset: the menu then kept its fallback fonts for the whole run.
|
||||
static void dicts_load(void) {
|
||||
static PlatOnce once = PLAT_ONCE_INIT;
|
||||
plat_once(&once, dicts_read, NULL);
|
||||
}
|
||||
|
||||
uint8_t *menu_asset_load(const char *rel, size_t *n_out) {
|
||||
uint64_t n = 0;
|
||||
uint8_t *b = romfs_load(rel, &n);
|
||||
@@ -68,7 +78,7 @@ uint8_t *menu_asset_load(const char *rel, size_t *n_out) {
|
||||
if (rn == ZSTD_CONTENTSIZE_UNKNOWN) { // a frame that does not say its size: streamed into a growing buffer
|
||||
ZSTD_DDict *d = NULL;
|
||||
if (id) {
|
||||
if (ndicts < 0) dicts_load();
|
||||
dicts_load();
|
||||
for (int i = 0; i < ndicts; i++)
|
||||
if (dict_ids[i] == id) d = dicts[i];
|
||||
if (!d) { free(b); return NULL; }
|
||||
@@ -101,7 +111,7 @@ uint8_t *menu_asset_load(const char *rel, size_t *n_out) {
|
||||
size_t got = 0;
|
||||
if (raw) {
|
||||
if (id) {
|
||||
if (ndicts < 0) dicts_load();
|
||||
dicts_load();
|
||||
ZSTD_DDict *d = NULL;
|
||||
for (int i = 0; i < ndicts; i++)
|
||||
if (dict_ids[i] == id) d = dicts[i];
|
||||
|
||||
Reference in New Issue
Block a user