diff options
author | Max Horn | 2010-11-02 09:49:47 +0000 |
---|---|---|
committer | Max Horn | 2010-11-02 09:49:47 +0000 |
commit | ba3e826872d8456a3bca171bf5613f7802e9582a (patch) | |
tree | c3b4f245c111d6931ddb13f68a6171dd9615041c /engines/sci/engine | |
parent | 31bf3a413756dd55a3b89ec0b2ec798e360f7d49 (diff) | |
download | scummvm-rg350-ba3e826872d8456a3bca171bf5613f7802e9582a.tar.gz scummvm-rg350-ba3e826872d8456a3bca171bf5613f7802e9582a.tar.bz2 scummvm-rg350-ba3e826872d8456a3bca171bf5613f7802e9582a.zip |
SCI: Remove any use of printf
svn-id: r54037
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/kernel.cpp | 28 | ||||
-rw-r--r-- | engines/sci/engine/kmisc.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/kparse.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/scriptdebug.cpp | 132 | ||||
-rw-r--r-- | engines/sci/engine/seg_manager.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/selector.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/vm.cpp | 66 |
7 files changed, 120 insertions, 120 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index d17d4f3fb3..408dc5f150 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -138,7 +138,7 @@ void Kernel::loadSelectorNames() { Common::String tmp((const char *)r->data + offset + 2, len); _selectorNames.push_back(tmp); - //printf("%s\n", tmp.c_str()); // debug + //debug("%s", tmp.c_str()); // Early SCI versions used the LSB in the selector ID as a read/write // toggle. To compensate for that, we add every selector name twice. @@ -430,8 +430,8 @@ static void kernelSignatureDebugType(const uint16 type) { while (list->typeCheck) { if (type & list->typeCheck) { if (!firstPrint) - printf(", "); - printf("%s", list->text); + debugN(", "); + debugN("%s", list->text); firstPrint = false; } list++; @@ -442,38 +442,38 @@ static void kernelSignatureDebugType(const uint16 type) { void Kernel::signatureDebug(const uint16 *sig, int argc, const reg_t *argv) { int argnr = 0; while (*sig || argc) { - printf("parameter %d: ", argnr++); + debugN("parameter %d: ", argnr++); if (argc) { reg_t parameter = *argv; - printf("%04x:%04x (", PRINT_REG(parameter)); + debugN("%04x:%04x (", PRINT_REG(parameter)); int regType = findRegType(parameter); if (regType) kernelSignatureDebugType(regType); else - printf("unknown type of %04x:%04x", PRINT_REG(parameter)); - printf(")"); + debugN("unknown type of %04x:%04x", PRINT_REG(parameter)); + debugN(")"); argv++; argc--; } else { - printf("not passed"); + debugN("not passed"); } if (*sig) { const uint16 signature = *sig; if ((signature & SIG_MAYBE_ANY) == SIG_MAYBE_ANY) { - printf(", may be any"); + debugN(", may be any"); } else { - printf(", should be "); + debugN(", should be "); kernelSignatureDebugType(signature); } if (signature & SIG_IS_OPTIONAL) - printf(" (optional)"); + debugN(" (optional)"); if (signature & SIG_NEEDS_MORE) - printf(" (needs more)"); + debugN(" (needs more)"); if (signature & SIG_MORE_MAY_FOLLOW) - printf(" (more may follow)"); + debugN(" (more may follow)"); sig++; } - printf("\n"); + debugN("\n"); } } diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 13fe14a995..a92a7a2645 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -164,7 +164,7 @@ reg_t kFlushResources(EngineState *s, int argc, reg_t *argv) { } reg_t kSetDebug(EngineState *s, int argc, reg_t *argv) { - printf("Debug mode activated\n"); + debug("Debug mode activated"); g_sci->_debugState.seeking = kDebugSeekNothing; g_sci->_debugState.runningStep = 0; diff --git a/engines/sci/engine/kparse.cpp b/engines/sci/engine/kparse.cpp index 6a052a582d..0b55c0fce7 100644 --- a/engines/sci/engine/kparse.cpp +++ b/engines/sci/engine/kparse.cpp @@ -62,7 +62,7 @@ reg_t kSaid(EngineState *s, int argc, reg_t *argv) { } #ifdef DEBUG_PARSER - printf("Said block: "); + debugN("Said block: "); g_sci->getVocabulary()->debugDecipherSaidBlock(said_block); #endif @@ -74,7 +74,7 @@ reg_t kSaid(EngineState *s, int argc, reg_t *argv) { if (new_lastmatch != SAID_NO_MATCH) { /* Build and possibly display a parse tree */ #ifdef DEBUG_PARSER - printf("kSaid: Match.\n"); + debugN("kSaid: Match.\n"); #endif s->r_acc = make_reg(0, 1); diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index 9c08526fbb..d587db26b4 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -95,7 +95,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod opsize &= 1; // byte if true, word if false - printf("%04x:%04x: ", PRINT_REG(pos)); + debugN("%04x:%04x: ", PRINT_REG(pos)); if (print_bytecode) { if (pos.offset + bytecount > scr_size) { @@ -104,16 +104,16 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod } for (i = 0; i < bytecount; i++) - printf("%02x ", scr[pos.offset + i]); + debugN("%02x ", scr[pos.offset + i]); for (i = bytecount; i < 5; i++) - printf(" "); + debugN(" "); } if (print_bw_tag) - printf("[%c] ", opsize ? 'B' : 'W'); + debugN("[%c] ", opsize ? 'B' : 'W'); - printf("%s", opcodeNames[opcode]); + debugN("%s", opcodeNames[opcode]); i = 0; while (g_opcode_formats[opcode][i]) { @@ -124,12 +124,12 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod case Script_SByte: case Script_Byte: - printf(" %02x", scr[retval.offset++]); + debugN(" %02x", scr[retval.offset++]); break; case Script_Word: case Script_SWord: - printf(" %04x", READ_SCI11ENDIAN_UINT16(&scr[retval.offset])); + debugN(" %04x", READ_SCI11ENDIAN_UINT16(&scr[retval.offset])); retval.offset += 2; break; @@ -148,11 +148,11 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod } if (opcode == op_callk) - printf(" %s[%x]", (param_value < kernel->_kernelFuncs.size()) ? + debugN(" %s[%x]", (param_value < kernel->_kernelFuncs.size()) ? ((param_value < kernel->getKernelNamesSize()) ? kernel->getKernelName(param_value).c_str() : "[Unknown(postulated)]") : "<invalid>", param_value); else - printf(opsize ? " %02x" : " %04x", param_value); + debugN(opsize ? " %02x" : " %04x", param_value); break; @@ -163,7 +163,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod param_value = READ_SCI11ENDIAN_UINT16(&scr[retval.offset]); retval.offset += 2; } - printf(opsize ? " %02x" : " %04x", param_value); + debugN(opsize ? " %02x" : " %04x", param_value); break; case Script_SRelative: @@ -173,7 +173,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod param_value = READ_SCI11ENDIAN_UINT16(&scr[retval.offset]); retval.offset += 2; } - printf(opsize ? " %02x [%04x]" : " %04x [%04x]", param_value, (0xffff) & (retval.offset + param_value)); + debugN(opsize ? " %02x [%04x]" : " %04x [%04x]", param_value, (0xffff) & (retval.offset + param_value)); break; case Script_End: @@ -193,11 +193,11 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod if (!obj) warning("Attempted to reference on non-object at %04x:%04x", PRINT_REG(s->xs->objp)); else - printf(" (%s)", g_sci->getKernel()->getSelectorName(obj->propertyOffsetToId(s->_segMan, scr[pos.offset + 1])).c_str()); + debugN(" (%s)", g_sci->getKernel()->getSelectorName(obj->propertyOffsetToId(s->_segMan, scr[pos.offset + 1])).c_str()); } } - printf("\n"); + debugN("\n"); if (pos == s->xs->addr.pc) { // Extra information if debugging the current opcode if (opcode == op_callk) { @@ -208,14 +208,14 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod if (!oldScriptHeader) argc += (s->restAdjust); - printf(" Kernel params: ("); + debugN(" Kernel params: ("); for (int j = 0; j < argc; j++) { - printf("%04x:%04x", PRINT_REG((s->xs->sp)[j - stackframe])); + debugN("%04x:%04x", PRINT_REG((s->xs->sp)[j - stackframe])); if (j + 1 < argc) - printf(", "); + debugN(", "); } - printf(")\n"); + debugN(")\n"); } else if ((opcode == op_send) || (opcode == op_self)) { int restmod = s->restAdjust; int stackframe = (scr[pos.offset + 1] >> 1) + restmod; @@ -240,32 +240,32 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod if (!name) name = "<invalid>"; - printf(" %s::%s[", name, g_sci->getKernel()->getSelectorName(selector).c_str()); + debugN(" %s::%s[", name, g_sci->getKernel()->getSelectorName(selector).c_str()); switch (lookupSelector(s->_segMan, called_obj_addr, selector, 0, &fun_ref)) { case kSelectorMethod: - printf("FUNCT"); + debugN("FUNCT"); argc += restmod; restmod = 0; break; case kSelectorVariable: - printf("VAR"); + debugN("VAR"); break; case kSelectorNone: - printf("INVALID"); + debugN("INVALID"); break; } - printf("]("); + debugN("]("); while (argc--) { - printf("%04x:%04x", PRINT_REG(sb[- stackframe + 2])); + debugN("%04x:%04x", PRINT_REG(sb[- stackframe + 2])); if (argc) - printf(", "); + debugN(", "); stackframe--; } - printf(")\n"); + debugN(")\n"); stackframe -= 2; } // while (stackframe > 0) } // Send-like opcodes @@ -334,7 +334,7 @@ void SciEngine::scriptDebug() { // OK, found whatever we were looking for } - printf("Step #%d\n", s->scriptStepCounter); + debugN("Step #%d\n", s->scriptStepCounter); disassemble(s, s->xs->addr.pc, 0, 1); if (_debugState.runningStep) { @@ -354,27 +354,27 @@ void Kernel::dumpScriptObject(char *data, int seeker, int objsize) { int namepos = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *) data + 14 + seeker); int i = 0; - printf("Object\n"); + debugN("Object\n"); Common::hexdump((unsigned char *) data + seeker, objsize - 4, 16, seeker); //-4 because the size includes the two-word header - printf("Name: %s\n", namepos ? ((char *)(data + namepos)) : "<unknown>"); - printf("Superclass: %x\n", superclass); - printf("Species: %x\n", species); - printf("-info-:%x\n", (int16)READ_SCI11ENDIAN_UINT16((unsigned char *) data + 12 + seeker) & 0xffff); + debugN("Name: %s\n", namepos ? ((char *)(data + namepos)) : "<unknown>"); + debugN("Superclass: %x\n", superclass); + debugN("Species: %x\n", species); + debugN("-info-:%x\n", (int16)READ_SCI11ENDIAN_UINT16((unsigned char *) data + 12 + seeker) & 0xffff); - printf("Function area offset: %x\n", (int16)READ_SCI11ENDIAN_UINT16((unsigned char *) data + seeker + 4)); - printf("Selectors [%x]:\n", selectors = (selectorsize = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *) data + seeker + 6))); + debugN("Function area offset: %x\n", (int16)READ_SCI11ENDIAN_UINT16((unsigned char *) data + seeker + 4)); + debugN("Selectors [%x]:\n", selectors = (selectorsize = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *) data + seeker + 6))); seeker += 8; while (selectors--) { - printf(" [#%03x] = 0x%x\n", i++, (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + seeker) & 0xffff); + debugN(" [#%03x] = 0x%x\n", i++, (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + seeker) & 0xffff); seeker += 2; } - printf("Overridden functions: %x\n", selectors = overloads = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + seeker)); + debugN("Overridden functions: %x\n", selectors = overloads = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + seeker)); seeker += 2; @@ -382,8 +382,8 @@ void Kernel::dumpScriptObject(char *data, int seeker, int objsize) { while (overloads--) { int selector = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *) data + (seeker)); - printf(" [%03x] %s: @", selector & 0xffff, (selector >= 0 && selector < (int)_selectorNames.size()) ? _selectorNames[selector].c_str() : "<?>"); - printf("%04x\n", (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + seeker + selectors*2 + 2) & 0xffff); + debugN(" [%03x] %s: @", selector & 0xffff, (selector >= 0 && selector < (int)_selectorNames.size()) ? _selectorNames[selector].c_str() : "<?>"); + debugN("%04x\n", (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + seeker + selectors*2 + 2) & 0xffff); seeker += 2; } @@ -395,17 +395,17 @@ void Kernel::dumpScriptClass(char *data, int seeker, int objsize) { int superclass = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *) data + 10 + seeker); int namepos = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *) data + 14 + seeker); - printf("Class\n"); + debugN("Class\n"); Common::hexdump((unsigned char *) data + seeker, objsize - 4, 16, seeker); - printf("Name: %s\n", namepos ? ((char *)data + namepos) : "<unknown>"); - printf("Superclass: %x\n", superclass); - printf("Species: %x\n", species); - printf("-info-:%x\n", (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + 12 + seeker) & 0xffff); + debugN("Name: %s\n", namepos ? ((char *)data + namepos) : "<unknown>"); + debugN("Superclass: %x\n", superclass); + debugN("Species: %x\n", species); + debugN("-info-:%x\n", (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + 12 + seeker) & 0xffff); - printf("Function area offset: %x\n", (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + seeker + 4)); - printf("Selectors [%x]:\n", selectors = (selectorsize = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + seeker + 6))); + debugN("Function area offset: %x\n", (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + seeker + 4)); + debugN("Selectors [%x]:\n", selectors = (selectorsize = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + seeker + 6))); seeker += 8; selectorsize <<= 1; @@ -413,7 +413,7 @@ void Kernel::dumpScriptClass(char *data, int seeker, int objsize) { while (selectors--) { int selector = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *) data + (seeker) + selectorsize); - printf(" [%03x] %s = 0x%x\n", 0xffff & selector, (selector >= 0 && selector < (int)_selectorNames.size()) ? _selectorNames[selector].c_str() : "<?>", + debugN(" [%03x] %s = 0x%x\n", 0xffff & selector, (selector >= 0 && selector < (int)_selectorNames.size()) ? _selectorNames[selector].c_str() : "<?>", (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + seeker) & 0xffff); seeker += 2; @@ -421,16 +421,16 @@ void Kernel::dumpScriptClass(char *data, int seeker, int objsize) { seeker += selectorsize; - printf("Overloaded functions: %x\n", selectors = overloads = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + seeker)); + debugN("Overloaded functions: %x\n", selectors = overloads = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + seeker)); seeker += 2; while (overloads--) { int selector = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + (seeker)); - fprintf(stderr, "selector=%d; selectorNames.size() =%d\n", selector, _selectorNames.size()); - printf(" [%03x] %s: @", selector & 0xffff, (selector >= 0 && selector < (int)_selectorNames.size()) ? + debugN("selector=%d; selectorNames.size() =%d\n", selector, _selectorNames.size()); + debugN(" [%03x] %s: @", selector & 0xffff, (selector >= 0 && selector < (int)_selectorNames.size()) ? _selectorNames[selector].c_str() : "<?>"); - printf("%04x\n", (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + seeker + selectors * 2 + 2) & 0xffff); + debugN("%04x\n", (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + seeker + selectors * 2 + 2) & 0xffff); seeker += 2; } @@ -452,17 +452,17 @@ void Kernel::dissectScript(int scriptNumber, Vocabulary *vocab) { unsigned int seeker = _seeker + 4; if (!objType) { - printf("End of script object (#0) encountered.\n"); - printf("Classes: %i, Objects: %i, Export: %i,\n Var: %i (all base 10)", + debugN("End of script object (#0) encountered.\n"); + debugN("Classes: %i, Objects: %i, Export: %i,\n Var: %i (all base 10)", objectctr[6], objectctr[1], objectctr[7], objectctr[10]); return; } - printf("\n"); + debugN("\n"); objsize = (int16)READ_SCI11ENDIAN_UINT16(script->data + _seeker + 2); - printf("Obj type #%x, size 0x%x: ", objType, objsize); + debugN("Obj type #%x, size 0x%x: ", objType, objsize); _seeker += objsize; @@ -474,28 +474,28 @@ void Kernel::dissectScript(int scriptNumber, Vocabulary *vocab) { break; case SCI_OBJ_CODE: - printf("Code\n"); + debugN("Code\n"); Common::hexdump(script->data + seeker, objsize - 4, 16, seeker); break; case 3: - printf("<unknown>\n"); + debugN("<unknown>\n"); Common::hexdump(script->data + seeker, objsize - 4, 16, seeker); break; case SCI_OBJ_SAID: - printf("Said\n"); + debugN("Said\n"); Common::hexdump(script->data + seeker, objsize - 4, 16, seeker); - printf("%04x: ", seeker); + debugN("%04x: ", seeker); vocab->debugDecipherSaidBlock(script->data + seeker); - printf("\n"); + debugN("\n"); break; case SCI_OBJ_STRINGS: - printf("Strings\n"); + debugN("Strings\n"); while (script->data [seeker]) { - printf("%04x: %s\n", seeker, script->data + seeker); + debugN("%04x: %s\n", seeker, script->data + seeker); seeker += strlen((char *)script->data + seeker) + 1; } seeker++; // the ending zero byte @@ -506,33 +506,33 @@ void Kernel::dissectScript(int scriptNumber, Vocabulary *vocab) { break; case SCI_OBJ_EXPORTS: - printf("Exports\n"); + debugN("Exports\n"); Common::hexdump((unsigned char *)script->data + seeker, objsize - 4, 16, seeker); break; case SCI_OBJ_POINTERS: - printf("Pointers\n"); + debugN("Pointers\n"); Common::hexdump(script->data + seeker, objsize - 4, 16, seeker); break; case 9: - printf("<unknown>\n"); + debugN("<unknown>\n"); Common::hexdump(script->data + seeker, objsize - 4, 16, seeker); break; case SCI_OBJ_LOCALVARS: - printf("Local vars\n"); + debugN("Local vars\n"); Common::hexdump(script->data + seeker, objsize - 4, 16, seeker); break; default: - printf("Unsupported!\n"); + debugN("Unsupported!\n"); return; } } - printf("Script ends without terminator\n"); + debugN("Script ends without terminator\n"); } } // End of namespace Sci diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index 1cbe9a56f4..d509046a15 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -301,9 +301,9 @@ reg_t SegManager::findObjectByName(const Common::String &name, int index) { return NULL_REG; if (result.size() > 1 && index < 0) { - printf("Ambiguous:\n"); + debug("findObjectByName(%s): multiple matches:", name.c_str()); for (i = 0; i < result.size(); i++) - printf(" %3x: [%04x:%04x] %s\n", i, PRINT_REG(result[i]), name.c_str()); + debug(" %3x: [%04x:%04x]", i, PRINT_REG(result[i])); return NULL_REG; // Ambiguous } diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp index b31f52aa13..798dbf529c 100644 --- a/engines/sci/engine/selector.cpp +++ b/engines/sci/engine/selector.cpp @@ -40,10 +40,10 @@ namespace Sci { // The defines below can be used to construct static selector tables for games which don't have // a vocab.997 resource, by dumping the selector table from other similar versions or games #define FIND_SELECTOR(_slc_) _selectorCache._slc_ = findSelector(#_slc_); \ - printf("\t{ \"%s\", %d },\n", #_slc_, _selectorCache._slc_) + debugN("\t{ \"%s\", %d },\n", #_slc_, _selectorCache._slc_) #define FIND_SELECTOR2(_slc_, _slcstr_) _selectorCache._slc_ = findSelector(_slcstr_); \ - printf("\t{ \"%s\", %d },\n", _slcstr_, _selectorCache._slc_) + debugN("\t{ \"%s\", %d },\n", _slcstr_, _selectorCache._slc_) #endif diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 650f01469a..cefb228c13 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -423,7 +423,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt } #ifdef VM_DEBUG_SEND - printf("Send to %04x:%04x (%s), selector %04x (%s):", PRINT_REG(send_obj), + debugN("Send to %04x:%04x (%s), selector %04x (%s):", PRINT_REG(send_obj), s->_segMan->getObjectName(send_obj), selector, g_sci->getKernel()->getSelectorName(selector).c_str()); #endif // VM_DEBUG_SEND @@ -438,9 +438,9 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt #ifdef VM_DEBUG_SEND if (argc) - printf("Varselector: Write %04x:%04x\n", PRINT_REG(argp[1])); + debugN("Varselector: Write %04x:%04x\n", PRINT_REG(argp[1])); else - printf("Varselector: Read\n"); + debugN("Varselector: Read\n"); #endif // VM_DEBUG_SEND // argc == 0: read selector @@ -496,39 +496,39 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt #ifndef VM_DEBUG_SEND if (activeBreakpointTypes & BREAK_SELECTOREXEC) { if (g_sci->checkSelectorBreakpoint(BREAK_SELECTOREXEC, send_obj, selector)) { - printf("[execute selector]"); + debugN("[execute selector]"); int displaySize = 0; for (int argNr = 1; argNr <= argc; argNr++) { if (argNr == 1) - printf(" - "); + debugN(" - "); reg_t curParam = argp[argNr]; if (curParam.segment) { - printf("[%04x:%04x] ", PRINT_REG(curParam)); + debugN("[%04x:%04x] ", PRINT_REG(curParam)); displaySize += 12; } else { - printf("[%04x] ", curParam.offset); + debugN("[%04x] ", curParam.offset); displaySize += 7; } if (displaySize > 50) { if (argNr < argc) - printf("..."); + debugN("..."); break; } } - printf("\n"); + debugN("\n"); } } #else // VM_DEBUG_SEND if (activeBreakpointTypes & BREAK_SELECTOREXEC) g_sci->checkSelectorBreakpoint(BREAK_SELECTOREXEC, send_obj, selector); - printf("Funcselector("); + debugN("Funcselector("); for (int i = 0; i < argc; i++) { - printf("%04x:%04x", PRINT_REG(argp[i+1])); + debugN("%04x:%04x", PRINT_REG(argp[i+1])); if (i + 1 < argc) - printf(", "); + debugN(", "); } - printf(") at %04x:%04x\n", PRINT_REG(funcp)); + debugN(") at %04x:%04x\n", PRINT_REG(funcp)); #endif // VM_DEBUG_SEND { @@ -583,7 +583,7 @@ static ExecStack *add_exec_stack_entry(Common::List<ExecStack> &execStack, reg_t // Returns new TOS element for the execution stack // _localsSegment may be -1 if derived from the called object - //printf("Exec stack: [%d/%d], origin %d, at %p\n", s->execution_stack_pos, s->_executionStack.size(), origin, s->execution_stack); + //debug("Exec stack: [%d/%d], origin %d, at %p", s->execution_stack_pos, s->_executionStack.size(), origin, s->execution_stack); ExecStack xstack; @@ -655,46 +655,46 @@ static void addKernelCallToExecStack(EngineState *s, int kernelCallNr, int argc, static void logKernelCall(const KernelFunction *kernelCall, const KernelSubFunction *kernelSubCall, EngineState *s, int argc, reg_t *argv, reg_t result) { Kernel *kernel = g_sci->getKernel(); if (!kernelSubCall) { - printf("k%s: ", kernelCall->name); + debugN("k%s: ", kernelCall->name); } else { int callNameLen = strlen(kernelCall->name); if (strncmp(kernelCall->name, kernelSubCall->name, callNameLen) == 0) { const char *subCallName = kernelSubCall->name + callNameLen; - printf("k%s(%s): ", kernelCall->name, subCallName); + debugN("k%s(%s): ", kernelCall->name, subCallName); } else { - printf("k%s(%s): ", kernelCall->name, kernelSubCall->name); + debugN("k%s(%s): ", kernelCall->name, kernelSubCall->name); } } for (int parmNr = 0; parmNr < argc; parmNr++) { if (parmNr) - printf(", "); + debugN(", "); uint16 regType = kernel->findRegType(argv[parmNr]); if (regType & SIG_TYPE_NULL) - printf("0"); + debugN("0"); else if (regType & SIG_TYPE_UNINITIALIZED) - printf("UNINIT"); + debugN("UNINIT"); else if (regType & SIG_IS_INVALID) - printf("INVALID"); + debugN("INVALID"); else if (regType & SIG_TYPE_INTEGER) - printf("%d", argv[parmNr].offset); + debugN("%d", argv[parmNr].offset); else { - printf("%04x:%04x", PRINT_REG(argv[parmNr])); + debugN("%04x:%04x", PRINT_REG(argv[parmNr])); switch (regType) { case SIG_TYPE_OBJECT: - printf(" (%s)", s->_segMan->getObjectName(argv[parmNr])); + debugN(" (%s)", s->_segMan->getObjectName(argv[parmNr])); break; case SIG_TYPE_REFERENCE: if (kernelCall->function == kSaid) { SegmentRef saidSpec = s->_segMan->dereference(argv[parmNr]); if (saidSpec.isRaw) { - printf(" ('"); + debugN(" ('"); g_sci->getVocabulary()->debugDecipherSaidBlock(saidSpec.raw); - printf("')"); + debugN("')"); } else { - printf(" (non-raw said-spec)"); + debugN(" (non-raw said-spec)"); } } else { - printf(" ('%s')", s->_segMan->getString(argv[parmNr]).c_str()); + debugN(" ('%s')", s->_segMan->getString(argv[parmNr]).c_str()); } default: break; @@ -702,9 +702,9 @@ static void logKernelCall(const KernelFunction *kernelCall, const KernelSubFunct } } if (result.segment) - printf(" = %04x:%04x\n", PRINT_REG(result)); + debugN(" = %04x:%04x\n", PRINT_REG(result)); else - printf(" = %d\n", result.offset); + debugN(" = %d\n", result.offset); } static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) { @@ -749,7 +749,7 @@ static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) { if (kernelCall.debugLogging) logKernelCall(&kernelCall, NULL, s, argc, argv, s->r_acc); if (kernelCall.debugBreakpoint) { - printf("Break on k%s\n", kernelCall.name); + debugN("Break on k%s\n", kernelCall.name); g_sci->_debugState.debugging = true; g_sci->_debugState.breakpointWasHit = true; } @@ -804,7 +804,7 @@ static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) { if (kernelSubCall.debugLogging) logKernelCall(&kernelCall, &kernelSubCall, s, argc, argv, s->r_acc); if (kernelSubCall.debugBreakpoint) { - printf("Break on k%s\n", kernelSubCall.name); + debugN("Break on k%s\n", kernelSubCall.name); g_sci->_debugState.debugging = true; g_sci->_debugState.breakpointWasHit = true; } @@ -830,7 +830,7 @@ int readPMachineInstruction(const byte *src, byte &extOpcode, int16 opparams[4]) memset(opparams, 0, sizeof(opparams)); for (int i = 0; g_opcode_formats[opcode][i]; ++i) { - //printf("Opcode: 0x%x, Opnumber: 0x%x, temp: %d\n", opcode, opcode, temp); + //debugN("Opcode: 0x%x, Opnumber: 0x%x, temp: %d\n", opcode, opcode, temp); assert(i < 3); switch (g_opcode_formats[opcode][i]) { |