From: kub Date: Thu, 10 Oct 2019 22:06:50 +0000 (+0200) Subject: 32x, improved auto frame skip, plus new config option for max auto skip X-Git-Tag: v2.00~824 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7ee7bc00afc6b8167f1c916be15430f2873f240;p=picodrive.git 32x, improved auto frame skip, plus new config option for max auto skip --- diff --git a/platform/common/config_file.c b/platform/common/config_file.c index 1b5c5172..7248d239 100644 --- a/platform/common/config_file.c +++ b/platform/common/config_file.c @@ -322,6 +322,10 @@ static int custom_read(menu_entry *me, const char *var, const char *val) currentConfig.gamma = atoi(val); return 1; + case MA_OPT2_MAX_FRAMESKIP: + currentConfig.max_skip = atoi(val); + return 1; + /* PSP */ case MA_OPT3_SCALE: if (strcasecmp(var, "Scale factor") != 0) return 0; diff --git a/platform/common/emu.c b/platform/common/emu.c index da03bff1..15aa5392 100644 --- a/platform/common/emu.c +++ b/platform/common/emu.c @@ -596,6 +596,7 @@ void emu_prep_defconfig(void) defaultConfig.turbo_rate = 15; defaultConfig.msh2_khz = PICO_MSH2_HZ / 1000; defaultConfig.ssh2_khz = PICO_SSH2_HZ / 1000; + defaultConfig.max_skip = 4; // platform specific overrides pemu_prep_defconfig(); @@ -1463,10 +1464,16 @@ void emu_loop(void) else if (diff < -target_frametime_x3) { /* no time left for this frame - skip */ - /* limit auto frameskip to 8 */ - if (frames_done / 8 <= frames_shown) + /* limit auto frameskip to max_skip */ + if (fskip_cnt < currentConfig.max_skip) { + fskip_cnt++; skip = 1; - } + } + else { + fskip_cnt = 0; + } + } else + fskip_cnt = 0; // don't go in debt too much while (diff < -target_frametime_x3 * 3) { diff --git a/platform/common/emu.h b/platform/common/emu.h index 1e751f89..26e2159b 100644 --- a/platform/common/emu.h +++ b/platform/common/emu.h @@ -76,6 +76,7 @@ typedef struct _currentConfig_t { int msh2_khz; int ssh2_khz; int overclock_68k; + int max_skip; } currentConfig_t; extern currentConfig_t currentConfig, defaultConfig; diff --git a/platform/common/menu_pico.c b/platform/common/menu_pico.c index 9fb31426..dc7ceda4 100644 --- a/platform/common/menu_pico.c +++ b/platform/common/menu_pico.c @@ -506,6 +506,7 @@ static menu_entry e_menu_adv_options[] = mee_onoff ("Disable frame limiter", MA_OPT2_NO_FRAME_LIMIT,currentConfig.EmuOpt, EOPT_NO_FRMLIMIT), mee_onoff ("Enable dynarecs", MA_OPT2_DYNARECS, PicoIn.opt, POPT_EN_DRC), mee_onoff ("Status line in main menu", MA_OPT2_STATUS_LINE, currentConfig.EmuOpt, EOPT_SHOW_RTC), + mee_range ("Max auto frameskip", MA_OPT2_MAX_FRAMESKIP, currentConfig.max_skip, 1, 10), mee_onoff ("PWM IRQ optimization", MA_OPT2_PWM_IRQ_OPT, PicoIn.opt, POPT_PWM_IRQ_OPT), MENU_OPTIONS_ADV mee_end, diff --git a/platform/common/menu_pico.h b/platform/common/menu_pico.h index c626c772..4c0bbdd1 100644 --- a/platform/common/menu_pico.h +++ b/platform/common/menu_pico.h @@ -58,6 +58,7 @@ typedef enum MA_OPT2_NO_SPRITE_LIM, MA_OPT2_NO_IDLE_LOOPS, MA_OPT2_OVERCLOCK_M68K, + MA_OPT2_MAX_FRAMESKIP, MA_OPT2_PWM_IRQ_OPT, MA_OPT2_DONE, MA_OPT3_SCALE, /* psp (all OPT3) */