From c6503379284d268a1a3d7ebe7ac192b63732a372 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Thu, 8 Jun 2017 22:48:23 +0300 Subject: [PATCH] Fixed a bug where MBC RAM was no longer accessible after using the GB_reset functions --- Core/gb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Core/gb.c b/Core/gb.c index a4b3b263..8a14aca0 100755 --- a/Core/gb.c +++ b/Core/gb.c @@ -600,6 +600,7 @@ void GB_set_user_data(GB_gameboy_t *gb, void *data) void GB_reset(GB_gameboy_t *gb) { + uint32_t mbc_ram_size = gb->mbc_ram_size; bool cgb = gb->is_cgb; memset(gb, 0, (size_t)GB_GET_SECTION((GB_gameboy_t *) 0, unsaved)); gb->version = GB_STRUCT_VERSION; @@ -609,7 +610,7 @@ void GB_reset(GB_gameboy_t *gb) gb->cgb_ram_bank = 1; gb->io_registers[GB_IO_JOYP] = 0xF; gb->io_registers[GB_IO_OBP0] = gb->io_registers[GB_IO_OBP1] = 0xFF; - + gb->mbc_ram_size = mbc_ram_size; if (cgb) { gb->ram_size = 0x2000 * 8; memset(gb->ram, 0, gb->ram_size);