From afac587aab5265fda4c198f40ae054c74115f12b Mon Sep 17 00:00:00 2001 From: neonloop Date: Wed, 9 Feb 2022 06:55:47 +0000 Subject: Adds frameskip interval for limiting max skipped frames --- libretro.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'libretro.c') diff --git a/libretro.c b/libretro.c index f64b71c..5e4dc31 100644 --- a/libretro.c +++ b/libretro.c @@ -70,13 +70,11 @@ static int32_t audio_low_pass_range = (60 * 65536) / 100; 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 30 static unsigned retro_audio_latency = 0; static bool update_audio_latency = false; @@ -488,6 +486,7 @@ void retro_deinit(void) audio_low_pass_enabled = false; audio_low_pass_range = (60 * 65536) / 100; #endif + frameskip_interval = 0; retro_audio_buff_active = false; retro_audio_buff_occupancy = 0; retro_audio_buff_underrun = false; @@ -562,7 +561,7 @@ static void check_variables(bool first_run) { 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; } @@ -593,6 +592,14 @@ static void check_variables(bool first_run) audio_low_pass_range = (strtol(var.value, NULL, 10) * 0x10000) / 100; #endif + var.key = "snes9x_2005_frameskip_interval"; + var.value = NULL; + + frameskip_interval = 4; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + frameskip_interval = strtol(var.value, NULL, 10); + var.key = "snes9x_2005_overclock_cycles"; var.value = NULL; @@ -690,7 +697,7 @@ void retro_run(void) if (skip_frame) { - if(frameskip_counter < FRAMESKIP_MAX) + if(frameskip_counter < frameskip_interval) { IPPU.RenderThisFrame = false; frameskip_counter++; -- cgit v1.2.3