[Scummvm-git-logs] scummvm master -> ad9e00d213115971ad298b8394eeb6f2fe7349e6

dreammaster dreammaster at scummvm.org
Sat Sep 17 21:43:03 CEST 2016


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:
ad9e00d213 XEEN: Added dump command to the debugger


Commit: ad9e00d213115971ad298b8394eeb6f2fe7349e6
    https://github.com/scummvm/scummvm/commit/ad9e00d213115971ad298b8394eeb6f2fe7349e6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-09-17T15:42:24-04:00

Commit Message:
XEEN: Added dump command to the debugger

Changed paths:
    engines/xeen/debugger.cpp
    engines/xeen/debugger.h



diff --git a/engines/xeen/debugger.cpp b/engines/xeen/debugger.cpp
index d9b4990..7835511 100644
--- a/engines/xeen/debugger.cpp
+++ b/engines/xeen/debugger.cpp
@@ -47,6 +47,7 @@ static int strToInt(const char *s) {
 Debugger::Debugger(XeenEngine *vm) : GUI::Debugger(), _vm(vm) {
 	registerCmd("continue", WRAP_METHOD(Debugger, cmdExit));
 	registerCmd("spell", WRAP_METHOD(Debugger, cmdSpell));
+	registerCmd("dump", WRAP_METHOD(Debugger, cmdDump));
 
 	_spellId = -1;
 }
@@ -82,4 +83,34 @@ bool Debugger::cmdSpell(int argc, const char **argv) {
 	return true;
 }
 
+bool Debugger::cmdDump(int argc, const char **argv) {
+	File f;
+
+	if (argc < 2) {
+		debugPrintf("Format: spell <resource name>\n");
+	} else {
+		if (argc == 2)
+			f.open(argv[1]);
+		else
+			f.open(argv[1], *_vm->_files->_sideArchives[strToInt(argv[2]) == 0 ? 0 : 1]);
+
+		if (f.isOpen()) {
+			Common::DumpFile df;
+			df.open(argv[1]);
+			byte *data = new byte[f.size()];
+			f.read(data, f.size());
+			df.write(data, f.size());
+
+			f.close();
+			df.close();
+			delete[] data;
+			debugPrintf("Saved\n");
+		} else {
+			debugPrintf("Could not find resource with that name\n");
+		}
+	}
+
+	return true;
+}
+
 } // End of namespace Xeen
diff --git a/engines/xeen/debugger.h b/engines/xeen/debugger.h
index e7f8ef6..8599835 100644
--- a/engines/xeen/debugger.h
+++ b/engines/xeen/debugger.h
@@ -36,6 +36,7 @@ private:
 	int _spellId;
 
 	bool cmdSpell(int argc, const char **argv);
+	bool cmdDump(int argc, const char **argv);
 public:
 	Debugger(XeenEngine *vm);
 





More information about the Scummvm-git-logs mailing list