[Scummvm-git-logs] scummvm master -> 7a58db8b92d58d81a3752140c7983de7595db13d

wjp wjp at usecode.org
Wed Sep 20 20:55:46 CEST 2017


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

Summary:
6a7d43288f DIRECTOR: Skip SearchMan detour in fallback detection
6bea267385 SLUDGE: Skip SearchMan detour in fallback detection
ca82bf61e3 CGE: Clean up SearchMan after fallbackDetect
3108957812 CGE2: Clean up SearchMan after fallbackDetect
7a58db8b92 Merge pull request #1024 from wjp/detection_searchman


Commit: 6a7d43288fb6d7e0e037ba837ae51738b230f938
    https://github.com/scummvm/scummvm/commit/6a7d43288fb6d7e0e037ba837ae51738b230f938
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2017-09-20T20:53:14+02:00

Commit Message:
DIRECTOR: Skip SearchMan detour in fallback detection

Changed paths:
    engines/director/detection.cpp


diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index dd10b6c..a3f9b7c 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -165,26 +165,20 @@ const ADGameDescription *DirectorMetaEngine::fallbackDetect(const FileMap &allFi
 		if (!fileName.hasSuffix(".exe"))
 			continue;
 
-		SearchMan.clear();
-		SearchMan.addDirectory(file->getParent().getName(), file->getParent());
-
-		Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(file->getName());
-
-		if (!stream)
+		Common::File f;
+		if (!f.open(*file))
 			continue;
 
-		stream->seek(-4, SEEK_END);
+		f.seek(-4, SEEK_END);
 
-		uint32 offset = stream->readUint32LE();
+		uint32 offset = f.readUint32LE();
 
-		if (stream->eos() || offset == 0 || offset >= (uint32)(stream->size() - 4)) {
-			delete stream;
+		if (f.eos() || offset == 0 || offset >= (uint32)(f.size() - 4))
 			continue;
-		}
 
-		stream->seek(offset);
+		f.seek(offset);
 
-		uint32 tag = stream->readUint32LE();
+		uint32 tag = f.readUint32LE();
 
 		switch (tag) {
 		case MKTAG('3', '9', 'J', 'P'):
@@ -200,41 +194,31 @@ const ADGameDescription *DirectorMetaEngine::fallbackDetect(const FileMap &allFi
 			// Prior to version 4, there was no tag here. So we'll use a bit of a
 			// heuristic to detect. The first field is the entry count, of which
 			// there should only be one.
-			if ((tag & 0xFFFF) != 1) {
-				delete stream;
+			if ((tag & 0xFFFF) != 1)
 				continue;
-			}
 
-			stream->skip(3);
+			f.skip(3);
 
-			uint32 mmmSize = stream->readUint32LE();
+			uint32 mmmSize = f.readUint32LE();
 
-			if (stream->eos() || mmmSize == 0) {
-				delete stream;
+			if (f.eos() || mmmSize == 0)
 				continue;
-			}
 
-			byte fileNameSize = stream->readByte();
+			byte fileNameSize = f.readByte();
 
-			if (stream->eos()) {
-				delete stream;
+			if (f.eos())
 				continue;
-			}
 
-			stream->skip(fileNameSize);
-			byte directoryNameSize = stream->readByte();
+			f.skip(fileNameSize);
+			byte directoryNameSize = f.readByte();
 
-			if (stream->eos()) {
-				delete stream;
+			if (f.eos())
 				continue;
-			}
 
-			stream->skip(directoryNameSize);
+			f.skip(directoryNameSize);
 
-			if (stream->pos() != stream->size() - 4) {
-				delete stream;
+			if (f.pos() != f.size() - 4)
 				continue;
-			}
 
 			// Assume v3 at this point (for now at least)
 			desc->version = 3;


Commit: 6bea267385d130e1957f67f28f14225301d15eba
    https://github.com/scummvm/scummvm/commit/6bea267385d130e1957f67f28f14225301d15eba
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2017-09-20T20:53:14+02:00

Commit Message:
SLUDGE: Skip SearchMan detour in fallback detection

Changed paths:
    engines/sludge/detection.cpp


diff --git a/engines/sludge/detection.cpp b/engines/sludge/detection.cpp
index de5897b..cdb67fa 100644
--- a/engines/sludge/detection.cpp
+++ b/engines/sludge/detection.cpp
@@ -122,26 +122,22 @@ const ADGameDescription *SludgeMetaEngine::fallbackDetect(const FileMap &allFile
 		if (!(fileName.hasSuffix(".slg") || fileName == "gamedata"))
 			continue;
 
-		SearchMan.clear();
-		SearchMan.addDirectory(file->getParent().getName(), file->getParent());
-
-		Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(file->getName());
-
-		if (!stream)
+		Common::File f;
+		if (!f.open(*file))
 			continue;
 
 		bool headerBad = false;
-		if (stream->readByte() != 'S')
+		if (f.readByte() != 'S')
 			headerBad = true;
-		if (stream->readByte() != 'L')
+		if (f.readByte() != 'L')
 			headerBad = true;
-		if (stream->readByte() != 'U')
+		if (f.readByte() != 'U')
 			headerBad = true;
-		if (stream->readByte() != 'D')
+		if (f.readByte() != 'D')
 			headerBad = true;
-		if (stream->readByte() != 'G')
+		if (f.readByte() != 'G')
 			headerBad = true;
-		if (stream->readByte() != 'E')
+		if (f.readByte() != 'E')
 			headerBad = true;
 		if (headerBad) {
 			continue;


Commit: ca82bf61e3d6d48ff037d151e9a7c245fd783e79
    https://github.com/scummvm/scummvm/commit/ca82bf61e3d6d48ff037d151e9a7c245fd783e79
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2017-09-20T20:53:14+02:00

Commit Message:
CGE: Clean up SearchMan after fallbackDetect

Changed paths:
    engines/cge/detection.cpp


diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp
index 0df1e87..482591b 100644
--- a/engines/cge/detection.cpp
+++ b/engines/cge/detection.cpp
@@ -159,13 +159,14 @@ const ADGameDescription *CGEMetaEngine::fallbackDetect(const FileMap &allFiles,
 	if (!game)
 		return nullptr;
 
-	SearchMan.clear();
-	SearchMan.addDirectory(fslist.begin()->getParent().getPath(), fslist.begin()->getParent());
+	SearchMan.addDirectory("CGEMetaEngine::fallbackDetect", fslist.begin()->getParent());
 	ResourceManager *resman;
 	resman = new ResourceManager();
 	bool result = resman->exist("CGE.SAY");
 	delete resman;
 
+	SearchMan.remove("CGEMetaEngine::fallbackDetect");
+
 	if (!result)
 		return nullptr;
 


Commit: 31089578129fc810188277eb546715e5409fb124
    https://github.com/scummvm/scummvm/commit/31089578129fc810188277eb546715e5409fb124
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2017-09-20T20:53:14+02:00

Commit Message:
CGE2: Clean up SearchMan after fallbackDetect

Changed paths:
    engines/cge2/detection.cpp


diff --git a/engines/cge2/detection.cpp b/engines/cge2/detection.cpp
index 5a4f286..d05dfff 100644
--- a/engines/cge2/detection.cpp
+++ b/engines/cge2/detection.cpp
@@ -157,13 +157,14 @@ const ADGameDescription *CGE2MetaEngine::fallbackDetect(const FileMap &allFiles,
 	if (!game)
 		return 0;
 
-	SearchMan.clear();
-	SearchMan.addDirectory(fslist.begin()->getParent().getPath(), fslist.begin()->getParent());
+	SearchMan.addDirectory("CGE2MetaEngine::fallbackDetect", fslist.begin()->getParent());
 	ResourceManager *resman;
 	resman = new ResourceManager();
 	bool result = resman->exist("CGE.SAY");
 	delete resman;
 
+	SearchMan.remove("CGE2MetaEngine::fallbackDetect");
+
 	if (!result)
 		return 0;
 


Commit: 7a58db8b92d58d81a3752140c7983de7595db13d
    https://github.com/scummvm/scummvm/commit/7a58db8b92d58d81a3752140c7983de7595db13d
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2017-09-20T20:55:40+02:00

Commit Message:
Merge pull request #1024 from wjp/detection_searchman

Clean up use of SearchMan in fallback detection

Changed paths:
    engines/cge/detection.cpp
    engines/cge2/detection.cpp
    engines/director/detection.cpp
    engines/sludge/detection.cpp







More information about the Scummvm-git-logs mailing list