diff options
author | Paul Gilbert | 2016-09-17 15:42:24 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-09-17 15:42:24 -0400 |
commit | ad9e00d213115971ad298b8394eeb6f2fe7349e6 (patch) | |
tree | 848139235e53cd2748ec810050d16d375ace3722 | |
parent | 34b266b51d69617d852d0118b9992f0013f3c1e4 (diff) | |
download | scummvm-rg350-ad9e00d213115971ad298b8394eeb6f2fe7349e6.tar.gz scummvm-rg350-ad9e00d213115971ad298b8394eeb6f2fe7349e6.tar.bz2 scummvm-rg350-ad9e00d213115971ad298b8394eeb6f2fe7349e6.zip |
XEEN: Added dump command to the debugger
-rw-r--r-- | engines/xeen/debugger.cpp | 31 | ||||
-rw-r--r-- | engines/xeen/debugger.h | 1 |
2 files changed, 32 insertions, 0 deletions
diff --git a/engines/xeen/debugger.cpp b/engines/xeen/debugger.cpp index d9b4990e97..7835511ec9 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 e7f8ef6b7d..8599835866 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); |