From c01c25febed921976e256d974bf97f948fe16753 Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Mon, 7 Jan 2013 02:16:34 -0500 Subject: Add support for user-selected and automatic frame skipping. Add support for PAL timings (20 ms per frame). User-selected frameskip causes slowdowns if the game runs slower than the resulting frame rate, but synchronises correctly if the game runs faster. Automatic frame skipping is still the default. It now only skips up to 8 frames, but in some games still skips that entire 8 frames. What's needed is an algorithm that averages frame latencies over a few seconds and skips while the latency is LOWER than the average. --- source/cpuexec.cpp | 75 ------------------------------------------------------ 1 file changed, 75 deletions(-) (limited to 'source/cpuexec.cpp') diff --git a/source/cpuexec.cpp b/source/cpuexec.cpp index 66bb8da..b90da6d 100644 --- a/source/cpuexec.cpp +++ b/source/cpuexec.cpp @@ -330,81 +330,6 @@ void S9xDoHBlankProcessing () Snapshot (NULL); } #endif - if(!game_fast_forward) - { - syncnow = getSysTime(); - if(syncnow > sync_next) - { - /* - * Little bit of a hack here: - * If we get behind and stay behind for a certain number - * of frames, we automatically enable fast forward. - * That really helps with certain games, such as - * Super Mario RPG and Yoshi's Island. - */ - if(skip_rate++ < 10) - { - syncdif = syncnow - sync_next; - if(syncdif < 11718) - { - IPPU.RenderThisFrame = false; - sync_next += 391; - } - else - { //lag more than 0.5s, maybe paused - IPPU.RenderThisFrame = true; - sync_next = syncnow; - framenum = 0; - sync_last = syncnow; - realframe = 1; - } - } - else - { - skip_rate = 0; - IPPU.RenderThisFrame = true; - sync_last= syncnow; - sync_next = syncnow+391; - } - } - else - { - skip_rate = 0; - syncdif = sync_next - syncnow; - if(syncdif > 391) - { - udelay(syncdif*22); - S9xProcessSound (0); - } - - IPPU.RenderThisFrame = true; - sync_next += 391; //16.7ms - realframe += 1; - } -#if 0 - if(++framenum >= 60) - { - syncdif = syncnow - sync_last; - sync_last = syncnow; - framenum = 0; - //printf("T %d %d\n", syncdif*42667/1000, realframe); - realframe = 0; - } -#endif - } - else - { - sync_last= 0; - sync_next = 0; - - if(skip_rate++ < 10) - IPPU.RenderThisFrame = false; - else - { - skip_rate = 0; - IPPU.RenderThisFrame = true; - } - } } if (CPU.V_Counter == PPU.ScreenHeight + 3) -- cgit v1.2.3