From a4c059b8641e8fe170ac1f829e56a4d0e98fa455 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Fri, 1 Jul 2016 19:47:15 -0500 Subject: SCI32: Improve accuracy of frameout throttler --- engines/sci/graphics/frameout.cpp | 12 +++++++++++- engines/sci/graphics/frameout.h | 6 ++++++ 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'engines/sci') diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index 140c27a6d7..50f26474f1 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -76,6 +76,7 @@ GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCoordAd _benchmarkingFinished(false), _throttleFrameOut(true), _showStyles(nullptr), + _throttleState(0), // TODO: Stop using _gfxScreen _currentBuffer(screen->getDisplayWidth(), screen->getDisplayHeight(), nullptr), _remapOccurred(false), @@ -1567,7 +1568,16 @@ void GfxFrameout::kernelFrameOut(const bool shouldShowBits) { } if (_throttleFrameOut) { - g_sci->getEngineState()->speedThrottler(16); + uint8 throttleTime; + if (_throttleState == 2) { + throttleTime = 17; + _throttleState = 0; + } else { + throttleTime = 16; + ++_throttleState; + } + + g_sci->getEngineState()->speedThrottler(throttleTime); g_sci->getEngineState()->_throttleTrigger = true; } } diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h index 4a44410334..d349bbe66f 100644 --- a/engines/sci/graphics/frameout.h +++ b/engines/sci/graphics/frameout.h @@ -303,6 +303,12 @@ public: #pragma mark - #pragma mark Rendering private: + /** + * State tracker to provide more accurate 60fps + * video throttling. + */ + uint8 _throttleState; + /** * TODO: Documentation */ -- cgit v1.2.3