diff options
author | Nebuleon Fumika | 2013-01-07 19:41:29 -0500 |
---|---|---|
committer | Nebuleon Fumika | 2013-01-07 19:41:29 -0500 |
commit | 377c6bcadbf56216237ee23841776701e2e9086c (patch) | |
tree | 9d3253ae2b6c7552befffe5391f99fff5e585ec0 /source/nds | |
parent | 42c8a90d38fb9188b8fb80ba32bbc387de7b1c52 (diff) | |
download | snesemu-377c6bcadbf56216237ee23841776701e2e9086c.tar.gz snesemu-377c6bcadbf56216237ee23841776701e2e9086c.tar.bz2 snesemu-377c6bcadbf56216237ee23841776701e2e9086c.zip |
Revert "Add a bit that tolerates 1/16 latency per frame in automatic frameskip mode."
This reverts commit d9b6322caafcbd355848a32acd8b8c0fa1746264.
Diffstat (limited to 'source/nds')
-rw-r--r-- | source/nds/entry.cpp | 82 |
1 files changed, 80 insertions, 2 deletions
diff --git a/source/nds/entry.cpp b/source/nds/entry.cpp index d9050ca..63d736f 100644 --- a/source/nds/entry.cpp +++ b/source/nds/entry.cpp @@ -693,8 +693,7 @@ void S9xSyncSpeed () // paused, so do nothing. if (syncdif <= -11719 /* 500.0 ms late or more */) sync_next = syncnow + frame_time * (auto_equivalent_skip + 1); - // Tolerate 1/16 late without skipping. - else if (syncdif < -(frame_time * auto_equivalent_skip / 16) && auto_equivalent_skip < 7) + else if (auto_equivalent_skip < 7) auto_equivalent_skip++; } if (auto_equivalent_skip >= 8) @@ -710,6 +709,85 @@ void S9xSyncSpeed () IPPU.RenderThisFrame = FALSE; } +#if 0 + // frame_time is in getSysTime units: 42.667 microseconds. + uint32 frame_time = Settings.PAL ? 468 /* = 20.0 ms */ : 391 /* = 16.67 ms */; + if (sync_last > syncnow) // Overflow occurred! (every 50 hrs) + { + // Render this frame regardless, set the + // sync_next, and get the hell out. + IPPU.RenderThisFrame = TRUE; + sync_last = syncnow; + sync_next = syncnow + frame_time; + return; + } + sync_last = syncnow; + // If this is positive, we have syncdif*42.66 microseconds to + // spare. + // If this is negative, we're late by syncdif*42.66 + // microseconds. + syncdif = sync_next - syncnow; + if (syncdif < 0 && syncdif >= -(frame_time / 2)) + { + // We're late, but by less than half a frame. Draw it + // anyway. If the next frame is too late, it'll be + // skipped. + skip_rate = 0; + IPPU.RenderThisFrame = true; + sync_next += frame_time; + } + else if(syncdif < 0) + { + /* + * If we're consistently late, delay up to 8 frames. + * + * That really helps with certain games, such as + * Super Mario RPG and Yoshi's Island. + */ + if(++skip_rate < 10) + { + if(syncdif >= -11719 /* not more than 500.0 ms late */) + { + IPPU.RenderThisFrame = FALSE; + sync_next += frame_time; + } + else + { //lag more than 0.5s, maybe paused + IPPU.RenderThisFrame = TRUE; + sync_next = syncnow + frame_time; + framenum = 0; + } + } + else + { + skip_rate = 0; + IPPU.RenderThisFrame = TRUE; + sync_next = syncnow + frame_time; + } + } + else // Early + { + skip_rate = 0; + ds2_setCPUclocklevel(0); + if (syncdif > 0) + udelay(syncdif * 128 / 3 /* times 42 + 2/3 microseconds */); + set_cpu_clock(clock_speed_number); + S9xProcessSound (0); + + IPPU.RenderThisFrame = TRUE; + sync_next += frame_time; + } +/* + 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 /* if (Settings.SkipFrames != AUTO_FRAMERATE && !game_fast_forward) */ { |