mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-28 02:56:36 -04:00
1da867ea99
dirty_ram_text_guard_resync_after_restore() cleared text_modified_bitmap, and the page-clean fast path in dirty_ram_text_native_ok_ranges_from() then trusted a clear bit as "bytes still equal the reference" and skipped the compare. Restored RAM may carry self-modified text (the CMR2 class) that no live write will ever re-flag: the bitmap is not part of the state image, and the writes happened in the process that produced it. After a save-state load into a fresh process, a stale native body could be admitted for those pages. Recompute the bitmap from the bytes: one pass over the reference range (at most 2 MB, once per restore), setting the bit for every page that differs, so those pages stay under the exact compare. (cherry picked from commit ab186edf6, memory.c part)