[Scummvm-git-logs] scummvm master -> 40a900c3c7b340daf2fbccbe6ceba83be5d29dde

sev- sev at scummvm.org
Sun Jan 15 21:16:27 CET 2017


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:
7b666dc1ca DIRECTOR: Cleanup main movie loading
40a900c3c7 DIRECTOR: Lingo: Fixed 'go to movie' procedure.


Commit: 7b666dc1ca368f6323807be5efae31b689b6ca93
    https://github.com/scummvm/scummvm/commit/7b666dc1ca368f6323807be5efae31b689b6ca93
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-15T21:15:45+01:00

Commit Message:
DIRECTOR: Cleanup main movie loading

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


diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 5e523de..83708e0 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -134,7 +134,7 @@ Common::Error DirectorEngine::run() {
 
 	loadSharedCastsFrom(_sharedCastFile);
 
-	loadMainArchive();
+	loadInitialMovie(getEXEName());
 
 	_currentScore = new Score(this, _mainArchive);
 	debug(0, "Score name %s", _currentScore->getMacName().c_str());
diff --git a/engines/director/director.h b/engines/director/director.h
index f80329e..a2cc1fa 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -86,7 +86,8 @@ public:
 	void loadPatterns();
 	Graphics::MacPatterns &getPatterns();
 
-	void loadMainArchive();
+	void loadInitialMovie(const Common::String movie);
+	Archive *openMainArchive(const Common::String movie);
 	Archive *createArchive();
 	void cleanupMainArchive();
 
@@ -114,13 +115,13 @@ private:
 	const DirectorGameDescription *_gameDescription;
 
 	Common::HashMap<Common::String, Score *> *scanMovies(const Common::String &folder);
-	void loadEXE();
+	void loadEXE(const Common::String movie);
 	void loadEXEv3(Common::SeekableReadStream *stream);
 	void loadEXEv4(Common::SeekableReadStream *stream);
 	void loadEXEv5(Common::SeekableReadStream *stream);
 	void loadEXEv7(Common::SeekableReadStream *stream);
 	void loadEXERIFX(Common::SeekableReadStream *stream, uint32 offset);
-	void loadMac();
+	void loadMac(const Common::String movie);
 
 	Common::HashMap<int, Cast *> *_sharedCasts;
 	Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *_sharedDIB;
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index f43118d..ae2eae8 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -39,11 +39,22 @@ Archive *DirectorEngine::createArchive() {
 	}
 }
 
-void DirectorEngine::loadMainArchive() {
+void DirectorEngine::loadInitialMovie(const Common::String movie) {
 	if (getPlatform() == Common::kPlatformWindows)
-		loadEXE();
+		loadEXE(movie);
 	else
-		loadMac();
+		loadMac(movie);
+}
+
+Archive *DirectorEngine::openMainArchive(const Common::String movie) {
+	delete _mainArchive;
+
+	_mainArchive = createArchive();
+
+	if (!_mainArchive->openFile(movie))
+		error("Could not open '%s'", movie.c_str());
+
+	return _mainArchive;
 }
 
 void DirectorEngine::cleanupMainArchive() {
@@ -51,8 +62,8 @@ void DirectorEngine::cleanupMainArchive() {
 	delete _macBinary;
 }
 
-void DirectorEngine::loadEXE() {
-	Common::SeekableReadStream *exeStream = SearchMan.createReadStreamForMember(getEXEName());
+void DirectorEngine::loadEXE(const Common::String movie) {
+	Common::SeekableReadStream *exeStream = SearchMan.createReadStreamForMember(movie);
 	if (!exeStream)
 		error("Failed to open EXE '%s'", getEXEName().c_str());
 
@@ -93,10 +104,7 @@ void DirectorEngine::loadEXEv3(Common::SeekableReadStream *stream) {
 	debugC(1, kDebugLoading, "Main MMM: '%s'", mmmFileName.c_str());
 	debugC(1, kDebugLoading, "Directory Name: '%s'", directoryName.c_str());
 
-	_mainArchive = new RIFFArchive();
-
-	if (!_mainArchive->openFile(mmmFileName))
-		error("Could not open '%s'", mmmFileName.c_str());
+	openMainArchive(mmmFileName);
 
 	delete stream;
 }
@@ -154,19 +162,16 @@ void DirectorEngine::loadEXERIFX(Common::SeekableReadStream *stream, uint32 offs
 		error("Failed to load RIFX from EXE");
 }
 
-void DirectorEngine::loadMac() {
+void DirectorEngine::loadMac(const Common::String movie) {
 	if (getVersion() < 4) {
 		// The data is part of the resource fork of the executable
-		_mainArchive = new MacArchive();
-
-		if (!_mainArchive->openFile(getEXEName()))
-			error("Failed to open Mac binary '%s'", getEXEName().c_str());
+		openMainArchive(movie);
 	} else {
 		// The RIFX is located in the data fork of the executable
 		_macBinary = new Common::MacResManager();
 
-		if (!_macBinary->open(getEXEName()) || !_macBinary->hasDataFork())
-			error("Failed to open Mac binary '%s'", getEXEName().c_str());
+		if (!_macBinary->open(movie) || !_macBinary->hasDataFork())
+			error("Failed to open Mac binary '%s'", movie.c_str());
 
 		Common::SeekableReadStream *dataFork = _macBinary->getDataFork();
 		_mainArchive = new RIFXArchive();


Commit: 40a900c3c7b340daf2fbccbe6ceba83be5d29dde
    https://github.com/scummvm/scummvm/commit/40a900c3c7b340daf2fbccbe6ceba83be5d29dde
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-15T21:15:45+01:00

Commit Message:
DIRECTOR: Lingo: Fixed 'go to movie' procedure.

Now it loads the needed movie but crashes because there was no context
of script reloading

Changed paths:
    engines/director/lingo/lingo-funcs.cpp


diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 0deab07..a71eb3d 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -172,12 +172,19 @@ void Lingo::func_goto(Datum &frame, Datum &movie) {
 	if (movie.type != VOID) {
 		movie.toString();
 
-		if (!_vm->_movies || !_vm->_movies->contains(*movie.u.s)) {
+		Common::File file;
+
+		if (!file.open(*movie.u.s)) {
 			warning("Movie %s does not exist", movie.u.s->c_str());
 			return;
 		}
 
-		_vm->_currentScore = _vm->_movies->getVal(*movie.u.s);
+		delete _vm->_currentScore;
+
+		Archive *mov = _vm->openMainArchive(*movie.u.s);
+
+		_vm->_currentScore = new Score(_vm, mov);
+		debug(0, "Score name %s", _vm->_currentScore->getMacName().c_str());
 		_vm->_currentScore->loadArchive();
 	}
 





More information about the Scummvm-git-logs mailing list