소스 검색

32x, improved auto frame skip, plus new config option for max auto skip

kub 4 년 전
부모
커밋
e7ee7bc00a
5개의 변경된 파일17개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 0
      platform/common/config_file.c
  2. 10 3
      platform/common/emu.c
  3. 1 0
      platform/common/emu.h
  4. 1 0
      platform/common/menu_pico.c
  5. 1 0
      platform/common/menu_pico.h

+ 4 - 0
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;

+ 10 - 3
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) {

+ 1 - 0
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;

+ 1 - 0
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,

+ 1 - 0
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) */