summaryrefslogtreecommitdiff
path: root/romdb.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2019-05-14 23:20:35 -0700
committerMichael Pavone <pavone@retrodev.com>2019-05-14 23:20:35 -0700
commit8ad096f5309ac7c3876b22b6d048f229cdf5677d (patch)
tree06534a108068ae6d58e92ee724a1ecaacf61d6d0 /romdb.c
parentadf1a574067b9d8debc86d4984502b018d38b123 (diff)
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
Diffstat (limited to 'romdb.c')
-rw-r--r--romdb.c8
1 files changed, 5 insertions, 3 deletions
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;