comparison sega_mapper.c @ 1863:d60f2d7c02a5

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
author Michael Pavone <pavone@retrodev.com>
date Tue, 14 May 2019 23:20:35 -0700
parents 14a2834d010c
children 374a5ae694e8 3748a2a8a4b7
comparison
equal deleted inserted replaced
1862:e07fc3d473b2 1863:d60f2d7c02a5
114 for (int i = 4; i < 8; i++) 114 for (int i = 4; i < 8; i++)
115 { 115 {
116 context->mem_pointers[gen->mapper_start_index + i] = gen->cart + 0x40000*gen->bank_regs[i]; 116 context->mem_pointers[gen->mapper_start_index + i] = gen->cart + 0x40000*gen->bank_regs[i];
117 } 117 }
118 } 118 }
119 } else { 119 } else if (gen->mapper_type == MAPPER_SEGA) {
120 void *new_ptr = gen->cart + 0x40000*value; 120 void *new_ptr = gen->cart + 0x40000*value;
121 if (context->mem_pointers[gen->mapper_start_index + address] != new_ptr) { 121 if (context->mem_pointers[gen->mapper_start_index + address] != new_ptr) {
122 m68k_invalidate_code_range(gen->m68k, address * 0x80000, (address + 1) * 0x80000); 122 m68k_invalidate_code_range(gen->m68k, address * 0x80000, (address + 1) * 0x80000);
123 context->mem_pointers[gen->mapper_start_index + address] = new_ptr; 123 context->mem_pointers[gen->mapper_start_index + address] = new_ptr;
124 } 124 }