mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-13 06:15:07 +01:00
[Core/MD] reduced savestate size when both Mega CD and MegaSD hardware are detected (fixes savestates with MSU-MD games that have "SEGA MEGASD" in ROM header)
This commit is contained in:
parent
47d20265c9
commit
eef172acf3
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 3.8 MiB After Width: | Height: | Size: 3.8 MiB |
Binary file not shown.
Before Width: | Height: | Size: 4.0 MiB After Width: | Height: | Size: 4.0 MiB |
@ -2,7 +2,7 @@
|
||||
* Genesis Plus
|
||||
* MegaSD flashcart CD hardware interface overlay & enhanced ROM mappers
|
||||
*
|
||||
* Copyright (C) 2020-2021 Eke-Eke (Genesis Plus GX)
|
||||
* Copyright (C) 2020-2022 Eke-Eke (Genesis Plus GX)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
@ -91,10 +91,13 @@ void megasd_reset(void)
|
||||
m68k.memory_map[0x03].write16 = megasd_ctrl_write_word;
|
||||
zbank_memory_map[0x03].read = megasd_ctrl_read_byte;
|
||||
|
||||
/* reset CD hardware */
|
||||
pcm_reset();
|
||||
cdd_reset();
|
||||
scd.regs[0x36>>1].byte.h = 0x01;
|
||||
/* reset CD hardware (only if not already emulated) */
|
||||
if (system_hw != SYSTEM_MCD)
|
||||
{
|
||||
pcm_reset();
|
||||
cdd_reset();
|
||||
scd.regs[0x36>>1].byte.h = 0x01;
|
||||
}
|
||||
}
|
||||
|
||||
int megasd_context_save(uint8 *state)
|
||||
@ -102,9 +105,14 @@ int megasd_context_save(uint8 *state)
|
||||
int bufferptr = 0;
|
||||
|
||||
save_param(&megasd_hw, sizeof(megasd_hw));
|
||||
bufferptr += cdd_context_save(&state[bufferptr]);
|
||||
bufferptr += pcm_context_save(&state[bufferptr]);
|
||||
save_param(&scd.regs[0x36>>1].byte.h, 1);
|
||||
|
||||
/* save needed CD hardware state (only if not already saved) */
|
||||
if (system_hw != SYSTEM_MCD)
|
||||
{
|
||||
bufferptr += cdd_context_save(&state[bufferptr]);
|
||||
bufferptr += pcm_context_save(&state[bufferptr]);
|
||||
save_param(&scd.regs[0x36>>1].byte.h, 1);
|
||||
}
|
||||
|
||||
return bufferptr;
|
||||
}
|
||||
@ -114,9 +122,14 @@ int megasd_context_load(uint8 *state)
|
||||
int bufferptr = 0;
|
||||
|
||||
load_param(&megasd_hw, sizeof(megasd_hw));
|
||||
bufferptr += cdd_context_load(&state[bufferptr], STATE_VERSION);
|
||||
bufferptr += pcm_context_load(&state[bufferptr]);
|
||||
load_param(&scd.regs[0x36>>1].byte.h, 1);
|
||||
|
||||
/* load needed CD hardware state (only if not already loaded) */
|
||||
if (system_hw != SYSTEM_MCD)
|
||||
{
|
||||
bufferptr += cdd_context_load(&state[bufferptr], STATE_VERSION);
|
||||
bufferptr += pcm_context_load(&state[bufferptr]);
|
||||
load_param(&scd.regs[0x36>>1].byte.h, 1);
|
||||
}
|
||||
|
||||
return bufferptr;
|
||||
}
|
||||
@ -314,10 +327,6 @@ void megasd_rom_mapper_w(unsigned int address, unsigned int data)
|
||||
m68k.memory_map[i].write16 = m68k_unused_16_w;
|
||||
zbank_memory_map[i].write = zbank_unused_w;
|
||||
}
|
||||
|
||||
/* enable CD hardware overlay access */
|
||||
m68k.memory_map[0x03].write8 = megasd_ctrl_write_byte;
|
||||
m68k.memory_map[0x03].write16 = megasd_ctrl_write_word;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Genesis Plus
|
||||
* MegaSD flashcart CD hardware interface overlay & enhanced ROM mappers
|
||||
*
|
||||
* Copyright (C) 2020-2021 Eke-Eke (Genesis Plus GX)
|
||||
* Copyright (C) 2020-2022 Eke-Eke (Genesis Plus GX)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
|
Loading…
Reference in New Issue
Block a user