diff options
Diffstat (limited to 'engines/xeen/debugger.cpp')
-rw-r--r-- | engines/xeen/debugger.cpp | 31 |
1 files changed, 31 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 |