[Core/SG] fixed state loading for games using external RAM

This commit is contained in:
ekeeke 2019-05-08 08:19:30 +02:00
parent 5f8156ef72
commit aa9300d581

View File

@ -741,15 +741,30 @@ int sms_cart_context_save(uint8 *state)
{
int bufferptr = 0;
/* check if cartridge ROM is disabled */
if (io_reg[0x0E] & 0x40)
{
/* save Boot ROM mapper settings */
save_param(bios_rom.fcr, 4);
}
else
{
/* save cartridge mapper settings */
save_param(cart_rom.fcr, 4);
}
/* support for SG-1000 games with extra RAM */
if ((cart_rom.mapper == MAPPER_RAM_8K) || (cart_rom.mapper == MAPPER_RAM_8K_EXT1))
{
/* 8KB extra RAM */
save_param(work_ram + 0x2000, 0x2000);
}
else if (cart_rom.mapper == MAPPER_RAM_2K)
{
/* 2KB extra RAM */
save_param(work_ram + 0x2000, 0x800);
}
return bufferptr;
}
@ -757,15 +772,30 @@ int sms_cart_context_load(uint8 *state)
{
int bufferptr = 0;
/* check if cartridge ROM is disabled */
if (io_reg[0x0E] & 0x40)
{
/* load Boot ROM mapper settings */
load_param(bios_rom.fcr, 4);
}
else
{
/* load cartridge mapper settings */
load_param(cart_rom.fcr, 4);
}
/* support for SG-1000 games with extra RAM */
if ((cart_rom.mapper == MAPPER_RAM_8K) || (cart_rom.mapper == MAPPER_RAM_8K_EXT1))
{
/* 8KB extra RAM */
load_param(work_ram + 0x2000, 0x2000);
}
else if (cart_rom.mapper == MAPPER_RAM_2K)
{
/* 2KB extra RAM */
load_param(work_ram + 0x2000, 0x800);
}
return bufferptr;
}