Fix libretro RTC support. Fixes #41

This commit is contained in:
Lior Halphon 2018-11-03 13:18:08 +02:00
parent c9d6a1381f
commit 96e9ea2d1e

View File

@ -994,7 +994,7 @@ bool retro_unserialize(const void *data, size_t size)
void *retro_get_memory_data(unsigned type) void *retro_get_memory_data(unsigned type)
{ {
void* data = NULL; void *data = NULL;
switch(mode) switch(mode)
{ {
case MODE_SINGLE_GAME: case MODE_SINGLE_GAME:
@ -1016,7 +1016,7 @@ void *retro_get_memory_data(unsigned type)
break; break;
case RETRO_MEMORY_RTC: case RETRO_MEMORY_RTC:
if(gameboy[0].cartridge_type->has_battery) if(gameboy[0].cartridge_type->has_battery)
data = &gameboy[0].rtc_real; data = GB_GET_SECTION(&gameboy[0], rtc);
else else
data = NULL; data = NULL;
break; break;
@ -1043,13 +1043,13 @@ void *retro_get_memory_data(unsigned type)
break; break;
case RETRO_MEMORY_GAMEBOY_1_RTC: case RETRO_MEMORY_GAMEBOY_1_RTC:
if(gameboy[0].cartridge_type->has_battery) if(gameboy[0].cartridge_type->has_battery)
data = &gameboy[0].rtc_real; data = GB_GET_SECTION(&gameboy[0], rtc);
else else
data = NULL; data = NULL;
break; break;
case RETRO_MEMORY_GAMEBOY_2_RTC: case RETRO_MEMORY_GAMEBOY_2_RTC:
if(gameboy[1].cartridge_type->has_battery) if(gameboy[1].cartridge_type->has_battery)
data = &gameboy[1].rtc_real; data = GB_GET_SECTION(&gameboy[1], rtc);
else else
data = NULL; data = NULL;
break; break;
@ -1088,7 +1088,7 @@ size_t retro_get_memory_size(unsigned type)
break; break;
case RETRO_MEMORY_RTC: case RETRO_MEMORY_RTC:
if(gameboy[0].cartridge_type->has_battery) if(gameboy[0].cartridge_type->has_battery)
size = sizeof (gameboy[0].rtc_real); size = GB_SECTION_SIZE(rtc);
else else
size = 0; size = 0;
break; break;
@ -1115,11 +1115,11 @@ size_t retro_get_memory_size(unsigned type)
break; break;
case RETRO_MEMORY_GAMEBOY_1_RTC: case RETRO_MEMORY_GAMEBOY_1_RTC:
if(gameboy[0].cartridge_type->has_battery) if(gameboy[0].cartridge_type->has_battery)
size = sizeof (gameboy[0].rtc_real); size = GB_SECTION_SIZE(rtc);
break; break;
case RETRO_MEMORY_GAMEBOY_2_RTC: case RETRO_MEMORY_GAMEBOY_2_RTC:
if(gameboy[1].cartridge_type->has_battery) if(gameboy[1].cartridge_type->has_battery)
size = sizeof (gameboy[1].rtc_real); size = GB_SECTION_SIZE(rtc);
break; break;
default: default:
break; break;