[Scummvm-git-logs] scummvm master -> 2b308727ee122d1e95a0b49ef5f35dd1adbe9a38

bluegr bluegr at gmail.com
Fri Jun 11 22:20:03 UTC 2021


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:
2b308727ee TRECISION: Rename the filedump dumpfile, add a dumpanim command


Commit: 2b308727ee122d1e95a0b49ef5f35dd1adbe9a38
    https://github.com/scummvm/scummvm/commit/2b308727ee122d1e95a0b49ef5f35dd1adbe9a38
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-06-12T01:19:48+03:00

Commit Message:
TRECISION: Rename the filedump dumpfile, add a dumpanim command

Changed paths:
    engines/trecision/console.cpp
    engines/trecision/console.h


diff --git a/engines/trecision/console.cpp b/engines/trecision/console.cpp
index c1e9f47818..ff3ec5dc41 100644
--- a/engines/trecision/console.cpp
+++ b/engines/trecision/console.cpp
@@ -33,7 +33,8 @@ namespace Trecision {
 
 Console::Console(TrecisionEngine *vm) : GUI::Debugger(), _vm(vm) {
 	registerCmd("room",			WRAP_METHOD(Console, Cmd_Room));
-	registerCmd("filedump",		WRAP_METHOD(Console, Cmd_DumpFile));
+	registerCmd("dumpanim",		WRAP_METHOD(Console, Cmd_DumpAnim));
+	registerCmd("dumpfile",		WRAP_METHOD(Console, Cmd_DumpFile));
 	registerCmd("dialog",		WRAP_METHOD(Console, Cmd_Dialog));
 	registerCmd("item",			WRAP_METHOD(Console, Cmd_Item));
 	registerCmd("say",			WRAP_METHOD(Console, Cmd_Say));
@@ -55,6 +56,47 @@ bool Console::Cmd_Room(int argc, const char **argv) {
 	return false;
 }
 
+bool Console::Cmd_DumpAnim(int argc, const char **argv) {
+	if (argc < 2) {
+		debugPrintf("Usage: %s <file name>\n", argv[0]);
+		return true;
+	}
+
+	FastFile animFile;
+
+	Common::String fileName = argv[1];
+
+	bool found = false;
+	for (int i = 1; i <= 3; i++) {
+		Common::String animFileName = Common::String::format("nlanim.cd%d", i);
+		animFile.open(_vm, animFileName);
+
+		if (animFile.hasFile(fileName)) {
+			found = true;
+			break;
+		}
+	}
+
+	if (!found) {
+		debugPrintf("File not found\n");
+		animFile.close();
+		return true;
+	}
+
+	Common::SeekableReadStream *dataFile = animFile.createReadStreamForMember(fileName);
+
+	Common::DumpFile *outFile = new Common::DumpFile();
+	Common::String outName = fileName + ".dump";
+	outFile->open(outName);
+	outFile->writeStream(dataFile, dataFile->size());
+	outFile->finalize();
+	outFile->close();
+
+	animFile.close();
+
+	return true;
+}
+
 bool Console::Cmd_DumpFile(int argc, const char **argv) {
 	if (argc < 2) {
 		debugPrintf("Usage: %s <file name>\n", argv[0]);
@@ -63,7 +105,12 @@ bool Console::Cmd_DumpFile(int argc, const char **argv) {
 
 	Common::String fileName = argv[1];
 
-	Common::SeekableReadStream *dataFile = _vm->_dataFile.createReadStreamForCompressedMember(fileName);
+	if (!_vm->_dataFile.hasFile(fileName)) {
+		debugPrintf("File not found\n");
+		return true;
+	}
+
+	Common::SeekableReadStream *dataFile = fileName.hasSuffix(".cr") ? _vm->_dataFile.createReadStreamForCompressedMember(fileName) : _vm->_dataFile.createReadStreamForMember(fileName);
 
 	Common::DumpFile *outFile = new Common::DumpFile();
 	Common::String outName = fileName + ".dump";
diff --git a/engines/trecision/console.h b/engines/trecision/console.h
index 5c8f84ca32..440c7ccc39 100644
--- a/engines/trecision/console.h
+++ b/engines/trecision/console.h
@@ -38,6 +38,7 @@ private:
 	TrecisionEngine *_vm;
 
 	bool Cmd_Room(int argc, const char **argv);
+	bool Cmd_DumpAnim(int argc, const char **argv);
 	bool Cmd_DumpFile(int argc, const char **argv);
 	bool Cmd_Dialog(int argc, const char **argv);
 	bool Cmd_Item(int argc, const char **argv);




More information about the Scummvm-git-logs mailing list