[Scummvm-git-logs] scummvm master -> f7a848e65de384b02057b9f4b849b041667ce30d

sev- sev at scummvm.org
Fri Jan 10 16:07:24 UTC 2020


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

Summary:
be69970112 DIRECTOR: Fix crashes on ungraceful exit
26812078b5 DIRECTOR: Properly iterate over all movies when test-all is requested
f7a848e65d DIRECTOR: Better track of loaded movies


Commit: be69970112a045da9eefa035e2d3f38b6996685c
    https://github.com/scummvm/scummvm/commit/be69970112a045da9eefa035e2d3f38b6996685c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-01-10T16:52:40+01:00

Commit Message:
DIRECTOR: Fix crashes on ungraceful exit

Changed paths:
    engines/director/director.cpp
    engines/director/frame.cpp
    engines/director/resource.cpp
    engines/director/score.cpp


diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index cc63e51..13b86ad 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -221,6 +221,7 @@ Common::Error DirectorEngine::run() {
 			_lingo->restartLingo();
 
 			delete _currentScore;
+			_currentScore = nullptr;
 
 			_currentPath = getPath(_nextMovie.movie, _currentPath);
 
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index ad12406..28be1c5 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -610,7 +610,7 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
 				}
 			} else {
 				if (!_vm->getCurrentScore()->_loadedCast->contains(_sprites[i]->_castId)) {
-					if (!_vm->getSharedScore()->_loadedCast->contains(_sprites[i]->_castId)) {
+					if (!_vm->getSharedScore() || !_vm->getSharedScore()->_loadedCast->contains(_sprites[i]->_castId)) {
 						debugC(1, kDebugImages, "Frame::renderSprites(): Cast id %d not found", _sprites[i]->_castId);
 						continue;
 					} else {
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 1123d92..bd8000d 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -64,6 +64,9 @@ Archive *DirectorEngine::openMainArchive(const Common::String movie) {
 	_mainArchive = createArchive();
 
 	if (!_mainArchive->openFile(movie)) {
+		delete _mainArchive;
+		_mainArchive = nullptr;
+
 		warning("openMainArchive(): Could not open '%s'", movie.c_str());
 		return nullptr;
 	}
@@ -295,8 +298,6 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) {
 
 		delete shardcst;
 
-		_sharedScore = new Score(this);
-
 		return;
 	}
 
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index ead9342..9cdc069 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -67,9 +67,9 @@ const char *scriptType2str(ScriptType scr) {
 
 Score::Score(DirectorEngine *vm) {
 	_vm = vm;
-	_surface = new Graphics::ManagedSurface;
-	_trailSurface = new Graphics::ManagedSurface;
-	_backSurface = new Graphics::ManagedSurface;
+	_surface = nullptr;
+	_trailSurface = nullptr;
+	_backSurface = nullptr;
 	_lingo = _vm->getLingo();
 	_soundManager = _vm->getSoundManager();
 	_currentMouseDownSpriteId = 0;
@@ -98,8 +98,8 @@ Score::Score(DirectorEngine *vm) {
 
 	_movieArchive = nullptr;
 
-	_loadedStxts = new Common::HashMap<int, const Stxt *>();
-	_loadedCast = new Common::HashMap<int, Cast *>();
+	_loadedStxts = nullptr;
+	_loadedCast = nullptr;
 }
 
 void Score::setArchive(Archive *archive) {
@@ -223,6 +223,8 @@ void Score::loadArchive() {
 	}
 
 	Common::Array<uint16> cast = _movieArchive->getResourceIDList(MKTAG('C', 'A', 'S', 't'));
+	_loadedCast = new Common::HashMap<int, Cast *>();
+
 	if (cast.size() > 0) {
 		debugC(2, kDebugLoading, "****** Loading %d CASt resources", cast.size());
 
@@ -255,6 +257,9 @@ void Score::loadArchive() {
 	// Now process STXTs
 	Common::Array<uint16> stxt = _movieArchive->getResourceIDList(MKTAG('S','T','X','T'));
 	debugC(2, kDebugLoading, "****** Loading %d STXT resources", stxt.size());
+
+	_loadedStxts = new Common::HashMap<int, const Stxt *>();
+
 	for (Common::Array<uint16>::iterator iterator = stxt.begin(); iterator != stxt.end(); ++iterator) {
 		_loadedStxts->setVal(*iterator,
 				 new Stxt(*_movieArchive->getResource(MKTAG('S','T','X','T'), *iterator)));
@@ -554,6 +559,8 @@ void Score::readVersion(uint32 rid) {
 void Score::loadCastDataVWCR(Common::SeekableSubReadStreamEndian &stream) {
 	debugC(1, kDebugLoading, "****** Loading Cast rects VWCR. start: %d, end: %d", _castArrayStart, _castArrayEnd);
 
+	_loadedCast = new Common::HashMap<int, Cast *>();
+
 	for (uint16 id = _castArrayStart; id <= _castArrayEnd; id++) {
 		byte size = stream.readByte();
 		if (size == 0)
@@ -599,7 +606,7 @@ void Score::setSpriteCasts() {
 			if (castId == 0)
 				continue;
 
-			if (_vm->getSharedScore() != nullptr && _vm->getSharedScore()->_loadedCast->contains(castId)) {
+			if (_vm->getSharedScore() && _vm->getSharedScore()->_loadedCast && _vm->getSharedScore()->_loadedCast->contains(castId)) {
 				_frames[i]->_sprites[j]->_cast = _vm->getSharedScore()->_loadedCast->getVal(castId);
 			} else if (_loadedCast->contains(castId)) {
 				_frames[i]->_sprites[j]->_cast = _loadedCast->getVal(castId);
@@ -1314,6 +1321,10 @@ void Score::startLoop() {
 
 	initGraphics(_movieRect.width(), _movieRect.height());
 
+	_surface = new Graphics::ManagedSurface;
+	_trailSurface = new Graphics::ManagedSurface;
+	_backSurface = new Graphics::ManagedSurface;
+
 	_surface->create(_movieRect.width(), _movieRect.height());
 	_trailSurface->create(_movieRect.width(), _movieRect.height());
 	_backSurface->create(_movieRect.width(), _movieRect.height());


Commit: 26812078b5bd3d1ef272f4f830990e3ddefa77de
    https://github.com/scummvm/scummvm/commit/26812078b5bd3d1ef272f4f830990e3ddefa77de
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-01-10T16:58:34+01:00

Commit Message:
DIRECTOR: Properly iterate over all movies when test-all is requested

Changed paths:
    engines/director/director.cpp


diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 13b86ad..cc48b04 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -191,7 +191,8 @@ Common::Error DirectorEngine::run() {
 	while (loop) {
 		loop = false;
 
-		_currentScore->loadArchive();
+		if (_currentScore)
+			_currentScore->loadArchive();
 
 		// If we came in a loop, then skip as requested
 		if (!_nextMovie.frameS.empty()) {
@@ -232,6 +233,11 @@ Common::Error DirectorEngine::run() {
 			if (!mov) {
 				warning("nextMovie: No score is loaded");
 
+				if (getGameID() == GID_TESTALL) {
+					loop = true;
+					continue;
+				}
+
 				return Common::kNoError;
 			}
 


Commit: f7a848e65de384b02057b9f4b849b041667ce30d
    https://github.com/scummvm/scummvm/commit/f7a848e65de384b02057b9f4b849b041667ce30d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-01-10T17:06:50+01:00

Commit Message:
DIRECTOR: Better track of loaded movies

Changed paths:
    engines/director/director.cpp


diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index cc48b04..3695615 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -182,17 +182,19 @@ Common::Error DirectorEngine::run() {
 	}
 
 	_currentScore->setArchive(_mainArchive);
-	debug(0, "\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
-	debug(0, "@@@@   Score name '%s'", _currentScore->getMacName().c_str());
-	debug(0, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
 
 	bool loop = true;
 
 	while (loop) {
 		loop = false;
 
-		if (_currentScore)
+		if (_currentScore) {
+			debug(0, "\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
+			debug(0, "@@@@   Score name '%s'", _currentScore->getMacName().c_str());
+			debug(0, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
+
 			_currentScore->loadArchive();
+		}
 
 		// If we came in a loop, then skip as requested
 		if (!_nextMovie.frameS.empty()) {




More information about the Scummvm-git-logs mailing list