Add RTC option to the SDL port, fix a bug where rewind setting didn't update

This commit is contained in:
Lior Halphon 2021-02-26 01:04:24 +02:00
parent 72cb391612
commit bae91cdb1d
3 changed files with 19 additions and 0 deletions

View File

@ -482,11 +482,26 @@ static void toggle_bootrom(unsigned index)
} }
} }
static void toggle_rtc_mode(unsigned index)
{
configuration.rtc_mode = !configuration.rtc_mode;
}
const char *current_rtc_mode_string(unsigned index)
{
switch (configuration.rtc_mode) {
case GB_RTC_MODE_SYNC_TO_HOST: return "Sync to System Clock";
case GB_RTC_MODE_ACCURATE: return "Accurate";
}
return "";
}
static const struct menu_item emulation_menu[] = { static const struct menu_item emulation_menu[] = {
{"Emulated Model:", cycle_model, current_model_string, cycle_model_backwards}, {"Emulated Model:", cycle_model, current_model_string, cycle_model_backwards},
{"SGB Revision:", cycle_sgb_revision, current_sgb_revision_string, cycle_sgb_revision_backwards}, {"SGB Revision:", cycle_sgb_revision, current_sgb_revision_string, cycle_sgb_revision_backwards},
{"Boot ROMs Folder:", toggle_bootrom, current_bootrom_string, toggle_bootrom}, {"Boot ROMs Folder:", toggle_bootrom, current_bootrom_string, toggle_bootrom},
{"Rewind Length:", cycle_rewind, current_rewind_string, cycle_rewind_backwards}, {"Rewind Length:", cycle_rewind, current_rewind_string, cycle_rewind_backwards},
{"Real Time Clock:", toggle_rtc_mode, current_rtc_mode_string, toggle_rtc_mode},
{"Back", return_to_root_menu}, {"Back", return_to_root_menu},
{NULL,} {NULL,}
}; };

View File

@ -116,6 +116,7 @@ typedef struct {
uint8_t color_temperature; uint8_t color_temperature;
char bootrom_path[4096]; char bootrom_path[4096];
uint8_t interference_volume; uint8_t interference_volume;
GB_rtc_mode_t rtc_mode;
} configuration_t; } configuration_t;
extern configuration_t configuration; extern configuration_t configuration;

View File

@ -125,6 +125,8 @@ static void open_menu(void)
GB_set_border_mode(&gb, configuration.border_mode); GB_set_border_mode(&gb, configuration.border_mode);
update_palette(); update_palette();
GB_set_highpass_filter_mode(&gb, configuration.highpass_mode); GB_set_highpass_filter_mode(&gb, configuration.highpass_mode);
GB_set_rewind_length(&gb, configuration.rewind_length);
GB_set_rtc_mode(&gb, configuration.rtc_mode);
if (previous_width != GB_get_screen_width(&gb)) { if (previous_width != GB_get_screen_width(&gb)) {
screen_size_changed(); screen_size_changed();
} }
@ -513,6 +515,7 @@ restart:
} }
GB_set_highpass_filter_mode(&gb, configuration.highpass_mode); GB_set_highpass_filter_mode(&gb, configuration.highpass_mode);
GB_set_rewind_length(&gb, configuration.rewind_length); GB_set_rewind_length(&gb, configuration.rewind_length);
GB_set_rtc_mode(&gb, configuration.rtc_mode);
GB_set_update_input_hint_callback(&gb, handle_events); GB_set_update_input_hint_callback(&gb, handle_events);
GB_apu_set_sample_callback(&gb, gb_audio_callback); GB_apu_set_sample_callback(&gb, gb_audio_callback);
} }