From ff5f1bd024423fac4f31927488c2f54f7b72c86f Mon Sep 17 00:00:00 2001 From: Squirbie Date: Thu, 29 Oct 2026 19:08:50 +0900 Subject: [PATCH] mame-memory: leave read-only banks of 1 MiB or more out of the save state (#2178) register_banks() registers the RAM behind every bank that appears in a memory map. Banks that only ever show up in read maps are ROM (the ST-V cartridge bank, 48 MB, or the CAGE sound-board ROM banks, 2 + 16 MB), but they were still copied into every save state, so states were 20-53 MB for those boards, and netplay, rewind and run-ahead keep many states at once. Remember whether each bank appears in a write map and skip a bank of 0x100000 bytes or more that never does. RAM banks and smaller banks are unchanged, so the state layout of other drivers stays the same. An INFO log line reports each skipped bank. Co-authored-by: Squirbie <246656821+Squirbie@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 --- src/mame-memory.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mame-memory.c b/src/mame-memory.c index c51c705f..64f3438d 100644 --- a/src/mame-memory.c +++ b/src/mame-memory.c @@ -1641,11 +1641,13 @@ void register_banks(void) int cpunum, i; int banksize[MAX_BANKS]; int bankcpu[MAX_BANKS]; + int bankwrite[MAX_BANKS]; /* bank appears in a write map */ for (i=0; i= 0x100000) + { + log_cb(RETRO_LOG_INFO, LOGPRE "read-only bank %d (%d bytes) left out of the save state\n", i, banksize[i]); + continue; + } switch (cpunum_databus_width(bankcpu[i])) { case 8: @@ -1782,6 +1793,7 @@ void register_banks(void) state_save_register_UINT32("bank", i, "ram", (UINT32 *)cpu_bankbase[i], banksize[i]/4); break; } + } }