diff --git a/platform/libretro/libretro.c b/platform/libretro/libretro.c index 3c0f726..84aa5f1 100644 --- a/platform/libretro/libretro.c +++ b/platform/libretro/libretro.c @@ -137,13 +137,11 @@ char **g_argv; static unsigned frameskip_type = 0; static unsigned frameskip_threshold = 0; static uint16_t frameskip_counter = 0; +static unsigned frameskip_interval = 0; static bool retro_audio_buff_active = false; static unsigned retro_audio_buff_occupancy = 0; static bool retro_audio_buff_underrun = false; -/* Maximum number of consecutive frames that - * can be skipped */ -#define FRAMESKIP_MAX 60 static unsigned audio_latency = 0; static bool update_audio_latency = false; @@ -1982,7 +1980,7 @@ static void update_variables(bool first_run) if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) { if (strcmp(var.value, "auto") == 0) frameskip_type = 1; - else if (strcmp(var.value, "manual") == 0) + else if (strcmp(var.value, "auto_threshold") == 0) frameskip_type = 2; } @@ -1991,6 +1989,11 @@ static void update_variables(bool first_run) var.value = NULL; if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) frameskip_threshold = strtol(var.value, NULL, 10); + frameskip_interval = 4; + var.key = "picodrive_frameskip_interval"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + frameskip_interval = strtol(var.value, NULL, 10); old_vout_format = vout_format; var.value = NULL; @@ -2099,7 +2102,7 @@ void retro_run(void) break; } - if (!PicoIn.skipFrame || (frameskip_counter >= FRAMESKIP_MAX)) { + if (!PicoIn.skipFrame || (frameskip_counter >= frameskip_interval)) { PicoIn.skipFrame = 0; frameskip_counter = 0; } else @@ -2284,6 +2287,7 @@ void retro_init(void) frameskip_type = 0; frameskip_threshold = 0; frameskip_counter = 0; + frameskip_interval = 0; retro_audio_buff_active = false; retro_audio_buff_occupancy = 0; retro_audio_buff_underrun = false; diff --git a/platform/libretro/libretro_core_options.h b/platform/libretro/libretro_core_options.h index 9cd2f85..d2ebede 100644 --- a/platform/libretro/libretro_core_options.h +++ b/platform/libretro/libretro_core_options.h @@ -340,13 +340,13 @@ struct retro_core_option_v2_definition option_defs_us[] = { "picodrive_frameskip", "Frameskip", NULL, - "Skip frames to avoid audio buffer under-run (crackling). Improves performance at the expense of visual smoothness. 'Auto' skips frames when advised by the frontend. 'Manual' utilises the 'Frameskip Threshold (%)' setting.", + "Skip frames to avoid audio buffer under-run (crackling). Improves performance at the expense of visual smoothness. 'Auto' skips frames when advised by the frontend. 'Threshold' utilises the 'Frameskip Threshold (%)' setting.", NULL, "performance", { - { "disabled", NULL }, - { "auto", "Auto" }, - { "manual", "Manual" }, + { "disabled", NULL }, + { "auto", "Auto" }, + { "auto_threshold", "Threshold" }, { NULL, NULL }, }, "disabled" @@ -355,7 +355,7 @@ struct retro_core_option_v2_definition option_defs_us[] = { "picodrive_frameskip_threshold", "Frameskip Threshold (%)", NULL, - "When 'Frameskip' is set to 'Manual', specifies the audio buffer occupancy threshold (percentage) below which frames will be skipped. Higher values reduce the risk of crackling by causing frames to be dropped more frequently.", + "When 'Frameskip' is set to 'Threshold', specifies the audio buffer occupancy threshold (percentage) below which frames will be skipped. Higher values reduce the risk of crackling by causing frames to be dropped more frequently.", NULL, "performance", { @@ -379,6 +379,28 @@ struct retro_core_option_v2_definition option_defs_us[] = { }, "33" }, + { + "picodrive_frameskip_interval", + "Frameskip Interval", + NULL, + "The maximum number of frames that can be skipped before a new frame is rendered.", + NULL, + "performance", + { + { "1", NULL }, + { "2", NULL }, + { "3", NULL }, + { "4", NULL }, + { "5", NULL }, + { "6", NULL }, + { "7", NULL }, + { "8", NULL }, + { "9", NULL }, + { "10", NULL }, + { NULL, NULL }, + }, + "3" + }, { "picodrive_sprlim", "No Sprite Limit",