Add RTC setting to libretro

This commit is contained in:
Lior Halphon 2021-02-26 01:07:46 +02:00
parent bae91cdb1d
commit 34b0404ffa

View File

@ -237,6 +237,7 @@ static const struct retro_variable vars_single[] = {
{ "sameboy_model", "Emulated model (Restart game); Auto|Game Boy|Game Boy Color|Game Boy Advance|Super Game Boy|Super Game Boy 2" }, { "sameboy_model", "Emulated model (Restart game); Auto|Game Boy|Game Boy Color|Game Boy Advance|Super Game Boy|Super Game Boy 2" },
{ "sameboy_border", "Display border; Super Game Boy only|always|never" }, { "sameboy_border", "Display border; Super Game Boy only|always|never" },
{ "sameboy_rumble", "Enable rumble; rumble-enabled games|all games|never" }, { "sameboy_rumble", "Enable rumble; rumble-enabled games|all games|never" },
{ "sameboy_rtc", "Real Time Clock emulation; sync to system clock|accurate" },
{ NULL } { NULL }
}; };
@ -595,6 +596,17 @@ static void check_variables()
} }
} }
var.key = "sameboy_rtc";
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
if (strcmp(var.value, "sync to system clock") == 0) {
GB_set_rtc_mode(&gameboy[0], GB_RTC_MODE_SYNC_TO_HOST);
}
else if (strcmp(var.value, "accurate") == 0) {
GB_set_rtc_mode(&gameboy[0], GB_RTC_MODE_ACCURATE);
}
}
var.key = "sameboy_high_pass_filter_mode"; var.key = "sameboy_high_pass_filter_mode";
var.value = NULL; var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) { if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
@ -654,6 +666,8 @@ static void check_variables()
else { else {
GB_set_border_mode(&gameboy[0], GB_BORDER_NEVER); GB_set_border_mode(&gameboy[0], GB_BORDER_NEVER);
GB_set_border_mode(&gameboy[1], GB_BORDER_NEVER); GB_set_border_mode(&gameboy[1], GB_BORDER_NEVER);
GB_set_rtc_mode(&gameboy[0], GB_RTC_MODE_ACCURATE);
GB_set_rtc_mode(&gameboy[1], GB_RTC_MODE_ACCURATE);
var.key = "sameboy_color_correction_mode_1"; var.key = "sameboy_color_correction_mode_1";
var.value = NULL; var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) { if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {