Fix small settings and overlay edge cases.

- An empty NX2NAVI_SPIN or NX2NAVI_VRAM_HEADROOM in the environment stopped the game: both read the key with
  cfg_bool, and an empty value falls back to the settings table, where these keys have no row. Empty now means unset.
- find_ini checked for 10 bytes after the exe folder's separator where "nx2navi.ini" and its NUL take 12, so an exe
  path just under 1024 bytes wrote two bytes past the buffer.
- The performance overlay read the clock before taking the lock, so a frame pushed in between was newer than "now",
  the unsigned age wrapped and the overlay showed 0 fps for that refresh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-08 09:22:03 -05:00
parent ffe13e1d52
commit b69b613984
4 changed files with 9 additions and 4 deletions

View File

@@ -1098,7 +1098,9 @@ void rt_spin_gate(Cpu *c, uint64_t head) {
if (g_spin_on < 0) {
const char *e = cfg_get("NX2NAVI_SPIN_HANDOFF_US");
g_spin_handoff_ns = (uint64_t)(e && *e ? atoll(e) : 50) * 1000;
g_spin_on = !(cfg_get("NX2NAVI_SPIN") && !cfg_bool("NX2NAVI_SPIN"));
// an empty value is unset: cfg_bool of a key without a settings row would stop the game on it
const char *spin = cfg_get("NX2NAVI_SPIN");
g_spin_on = !(spin && *spin && !cfg_bool("NX2NAVI_SPIN"));
}
t->sp_n++;
t->sp_site = head;