From 8ad096f5309ac7c3876b22b6d048f229cdf5677d Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Tue, 14 May 2019 23:20:35 -0700 Subject: Differentiate between the full Sega mapper and the SRAM only one. Fixes crash on save state load for Phantasy Star IV and other games that use the same mapper --- romdb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'romdb.c') diff --git a/romdb.c b/romdb.c index 9df72ee..331573e 100644 --- a/romdb.c +++ b/romdb.c @@ -77,6 +77,7 @@ void cart_serialize(system_header *sys, serialize_buffer *buf) switch(gen->mapper_type) { case MAPPER_SEGA: + case MAPPER_SEGA_SRAM: sega_mapper_serialize(gen, buf); break; case MAPPER_REALTEC: @@ -96,13 +97,14 @@ void cart_deserialize(deserialize_buffer *buf, void *vcontext) { genesis_context *gen = vcontext; uint8_t mapper_type = load_int8(buf); - if (mapper_type != gen->mapper_type) { - warning("Mapper type mismatch, skipping load of mapper state"); + if (mapper_type != gen->mapper_type && (mapper_type != MAPPER_SEGA || gen->mapper_type != MAPPER_SEGA_SRAM)) { + warning("Mapper type mismatch, skipping load of mapper state\n"); return; } switch(gen->mapper_type) { case MAPPER_SEGA: + case MAPPER_SEGA_SRAM: sega_mapper_deserialize(buf, gen); break; case MAPPER_REALTEC: @@ -365,7 +367,7 @@ void add_memmap_header(rom_info *info, uint8_t *rom, uint32_t size, memmap_chunk info->map[1].buffer = info->save_buffer; } else { //Assume the standard Sega mapper - info->mapper_type = MAPPER_SEGA; + info->mapper_type = MAPPER_SEGA_SRAM; info->map[0].end = 0x200000; info->map[0].mask = 0xFFFFFF; info->map[0].flags = MMAP_READ; -- cgit v1.2.3