API issue – RTC data should not be wiped after GB_reset

This commit is contained in:
Lior Halphon 2021-09-30 21:23:52 +03:00
parent 8068ff41fb
commit 345e51647f
1 changed files with 3 additions and 0 deletions

View File

@ -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;