diff --git a/Core/gb.c b/Core/gb.c index aa36e3e..dc6babc 100644 --- a/Core/gb.c +++ b/Core/gb.c @@ -412,6 +412,7 @@ int GB_load_gbs_from_buffer(GB_gameboy_t *gb, const uint8_t *buffer, size_t size if (gb->mbc_ram) { free(gb->mbc_ram); gb->mbc_ram = NULL; + gb->mbc_ram_size = 0; } if (gb->cartridge_type->has_ram) { diff --git a/Core/mbc.c b/Core/mbc.c index 1e15f8a..a9e758e 100644 --- a/Core/mbc.c +++ b/Core/mbc.c @@ -141,6 +141,7 @@ void GB_configure_cart(GB_gameboy_t *gb) if (gb->mbc_ram) { free(gb->mbc_ram); gb->mbc_ram = NULL; + gb->mbc_ram_size = 0; } if (gb->cartridge_type->has_ram) {