diff options
author | md5 | 2011-03-12 23:45:36 +0200 |
---|---|---|
committer | md5 | 2011-03-12 23:45:36 +0200 |
commit | 5dce3235e97758a76bac899d80e8166dcf33986d (patch) | |
tree | e0d8cecb4ea7fc869296eb912416f80f606cc161 | |
parent | 0bc9db7872ca163a2a7ccfde74ab0afa4656345c (diff) | |
download | scummvm-rg350-5dce3235e97758a76bac899d80e8166dcf33986d.tar.gz scummvm-rg350-5dce3235e97758a76bac899d80e8166dcf33986d.tar.bz2 scummvm-rg350-5dce3235e97758a76bac899d80e8166dcf33986d.zip |
SCI: Some changes to the "dissassemble" command
Fixed a bug (the "bwt" and "bc" options were inversed) and added the
ability to skip a defined number of ret calls, useful when a function
continues after a ret call
-rw-r--r-- | engines/sci/console.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index aaf79dadda..6a64f198f6 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -2601,12 +2601,14 @@ bool Console::cmdDisassemble(int argc, const char **argv) { DebugPrintf("Valid options are:\n"); DebugPrintf(" bwt : Print byte/word tag\n"); DebugPrintf(" bc : Print bytecode\n"); + DebugPrintf(" rX : Continue after X ret opcodes before stopping decompilation\n"); return true; } reg_t objAddr = NULL_REG; bool printBytecode = false; bool printBWTag = false; + int ignoreXret = 0; if (parse_reg_t(_engine->_gamestate, argv[1], &objAddr, false)) { DebugPrintf("Invalid address passed.\n"); @@ -2616,7 +2618,7 @@ bool Console::cmdDisassemble(int argc, const char **argv) { const Object *obj = _engine->_gamestate->_segMan->getObject(objAddr); int selectorId = _engine->getKernel()->findSelector(argv[2]); - reg_t addr; + reg_t addr = NULL_REG; if (!obj) { DebugPrintf("Not an object."); @@ -2635,13 +2637,20 @@ bool Console::cmdDisassemble(int argc, const char **argv) { for (int i = 3; i < argc; i++) { if (!scumm_stricmp(argv[i], "bwt")) - printBytecode = true; - else if (!scumm_stricmp(argv[i], "bc")) printBWTag = true; + else if (!scumm_stricmp(argv[i], "bc")) + printBytecode = true; + else if (argv[i][0] == 'r') + ignoreXret = atoi(argv[i] + 1); } do { + reg_t prevAddr = addr; addr = disassemble(_engine->_gamestate, addr, printBWTag, printBytecode); + if (addr.isNull() && ignoreXret) { + addr = prevAddr + 1; // skip past the ret + ignoreXret--; + } } while (addr.offset > 0); return true; |