[Scummvm-cvs-logs] SF.net SVN: scummvm:[54276] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Wed Nov 17 09:05:11 CET 2010
Revision: 54276
http://scummvm.svn.sourceforge.net/scummvm/?rev=54276&view=rev
Author: thebluegr
Date: 2010-11-17 08:05:11 +0000 (Wed, 17 Nov 2010)
Log Message:
-----------
SCI: Unified the functionality and parameters of the disasm and disasm_addr commands
Modified Paths:
--------------
scummvm/trunk/engines/sci/console.cpp
scummvm/trunk/engines/sci/console.h
scummvm/trunk/engines/sci/engine/scriptdebug.cpp
Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp 2010-11-17 00:05:09 UTC (rev 54275)
+++ scummvm/trunk/engines/sci/console.cpp 2010-11-17 08:05:11 UTC (rev 54276)
@@ -2611,15 +2611,16 @@
bool Console::cmdDisassemble(int argc, const char **argv) {
if (argc < 3) {
DebugPrintf("Disassembles a method by name.\n");
- DebugPrintf("Usage: %s <object> <method> <print bytecode>\n", argv[0]);
- DebugPrintf("The last parameter, <print bytecode> is optional. If true\n");
- DebugPrintf("or 1 is specified, the associated bytecode is shown next to\n");
- DebugPrintf("each dissassembled command\n");
+ DebugPrintf("Usage: %s <object> <method> <options>\n", argv[0]);
+ DebugPrintf("Valid options are:\n");
+ DebugPrintf(" bwt : Print byte/word tag\n");
+ DebugPrintf(" bc : Print bytecode\n");
return true;
}
reg_t objAddr = NULL_REG;
bool printBytecode = false;
+ bool printBWTag = false;
if (parse_reg_t(_engine->_gamestate, argv[1], &objAddr, false)) {
DebugPrintf("Invalid address passed.\n");
@@ -2646,11 +2647,15 @@
return true;
}
- if (argc == 4 && (!strcmp(argv[3], "1") || !strcmp(argv[3], "true")))
- printBytecode = true;
+ for (int i = 3; i < argc; i++) {
+ if (!scumm_stricmp(argv[i], "bwt"))
+ printBytecode = true;
+ else if (!scumm_stricmp(argv[i], "bc"))
+ printBWTag = true;
+ }
do {
- addr = disassemble(_engine->_gamestate, addr, 0, printBytecode);
+ addr = disassemble(_engine->_gamestate, addr, printBWTag, printBytecode);
} while (addr.offset > 0);
return true;
@@ -2668,9 +2673,9 @@
}
reg_t vpc = NULL_REG;
- int op_count = 1;
- int do_bwc = 0;
- bool do_bytes = false;
+ int opCount = 1;
+ bool printBWTag = false;
+ bool printBytes = false;
int size;
if (parse_reg_t(_engine->_gamestate, argv[1], &vpc, false)) {
@@ -2684,25 +2689,25 @@
for (int i = 2; i < argc; i++) {
if (!scumm_stricmp(argv[i], "bwt"))
- do_bwc = 1;
+ printBWTag = true;
else if (!scumm_stricmp(argv[i], "bc"))
- do_bytes = true;
+ printBytes = true;
else if (toupper(argv[i][0]) == 'C')
- op_count = atoi(argv[i] + 1);
+ opCount = atoi(argv[i] + 1);
else {
DebugPrintf("Invalid option '%s'\n", argv[i]);
return true;
}
}
- if (op_count < 0) {
+ if (opCount < 0) {
DebugPrintf("Invalid op_count\n");
return true;
}
do {
- vpc = disassemble(_engine->_gamestate, vpc, do_bwc, do_bytes);
- } while ((vpc.offset > 0) && (vpc.offset + 6 < size) && (--op_count));
+ vpc = disassemble(_engine->_gamestate, vpc, printBWTag, printBytes);
+ } while ((vpc.offset > 0) && (vpc.offset + 6 < size) && (--opCount));
return true;
}
Modified: scummvm/trunk/engines/sci/console.h
===================================================================
--- scummvm/trunk/engines/sci/console.h 2010-11-17 00:05:09 UTC (rev 54275)
+++ scummvm/trunk/engines/sci/console.h 2010-11-17 08:05:11 UTC (rev 54276)
@@ -36,7 +36,7 @@
class SciEngine;
struct List;
-reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, bool printBytecode);
+reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode);
class Console : public GUI::Debugger {
public:
Modified: scummvm/trunk/engines/sci/engine/scriptdebug.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptdebug.cpp 2010-11-17 00:05:09 UTC (rev 54275)
+++ scummvm/trunk/engines/sci/engine/scriptdebug.cpp 2010-11-17 08:05:11 UTC (rev 54276)
@@ -64,7 +64,7 @@
};
// Disassembles one command from the heap, returns address of next command or 0 if a ret was encountered.
-reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, bool printBytecode) {
+reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode) {
SegmentObj *mobj = s->_segMan->getSegment(pos.segment, SEG_TYPE_SCRIPT);
Script *script_entity = NULL;
const byte *scr;
@@ -110,7 +110,7 @@
debugN(" ");
}
- if (print_bw_tag)
+ if (printBWTag)
debugN("[%c] ", opsize ? 'B' : 'W');
debugN("%s", opcodeNames[opcode]);
@@ -335,7 +335,7 @@
}
debugN("Step #%d\n", s->scriptStepCounter);
- disassemble(s, s->xs->addr.pc, 0, true);
+ disassemble(s, s->xs->addr.pc, false, true);
if (_debugState.runningStep) {
_debugState.runningStep--;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list