mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-12-27 03:31:49 +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
|
* Genesis Plus
|
||||||
* MegaSD flashcart CD hardware interface overlay & enhanced ROM mappers
|
* 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
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
@ -91,20 +91,28 @@ void megasd_reset(void)
|
|||||||
m68k.memory_map[0x03].write16 = megasd_ctrl_write_word;
|
m68k.memory_map[0x03].write16 = megasd_ctrl_write_word;
|
||||||
zbank_memory_map[0x03].read = megasd_ctrl_read_byte;
|
zbank_memory_map[0x03].read = megasd_ctrl_read_byte;
|
||||||
|
|
||||||
/* reset CD hardware */
|
/* reset CD hardware (only if not already emulated) */
|
||||||
|
if (system_hw != SYSTEM_MCD)
|
||||||
|
{
|
||||||
pcm_reset();
|
pcm_reset();
|
||||||
cdd_reset();
|
cdd_reset();
|
||||||
scd.regs[0x36>>1].byte.h = 0x01;
|
scd.regs[0x36>>1].byte.h = 0x01;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int megasd_context_save(uint8 *state)
|
int megasd_context_save(uint8 *state)
|
||||||
{
|
{
|
||||||
int bufferptr = 0;
|
int bufferptr = 0;
|
||||||
|
|
||||||
save_param(&megasd_hw, sizeof(megasd_hw));
|
save_param(&megasd_hw, sizeof(megasd_hw));
|
||||||
|
|
||||||
|
/* save needed CD hardware state (only if not already saved) */
|
||||||
|
if (system_hw != SYSTEM_MCD)
|
||||||
|
{
|
||||||
bufferptr += cdd_context_save(&state[bufferptr]);
|
bufferptr += cdd_context_save(&state[bufferptr]);
|
||||||
bufferptr += pcm_context_save(&state[bufferptr]);
|
bufferptr += pcm_context_save(&state[bufferptr]);
|
||||||
save_param(&scd.regs[0x36>>1].byte.h, 1);
|
save_param(&scd.regs[0x36>>1].byte.h, 1);
|
||||||
|
}
|
||||||
|
|
||||||
return bufferptr;
|
return bufferptr;
|
||||||
}
|
}
|
||||||
@ -114,9 +122,14 @@ int megasd_context_load(uint8 *state)
|
|||||||
int bufferptr = 0;
|
int bufferptr = 0;
|
||||||
|
|
||||||
load_param(&megasd_hw, sizeof(megasd_hw));
|
load_param(&megasd_hw, sizeof(megasd_hw));
|
||||||
|
|
||||||
|
/* load needed CD hardware state (only if not already loaded) */
|
||||||
|
if (system_hw != SYSTEM_MCD)
|
||||||
|
{
|
||||||
bufferptr += cdd_context_load(&state[bufferptr], STATE_VERSION);
|
bufferptr += cdd_context_load(&state[bufferptr], STATE_VERSION);
|
||||||
bufferptr += pcm_context_load(&state[bufferptr]);
|
bufferptr += pcm_context_load(&state[bufferptr]);
|
||||||
load_param(&scd.regs[0x36>>1].byte.h, 1);
|
load_param(&scd.regs[0x36>>1].byte.h, 1);
|
||||||
|
}
|
||||||
|
|
||||||
return bufferptr;
|
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;
|
m68k.memory_map[i].write16 = m68k_unused_16_w;
|
||||||
zbank_memory_map[i].write = zbank_unused_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
|
else
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* MegaSD flashcart CD hardware interface overlay & enhanced ROM mappers
|
* 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
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
|
Loading…
Reference in New Issue
Block a user