diff options
Diffstat (limited to 'engines/xeen')
-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); |