[Scummvm-git-logs] scummvm master -> f6de4e82d4b974c4be8edf99afe24e1f809724f4
sev-
sev at scummvm.org
Sun Mar 29 16:16:06 UTC 2020
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
be534ca080 DIRECTOR: Do not crash when initial movie is set incorrectly
f6de4e82d4 DIRECTOR: Do not try tom compile unreferenced frame scripts
Commit: be534ca08014e479cddce806f2c814e920e99920
https://github.com/scummvm/scummvm/commit/be534ca08014e479cddce806f2c814e920e99920
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-03-29T18:15:47+02:00
Commit Message:
DIRECTOR: Do not crash when initial movie is set incorrectly
Changed paths:
engines/director/director.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index cbafbd1350..dfb998a0bc 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -175,6 +175,11 @@ Common::Error DirectorEngine::run() {
} else {
loadInitialMovie(getEXEName());
+ if (!_mainArchive) {
+ warning("Cannot open main movie");
+ return Common::kNoGameDataFoundError;
+ }
+
// Let's check if it is a projector file
// So far tested with Spaceship Warlock, D2
if (_mainArchive->hasResource(MKTAG('B', 'N', 'D', 'L'), "Projector")) {
Commit: f6de4e82d4b974c4be8edf99afe24e1f809724f4
https://github.com/scummvm/scummvm/commit/f6de4e82d4b974c4be8edf99afe24e1f809724f4
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-03-29T18:15:47+02:00
Commit Message:
DIRECTOR: Do not try tom compile unreferenced frame scripts
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index a9c1df67bc..c9605377b6 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1030,6 +1030,14 @@ void Score::loadActions(Common::SeekableSubReadStreamEndian &stream) {
break;
}
+ bool *scriptRefs = (bool *)calloc(_actions.size() + 1, sizeof(int));
+
+ // Now let's scan which scripts are actually referenced
+ for (int i = 0; i < _frames.size(); i++) {
+ if (_frames[i]->_actionId <= _actions.size())
+ scriptRefs[_frames[i]->_actionId] = true;
+ }
+
Common::HashMap<uint16, Common::String>::iterator j;
if (ConfMan.getBool("dump_scripts"))
@@ -1038,12 +1046,19 @@ void Score::loadActions(Common::SeekableSubReadStreamEndian &stream) {
dumpScript(j->_value.c_str(), kFrameScript, j->_key);
}
- for (j = _actions.begin(); j != _actions.end(); ++j)
+ for (j = _actions.begin(); j != _actions.end(); ++j) {
+ if (!scriptRefs[j->_key]) {
+ warning("Action id %d is not referenced, skipping", j->_key);
+ continue;
+ }
if (!j->_value.empty()) {
_lingo->addCode(j->_value.c_str(), kFrameScript, j->_key);
processImmediateFrameScript(j->_value, j->_key);
}
+ }
+
+ free(scriptRefs);
}
bool Score::processImmediateFrameScript(Common::String s, int id) {
More information about the Scummvm-git-logs
mailing list