aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorColin Snover2016-07-02 19:11:59 -0500
committerColin Snover2016-07-02 22:29:28 -0500
commit57a53420c366d327581cee72181bd6bed8d8e7c7 (patch)
tree2b6764e380c97c215837167a4f0a6244d1cb9e42 /engines
parentda48b1bbea94e8ae83b51125c998ff27a4358ddd (diff)
downloadscummvm-rg350-57a53420c366d327581cee72181bd6bed8d8e7c7.tar.gz
scummvm-rg350-57a53420c366d327581cee72181bd6bed8d8e7c7.tar.bz2
scummvm-rg350-57a53420c366d327581cee72181bd6bed8d8e7c7.zip
SCI32: Expose graphics throttling code
Controls that manage their own event loops and call frameOut directly generally need to sleep in order to avoid 100% CPU, just like the main VM event loop.
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/graphics/controls32.cpp3
-rw-r--r--engines/sci/graphics/frameout.cpp4
-rw-r--r--engines/sci/graphics/frameout.h8
3 files changed, 12 insertions, 3 deletions
diff --git a/engines/sci/graphics/controls32.cpp b/engines/sci/graphics/controls32.cpp
index 6aad636e7e..4cbb4541df 100644
--- a/engines/sci/graphics/controls32.cpp
+++ b/engines/sci/graphics/controls32.cpp
@@ -310,8 +310,7 @@ reg_t GfxControls32::kernelEditText(const reg_t controlObject) {
g_sci->_gfxFrameout->frameOut(true);
g_sci->getSciDebugger()->onFrame();
- g_sci->getEngineState()->speedThrottler(16);
- g_sci->getEngineState()->_throttleTrigger = true;
+ g_sci->_gfxFrameout->throttle();
}
g_sci->_gfxFrameout->deletePlane(*plane);
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index 50f26474f1..c0feea8999 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -1567,6 +1567,10 @@ void GfxFrameout::kernelFrameOut(const bool shouldShowBits) {
frameOut(shouldShowBits);
}
+ throttle();
+}
+
+void GfxFrameout::throttle() {
if (_throttleFrameOut) {
uint8 throttleTime;
if (_throttleState == 2) {
diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h
index 05c48c3485..cc62c61d22 100644
--- a/engines/sci/graphics/frameout.h
+++ b/engines/sci/graphics/frameout.h
@@ -185,7 +185,7 @@ private:
/**
* Whether or not calls to kFrameOut should be framerate
- * limited to ~60fps.
+ * limited to 60fps.
*/
bool _throttleFrameOut;
@@ -438,6 +438,12 @@ public:
void kernelFrameOut(const bool showBits);
/**
+ * Throttles the engine as necessary to maintain
+ * 60fps output.
+ */
+ void throttle();
+
+ /**
* Updates the internal screen buffer for the next
* frame. If `shouldShowBits` is true, also sends the
* buffer to hardware. If `eraseRect` is non-empty,