From 84c5f8b92dd07ae93dc8144ea0b10a60cab26434 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Wed, 22 Sep 2021 20:53:04 +0300 Subject: [PATCH] Fix #402 --- Core/gb.c | 1 + Core/mbc.c | 1 + 2 files changed, 2 insertions(+) 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) {