[Scummvm-git-logs] scummvm master -> 382913b51d2b355ac98158c6978f14715b634e18

sev- noreply at scummvm.org
Sun Dec 11 20:32:40 UTC 2022


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

Summary:
39d4e1e030 BASE: Switch --md5mac to openFileOrDataFork
437aca9e50 ADVANCED DETECTOR: Switch to openFileOrDataFork
4b7baa4159 COMMON: Switch quicktime to openFileOrDataFork
aaced28b98 GUI: Switch debugger to openFileOrDataFork
ae9de1acbc STARTREK: Switch from getDataFork to openFileOrDataFork
382913b51d COMMON: Remove hasDataFork and getDataFork


Commit: 39d4e1e0303e48c2f728f93ca9131ffaf19ba965
    https://github.com/scummvm/scummvm/commit/39d4e1e0303e48c2f728f93ca9131ffaf19ba965
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2022-12-11T21:32:30+01:00

Commit Message:
BASE: Switch --md5mac to openFileOrDataFork

Changed paths:
    base/commandLine.cpp


diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 76d8985f91d..7cf968d245d 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1444,7 +1444,8 @@ static void calcMD5Mac(Common::Path &filePath, int32 length) {
 	if (!macResMan.open(fileName, dir)) {
 		printf("Mac resource file '%s' not found or could not be open\n", filePath.toString(nativeSeparator).c_str());
 	} else {
-		if (!macResMan.hasResFork() && !macResMan.hasDataFork()) {
+		Common::ScopedPtr<Common::SeekableReadStream> dataFork(Common::MacResManager::openFileOrDataFork(fileName, dir));
+		if (!macResMan.hasResFork() && !dataFork) {
 			printf("'%s' has neither data not resource fork\n", macResMan.getBaseFileName().toString().c_str());
 		} else {
 			bool tail = false;
@@ -1460,14 +1461,13 @@ static void calcMD5Mac(Common::Path &filePath, int32 length) {
 					md5 += Common::String::format(" (%s %d bytes)", tail ? "last" : "first", length);
 				printf("%s (resource): %s, %llu bytes\n", macResMan.getBaseFileName().toString().c_str(), md5.c_str(), (unsigned long long)macResMan.getResForkDataSize());
 			}
-			if (macResMan.hasDataFork()) {
-				Common::SeekableReadStream *stream = macResMan.getDataFork();
-				if (tail && stream->size() > length)
-					stream->seek(-length, SEEK_END);
-				Common::String md5 = Common::computeStreamMD5AsString(*stream, length);
-				if (length != 0 && length < stream->size())
+			if (dataFork) {
+				if (tail && dataFork->size() > length)
+					dataFork->seek(-length, SEEK_END);
+				Common::String md5 = Common::computeStreamMD5AsString(*dataFork, length);
+				if (length != 0 && length < dataFork->size())
 					md5 += Common::String::format(" (%s %d bytes)", tail ? "last" : "first", length);
-				printf("%s (data): %s, %llu bytes\n", macResMan.getBaseFileName().toString().c_str(), md5.c_str(), (unsigned long long)stream->size());
+				printf("%s (data): %s, %llu bytes\n", macResMan.getBaseFileName().toString().c_str(), md5.c_str(), (unsigned long long)dataFork->size());
 			}
 		}
 		macResMan.close();


Commit: 437aca9e50bd67e47147c4742fc3c3d195708411
    https://github.com/scummvm/scummvm/commit/437aca9e50bd67e47147c4742fc3c3d195708411
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2022-12-11T21:32:30+01:00

Commit Message:
ADVANCED DETECTOR: Switch to openFileOrDataFork

Changed paths:
    engines/advancedDetector.cpp


diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index b5963597fe7..696f3cba31b 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -566,7 +566,7 @@ static bool getFilePropertiesIntern(uint md5Bytes, const AdvancedMetaEngine::Fil
 		if (fileProps.size != 0)
 			return true;
 
-		Common::SeekableReadStream *dataFork = macResMan.getDataFork();
+		Common::SeekableReadStream *dataFork = Common::MacResManager::openFileOrDataFork(fname, fileMapArchive);
 		if (dataFork && dataFork->size()) {
 			fileProps.size = dataFork->size();
 			fileProps.md5 = Common::computeStreamMD5AsString(*dataFork, md5Bytes);


Commit: 4b7baa415992608195743fca8b39a458ad63afdd
    https://github.com/scummvm/scummvm/commit/4b7baa415992608195743fca8b39a458ad63afdd
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2022-12-11T21:32:30+01:00

Commit Message:
COMMON: Switch quicktime to openFileOrDataFork

Changed paths:
    common/quicktime.cpp


diff --git a/common/quicktime.cpp b/common/quicktime.cpp
index 0fc713d331e..87b5ec95e18 100644
--- a/common/quicktime.cpp
+++ b/common/quicktime.cpp
@@ -60,7 +60,7 @@ QuickTimeParser::~QuickTimeParser() {
 }
 
 bool QuickTimeParser::parseFile(const Path &filename) {
-	if (!_resFork->open(filename) || !_resFork->hasDataFork())
+	if (!_resFork->open(filename))
 		return false;
 
 	_foundMOOV = false;
@@ -84,7 +84,9 @@ bool QuickTimeParser::parseFile(const Path &filename) {
 		delete _fd;
 	}
 
-	_fd = _resFork->getDataFork();
+	_fd = Common::MacResManager::openFileOrDataFork(filename);
+	if (!_fd)
+		return false;
 	atom.size = _fd->size();
 
 	if (readDefault(atom) < 0 || !_foundMOOV)


Commit: aaced28b98cb8f495e03093a3a0f8fa13501f87c
    https://github.com/scummvm/scummvm/commit/aaced28b98cb8f495e03093a3a0f8fa13501f87c
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2022-12-11T21:32:30+01:00

Commit Message:
GUI: Switch debugger to openFileOrDataFork

Changed paths:
    gui/debugger.cpp


diff --git a/gui/debugger.cpp b/gui/debugger.cpp
index 332c9c1708d..24d1176e84a 100644
--- a/gui/debugger.cpp
+++ b/gui/debugger.cpp
@@ -716,7 +716,8 @@ bool Debugger::cmdMd5Mac(int argc, const char **argv) {
 		if (!macResMan.open(filename)) {
 			debugPrintf("Resource file '%s' not found\n", filename.c_str());
 		} else {
-			if (!macResMan.hasResFork() && !macResMan.hasDataFork()) {
+			Common::ScopedPtr<Common::SeekableReadStream> dataFork(Common::MacResManager::openFileOrDataFork(filename));
+			if (!macResMan.hasResFork() && !dataFork) {
 				debugPrintf("'%s' has neither data not resource fork\n", macResMan.getBaseFileName().toString().c_str());
 			} else {
 				// The resource fork is probably the most relevant one.
@@ -726,14 +727,13 @@ bool Debugger::cmdMd5Mac(int argc, const char **argv) {
 						md5 += Common::String::format(" (%s %d bytes)", tail ? "last" : "first", length);
 					debugPrintf("%s (resource): %s, %llu bytes\n", macResMan.getBaseFileName().toString().c_str(), md5.c_str(), (unsigned long long)macResMan.getResForkDataSize());
 				}
-				if (macResMan.hasDataFork()) {
-					Common::SeekableReadStream *stream = macResMan.getDataFork();
-					if (tail && stream->size() > length)
-						stream->seek(-length, SEEK_END);
-					Common::String md5 = Common::computeStreamMD5AsString(*stream, length);
-					if (length != 0 && length < stream->size())
+				if (dataFork) {
+					if (tail && dataFork->size() > length)
+						dataFork->seek(-length, SEEK_END);
+					Common::String md5 = Common::computeStreamMD5AsString(*dataFork, length);
+					if (length != 0 && length < dataFork->size())
 						md5 += Common::String::format(" (%s %d bytes)", tail ? "last" : "first", length);
-					debugPrintf("%s (data): %s, %llu bytes\n", macResMan.getBaseFileName().toString().c_str(), md5.c_str(), (unsigned long long)stream->size());
+					debugPrintf("%s (data): %s, %llu bytes\n", macResMan.getBaseFileName().toString().c_str(), md5.c_str(), (unsigned long long)dataFork->size());
 				}
 			}
 			macResMan.close();


Commit: ae9de1acbc7b87532ade542eab549b64b7ddec67
    https://github.com/scummvm/scummvm/commit/ae9de1acbc7b87532ade542eab549b64b7ddec67
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2022-12-11T21:32:30+01:00

Commit Message:
STARTREK: Switch from getDataFork to openFileOrDataFork

Changed paths:
    engines/startrek/resource.cpp


diff --git a/engines/startrek/resource.cpp b/engines/startrek/resource.cpp
index da91b353434..47e7b464385 100644
--- a/engines/startrek/resource.cpp
+++ b/engines/startrek/resource.cpp
@@ -37,7 +37,7 @@ Resource::Resource(Common::Platform platform, bool isDemo) : _platform(platform)
 		_macResFork = new Common::MacResManager();
 		if (!_macResFork->open("Star Trek Data"))
 			error("Could not load Star Trek Data");
-		assert(_macResFork->hasDataFork() && _macResFork->hasResFork());
+		assert(_macResFork->hasResFork());
 	}
 
 	readIndexFile();
@@ -233,7 +233,7 @@ Common::MemoryReadStreamEndian *Resource::loadFile(Common::String filename, int
 	if (_platform == Common::kPlatformAmiga) {
 		dataFile = SearchMan.createReadStreamForMember("data.000");
 	} else if (_platform == Common::kPlatformMacintosh) {
-		dataFile = _macResFork->getDataFork();
+		dataFile = Common::MacResManager::openFileOrDataFork("Star Trek Data");
 	} else {
 		dataFile = SearchMan.createReadStreamForMember("data.001");
 	}


Commit: 382913b51d2b355ac98158c6978f14715b634e18
    https://github.com/scummvm/scummvm/commit/382913b51d2b355ac98158c6978f14715b634e18
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2022-12-11T21:32:30+01:00

Commit Message:
COMMON: Remove hasDataFork and getDataFork

Changed paths:
    common/macresman.cpp
    common/macresman.h


diff --git a/common/macresman.cpp b/common/macresman.cpp
index 59975f379b2..b4556dd02f3 100644
--- a/common/macresman.cpp
+++ b/common/macresman.cpp
@@ -135,10 +135,6 @@ void MacResManager::close() {
 	_resMap.numTypes = 0;
 }
 
-bool MacResManager::hasDataFork() const {
-	return !_baseFileName.empty();
-}
-
 bool MacResManager::hasResFork() const {
 	return !_baseFileName.empty() && _mode != kResForkNone && _resForkSize != 0;
 }
@@ -685,24 +681,6 @@ bool MacResManager::load(SeekableReadStream *stream) {
 	return true;
 }
 
-SeekableReadStream *MacResManager::getDataFork() {
-	if (!_stream)
-		return nullptr;
-
-	if (_mode == kResForkMacBinary) {
-		_stream->seek(MBI_DFLEN);
-		uint32 dataSize = _stream->readUint32BE();
-		return new SafeSeekableSubReadStream(_stream, MBI_INFOHDR, MBI_INFOHDR + dataSize);
-	}
-
-	File *file = new File();
-	if (file->open(_baseFileName))
-		return file;
-	delete file;
-
-	return nullptr;
-}
-
 MacResIDArray MacResManager::getResIDArray(uint32 typeID) {
 	int typeNum = -1;
 	MacResIDArray res;
diff --git a/common/macresman.h b/common/macresman.h
index 58aa93b3cc1..d66bbed948a 100644
--- a/common/macresman.h
+++ b/common/macresman.h
@@ -194,12 +194,6 @@ public:
 	 */
 	void close();
 
-	/**
-	 * Query whether or not we have a data fork present.
-	 * @return True if the data fork is present
-	 */
-	bool hasDataFork() const;
-
 	/**
 	 * Query whether or not we have a data fork present.
 	 * @return True if the resource fork is present
@@ -230,12 +224,6 @@ public:
 	 */
 	SeekableReadStream *getResource(uint32 typeID, const String &filename);
 
-	/**
-	 * Retrieve the data fork
-	 * @return The stream if present, 0 otherwise
-	 */
-	SeekableReadStream *getDataFork();
-
 	static int getDataForkOffset() { return MBI_INFOHDR; }
 
 	/**




More information about the Scummvm-git-logs mailing list