diff options
author | Jonathan Gray | 2003-04-25 02:53:35 +0000 |
---|---|---|
committer | Jonathan Gray | 2003-04-25 02:53:35 +0000 |
commit | 3da2a094437ff157cfacbe50664200a53b710c5d (patch) | |
tree | f803cfe986a0cf19979eab6f8c3e22fdd5b59da9 /scumm/debugger.cpp | |
parent | 33045523ae1a98b925b87947ce4509aefde1dcd1 (diff) | |
download | scummvm-rg350-3da2a094437ff157cfacbe50664200a53b710c5d.tar.gz scummvm-rg350-3da2a094437ff157cfacbe50664200a53b710c5d.tar.bz2 scummvm-rg350-3da2a094437ff157cfacbe50664200a53b710c5d.zip |
add importres and script starting functionality to the debugger
svn-id: r7100
Diffstat (limited to 'scumm/debugger.cpp')
-rw-r--r-- | scumm/debugger.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp index 6e1d597348..182d1e8735 100644 --- a/scumm/debugger.cpp +++ b/scumm/debugger.cpp @@ -24,6 +24,7 @@ #include "actor.h" #include "debugger.h" #include "common/util.h" +#include "common/file.h" // The new debugger doesn't actually have the guts for text console coded yet ;) @@ -86,7 +87,9 @@ void ScummDebugger::attach(Scumm *s, char *entry) { DCmd_Register("objects", &ScummDebugger::Cmd_PrintObjects); DCmd_Register("object", &ScummDebugger::Cmd_Object); DCmd_Register("script", &ScummDebugger::Cmd_Script); + DCmd_Register("scr", &ScummDebugger::Cmd_Script); DCmd_Register("scripts", &ScummDebugger::Cmd_PrintScript); + DCmd_Register("importres", &ScummDebugger::Cmd_ImportRes); DCmd_Register("loadgame", &ScummDebugger::Cmd_LoadGame); DCmd_Register("savegame", &ScummDebugger::Cmd_SaveGame); @@ -415,12 +418,55 @@ bool ScummDebugger::Cmd_Script(int argc, const char** argv) { if ((!strcmp(argv[2], "kill")) || (!strcmp(argv[2], "stop"))) { _s->stopScriptNr(scriptnum); + } else if ((!strcmp(argv[2], "run")) || (!strcmp(argv[2], "start"))) { + _s->runScript(scriptnum, 0, 0, 0); } else { Debug_Printf("Unknown script command '%s'\n", argv[2]); } return true; } + +bool ScummDebugger::Cmd_ImportRes(int argc, const char** argv) { + File file; + uint32 size; + int resnum; + + if (argc < 3) { + Debug_Printf("Syntax: importres <restype> <filename> <resnum>\n"); + return true; + } + + resnum = atoi(argv[3]); + // FIXME add bounds check + + if (!strncmp(argv[1], "scr", 3)) { + file.open(argv[2], ""); + if (file.isOpen() == false) { + Debug_Printf("Could not open file %s\n", argv[2]); + return true; + } + if (_s->_features & GF_SMALL_HEADER) { + size = file.readUint16LE(); + file.seek(-2, SEEK_CUR); + } else if (_s->_features & GF_SMALL_HEADER) { + if (!(_s->_features & GF_SMALL_NAMES)) + file.seek(8, SEEK_CUR); + size = file.readUint32LE(); + file.readUint16LE(); + file.seek(-6, SEEK_CUR); + } else { + file.readUint32BE(); + size = file.readUint32BE(); + file.seek(-8, SEEK_CUR); + } + + file.read(_s->createResource(rtScript, resnum, size), size); + + } else + Debug_Printf("Unknown importres type '%s'\n", argv[1]); + return true; +} bool ScummDebugger::Cmd_PrintScript(int argc, const char **argv) { int i; |