aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2012-10-13 21:06:02 +0300
committerFilippos Karapetis2012-10-13 21:06:02 +0300
commit76ff4c700166d69b416dae324ee616ab57265c34 (patch)
treeb5525f2ae83e05866411a38b0404086f7103682b /engines/sci
parentb91a132763f1048136d5073dce30f6c9919db457 (diff)
downloadscummvm-rg350-76ff4c700166d69b416dae324ee616ab57265c34.tar.gz
scummvm-rg350-76ff4c700166d69b416dae324ee616ab57265c34.tar.bz2
scummvm-rg350-76ff4c700166d69b416dae324ee616ab57265c34.zip
SCI: Hopefully fix bug #3565505 - "SCI : crash when loading a savegame"
This bug occurs because in the cases specified in the bug report, the main loop hasn't run fully yet, and there is a mini loop running instead (e.g. inside Print()) Hopefully, this catches most cases where the crash occurs, but it needs more testing to find if there is any other such case.
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/detection.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 58ac5f1fa6..8695d97621 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -834,12 +834,16 @@ Common::Error SciEngine::saveGameState(int slot, const Common::String &desc) {
return Common::kNoError;
}
+// Before enabling the load option in the ScummVM menu, the main game loop must
+// have run at least once. When the game loop runs, kGameIsRestarting is invoked,
+// thus the speed throttler is initialized. Hopefully fixes bug #3565505.
+
bool SciEngine::canLoadGameStateCurrently() {
- return !_gamestate->executionStackBase;
+ return !_gamestate->executionStackBase && (_gamestate->_throttleLastTime > 0 || _gamestate->_throttleTrigger);
}
bool SciEngine::canSaveGameStateCurrently() {
- return !_gamestate->executionStackBase;
+ return !_gamestate->executionStackBase && (_gamestate->_throttleLastTime > 0 || _gamestate->_throttleTrigger);
}
} // End of namespace Sci