[Scummvm-git-logs] scummvm master -> 2928ac65f9b775be313cd1b896abdec9dbb41175

sev- sev at scummvm.org
Thu May 21 21:50:46 UTC 2020


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2928ac65f9 DIRECTOR: Do not crash on movies without score


Commit: 2928ac65f9b775be313cd1b896abdec9dbb41175
    https://github.com/scummvm/scummvm/commit/2928ac65f9b775be313cd1b896abdec9dbb41175
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-05-21T23:50:26+02:00

Commit Message:
DIRECTOR: Do not crash on movies without score

Changed paths:
    engines/director/director.cpp
    engines/director/score.cpp
    engines/director/score.h


diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index f22098d52f..d47246bad2 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -231,7 +231,7 @@ Common::Error DirectorEngine::run() {
 			debug(0, "@@@@   Score name '%s' in '%s'", _currentScore->getMacName().c_str(), _currentPath.c_str());
 			debug(0, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
 
-			_currentScore->loadArchive();
+			bool goodMovie = _currentScore->loadArchive();
 
 			// If we came in a loop, then skip as requested
 			if (!_nextMovie.frameS.empty()) {
@@ -244,7 +244,7 @@ Common::Error DirectorEngine::run() {
 				_nextMovie.frameI = -1;
 			}
 
-			if (!debugChannelSet(-1, kDebugLingoCompileOnly)) {
+			if (!debugChannelSet(-1, kDebugLingoCompileOnly) && goodMovie) {
 				debugC(1, kDebugEvents, "Starting playback of score '%s'", _currentScore->getMacName().c_str());
 
 				_currentScore->startLoop();
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 358c9822b7..95ab7c2059 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -133,7 +133,7 @@ void Score::setArchive(Archive *archive) {
 	}
 }
 
-void Score::loadArchive() {
+bool Score::loadArchive() {
 	Common::Array<uint16> clutList = _movieArchive->getResourceIDList(MKTAG('C', 'L', 'U', 'T'));
 	Common::SeekableSubReadStreamEndian *r = nullptr;
 
@@ -160,7 +160,7 @@ void Score::loadArchive() {
 	// Score
 	if (!_movieArchive->hasResource(MKTAG('V', 'W', 'S', 'C'), -1)) {
 		warning("Score::loadArchive(): Wrong movie format. VWSC resource missing");
-		return;
+		return false;
 	}
 	loadFrames(*(r = _movieArchive->getFirstResource(MKTAG('V', 'W', 'S', 'C'))));
 	delete r;
@@ -305,6 +305,8 @@ void Score::loadArchive() {
 
 	}
 	copyCastStxts();
+
+	return true;
 }
 
 void Score::copyCastStxts() {
diff --git a/engines/director/score.h b/engines/director/score.h
index 66c4cb5ba6..3ccd459158 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -70,7 +70,7 @@ public:
 
 	static Common::Rect readRect(Common::ReadStreamEndian &stream);
 	static int compareLabels(const void *a, const void *b);
-	void loadArchive();
+	bool loadArchive();
 	void setStartToLabel(Common::String label);
 	void gotoLoop();
 	void gotoNext();




More information about the Scummvm-git-logs mailing list