From 345e51647f2a7ce1ea39f21497f5a6dc75a587c8 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Thu, 30 Sep 2021 21:23:52 +0300 Subject: [PATCH] =?UTF-8?q?API=20issue=20=E2=80=93=20RTC=20data=20should?= =?UTF-8?q?=20not=20be=20wiped=20after=20GB=5Freset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/gb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Core/gb.c b/Core/gb.c index dc6babc..afc180f 100644 --- a/Core/gb.c +++ b/Core/gb.c @@ -1603,7 +1603,10 @@ void GB_reset(GB_gameboy_t *gb) { uint32_t mbc_ram_size = gb->mbc_ram_size; GB_model_t model = gb->model; + uint8_t rtc_section[GB_SECTION_SIZE(rtc)]; + memcpy(rtc_section, GB_GET_SECTION(gb, rtc), sizeof(rtc_section)); memset(gb, 0, (size_t)GB_GET_SECTION((GB_gameboy_t *) 0, unsaved)); + memcpy(GB_GET_SECTION(gb, rtc), rtc_section, sizeof(rtc_section)); gb->model = model; gb->version = GB_STRUCT_VERSION;