Files
psxrecomp/runtime/include
Matthew Stanley f0e7197b63 text guard: decide native-safety by bytes, bless intentional data patches
Master's text-divergence guard (dirty_ram_text_native_ok) blocked native dispatch
of any compiled function whose text page is runtime-dirty (an overlay overwrote
it), falling back to interp and — when the entry can't be resolved there — to
psx_unknown_dispatch (FATAL). Tsumu's translation layer patches string/glyph DATA
tables that share a 4 KB page (and the guard's 256-byte compare window) with real
compiled functions, so a data patch diverged the page and fatally blocked
func_80070248 on boot ("unknown dispatch: 0x80070248").

Two-part faithful fix (general, not per-game):
- dirty_ram_text_native_ok now decides on the dirty/flagged path by BYTE-COMPARING
  the entry window against the reference image, not the coarse page-dirty
  heuristic. A data-only change no longer blocks a function whose own code bytes
  are unchanged; a genuine code overwrite still diverges -> interp (guard intent
  preserved). Pristine pages keep the no-compare fast path.
- New dirty_ram_text_bless(phys,bytes,len): text_xlate blesses every in-place RAM
  patch (glyph/msg_inplace/msg_sep) into the (runtime-owned, mutable) reference
  image, so intentional data patches read as data. Genuine game self-mod writing
  DIFFERENT bytes still diverges and is still caught.

Verified: Tsumu boots to the title screen with the English translation applied,
no fatal. Benefits every title (more precise guard).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 16:31:10 -07:00
..
2026-07-06 10:59:27 -07:00
2026-05-17 21:58:55 -07:00