[Scummvm-git-logs] scummvm master -> 5a19105bd6fc1b1535514ce224e8af95561c0950

sev- sev at scummvm.org
Thu Feb 6 23:35:18 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:
5a19105bd6 DIRECTOR: Implement dumping raw movie chunks


Commit: 5a19105bd6fc1b1535514ce224e8af95561c0950
    https://github.com/scummvm/scummvm/commit/5a19105bd6fc1b1535514ce224e8af95561c0950
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-02-07T00:24:18+01:00

Commit Message:
DIRECTOR: Implement dumping raw movie chunks

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


diff --git a/engines/director/archive.cpp b/engines/director/archive.cpp
index 361dd4c..9b15c62 100644
--- a/engines/director/archive.cpp
+++ b/engines/director/archive.cpp
@@ -49,13 +49,13 @@ bool Archive::openFile(const Common::String &fileName) {
 		return false;
 	}
 
+	_fileName = fileName;
+
 	if (!openStream(file)) {
 		close();
 		return false;
 	}
 
-	_fileName = fileName;
-
 	return true;
 }
 
@@ -461,6 +461,41 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
 			_types[tag][i] = res;
 	}
 
+	if (ConfMan.getBool("dump_scripts")) {
+		debug("Dumping %d resources", resources.size());
+
+		byte *data = nullptr;
+		int dataSize = 0;
+		Common::DumpFile out;
+
+		for (uint i = 0; i < resources.size(); i++) {
+			stream->seek(resources[i].offset);
+
+			uint32 len = resources[i].size;
+
+			if (dataSize < resources[i].size) {
+				free(data);
+				data = (byte *)malloc(resources[i].size);
+				dataSize = resources[i].size;
+			}
+
+			Common::String filename = Common::String::format("./dumps/%s-%s-%d", _fileName.c_str(), tag2str(resources[i].tag), i);
+			stream->read(data, len);
+
+			if (!out.open(filename)) {
+				warning("MacResManager::dumpRaw(): Can not open dump file %s", filename.c_str());
+				break;
+			}
+
+			out.write(data, len);
+
+			out.flush();
+			out.close();
+		}
+	}
+
+
+
 	// We need to have found the 'File' resource already
 	if (rifxType == MKTAG('A', 'P', 'P', 'L')) {
 		warning("No 'File' resource present in APPL archive");
diff --git a/engines/director/archive.h b/engines/director/archive.h
index 847eff5..a120094 100644
--- a/engines/director/archive.h
+++ b/engines/director/archive.h
@@ -53,6 +53,7 @@ public:
 	virtual void close();
 
 	Common::String getFileName() const { return _fileName; }
+	void setFileName(const Common::String &name) { _fileName = name; }
 
 	bool isOpen() const { return _stream != 0; }
 
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 881cd08..0014f2e 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -236,6 +236,7 @@ void DirectorEngine::loadMac(const Common::String movie) {
 
 		Common::SeekableReadStream *dataFork = _macBinary->getDataFork();
 		_mainArchive = new RIFXArchive();
+		_mainArchive->setFileName(movie);
 
 		// First we need to detect PPC vs. 68k
 




More information about the Scummvm-git-logs mailing list