SCI: Remove any use of printf
svn-id: r54037
This commit is contained in:
parent
31bf3a4137
commit
ba3e826872
15 changed files with 211 additions and 211 deletions
|
@ -1383,9 +1383,9 @@ bool Console::cmdSaid(int argc, const char **argv) {
|
||||||
}
|
}
|
||||||
spec[len++] = 0xFF;
|
spec[len++] = 0xFF;
|
||||||
|
|
||||||
printf("Matching '%s' against:", string);
|
debugN("Matching '%s' against:", string);
|
||||||
_engine->getVocabulary()->debugDecipherSaidBlock(spec);
|
_engine->getVocabulary()->debugDecipherSaidBlock(spec);
|
||||||
printf("\n");
|
debugN("\n");
|
||||||
|
|
||||||
ResultWordListList words;
|
ResultWordListList words;
|
||||||
bool res = _engine->getVocabulary()->tokenizeString(words, string, &error);
|
bool res = _engine->getVocabulary()->tokenizeString(words, string, &error);
|
||||||
|
@ -3154,24 +3154,24 @@ static void midi_hexdump(byte *data, int size, int notational_offset) {
|
||||||
int blanks = 0;
|
int blanks = 0;
|
||||||
|
|
||||||
offset += offset_mod;
|
offset += offset_mod;
|
||||||
printf(" [%04x] %d\t",
|
debugN(" [%04x] %d\t",
|
||||||
old_offset + notational_offset, time);
|
old_offset + notational_offset, time);
|
||||||
|
|
||||||
cmd = data[offset];
|
cmd = data[offset];
|
||||||
if (!(cmd & 0x80)) {
|
if (!(cmd & 0x80)) {
|
||||||
cmd = prev;
|
cmd = prev;
|
||||||
if (prev < 0x80) {
|
if (prev < 0x80) {
|
||||||
printf("Track broken at %x after"
|
debugN("Track broken at %x after"
|
||||||
" offset mod of %d\n",
|
" offset mod of %d\n",
|
||||||
offset + notational_offset, offset_mod);
|
offset + notational_offset, offset_mod);
|
||||||
Common::hexdump(data, size, 16, notational_offset);
|
Common::hexdump(data, size, 16, notational_offset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printf("(rs %02x) ", cmd);
|
debugN("(rs %02x) ", cmd);
|
||||||
blanks += 8;
|
blanks += 8;
|
||||||
} else {
|
} else {
|
||||||
++offset;
|
++offset;
|
||||||
printf("%02x ", cmd);
|
debugN("%02x ", cmd);
|
||||||
blanks += 3;
|
blanks += 3;
|
||||||
}
|
}
|
||||||
prev = cmd;
|
prev = cmd;
|
||||||
|
@ -3183,37 +3183,37 @@ static void midi_hexdump(byte *data, int size, int notational_offset) {
|
||||||
for (i = 0; i < pleft; i++) {
|
for (i = 0; i < pleft; i++) {
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
firstarg = data[offset];
|
firstarg = data[offset];
|
||||||
printf("%02x ", data[offset++]);
|
debugN("%02x ", data[offset++]);
|
||||||
blanks += 3;
|
blanks += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (blanks < 16) {
|
while (blanks < 16) {
|
||||||
blanks += 4;
|
blanks += 4;
|
||||||
printf(" ");
|
debugN(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
while (blanks < 20) {
|
while (blanks < 20) {
|
||||||
++blanks;
|
++blanks;
|
||||||
printf(" ");
|
debugN(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd == SCI_MIDI_EOT)
|
if (cmd == SCI_MIDI_EOT)
|
||||||
printf(";; EOT");
|
debugN(";; EOT");
|
||||||
else if (cmd == SCI_MIDI_SET_SIGNAL) {
|
else if (cmd == SCI_MIDI_SET_SIGNAL) {
|
||||||
if (firstarg == SCI_MIDI_SET_SIGNAL_LOOP)
|
if (firstarg == SCI_MIDI_SET_SIGNAL_LOOP)
|
||||||
printf(";; LOOP point");
|
debugN(";; LOOP point");
|
||||||
else
|
else
|
||||||
printf(";; CUE (%d)", firstarg);
|
debugN(";; CUE (%d)", firstarg);
|
||||||
} else if (SCI_MIDI_CONTROLLER(cmd)) {
|
} else if (SCI_MIDI_CONTROLLER(cmd)) {
|
||||||
if (firstarg == SCI_MIDI_CUMULATIVE_CUE)
|
if (firstarg == SCI_MIDI_CUMULATIVE_CUE)
|
||||||
printf(";; CUE (cumulative)");
|
debugN(";; CUE (cumulative)");
|
||||||
else if (firstarg == SCI_MIDI_RESET_ON_SUSPEND)
|
else if (firstarg == SCI_MIDI_RESET_ON_SUSPEND)
|
||||||
printf(";; RESET-ON-SUSPEND flag");
|
debugN(";; RESET-ON-SUSPEND flag");
|
||||||
}
|
}
|
||||||
printf("\n");
|
debugN("\n");
|
||||||
|
|
||||||
if (old_offset >= offset) {
|
if (old_offset >= offset) {
|
||||||
printf("-- Not moving forward anymore,"
|
debugN("-- Not moving forward anymore,"
|
||||||
" aborting (%x/%x)\n", offset, old_offset);
|
" aborting (%x/%x)\n", offset, old_offset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3692,22 +3692,22 @@ void Console::hexDumpReg(const reg_t *data, int len, int regsPerLine, int startO
|
||||||
byte c;
|
byte c;
|
||||||
int offset = startOffset;
|
int offset = startOffset;
|
||||||
while (len >= regsPerLine) {
|
while (len >= regsPerLine) {
|
||||||
printf("%06x: ", offset);
|
debugN("%06x: ", offset);
|
||||||
for (i = 0; i < regsPerLine; i++) {
|
for (i = 0; i < regsPerLine; i++) {
|
||||||
printf("%04x:%04x ", PRINT_REG(data[i]));
|
debugN("%04x:%04x ", PRINT_REG(data[i]));
|
||||||
}
|
}
|
||||||
printf(" |");
|
debugN(" |");
|
||||||
for (i = 0; i < regsPerLine; i++) {
|
for (i = 0; i < regsPerLine; i++) {
|
||||||
c = data[i].toUint16() & 0xff;
|
c = data[i].toUint16() & 0xff;
|
||||||
if (c < 32 || c >= 127)
|
if (c < 32 || c >= 127)
|
||||||
c = '.';
|
c = '.';
|
||||||
printf("%c", c);
|
debugN("%c", c);
|
||||||
c = data[i].toUint16() >> 8;
|
c = data[i].toUint16() >> 8;
|
||||||
if (c < 32 || c >= 127)
|
if (c < 32 || c >= 127)
|
||||||
c = '.';
|
c = '.';
|
||||||
printf("%c", c);
|
debugN("%c", c);
|
||||||
}
|
}
|
||||||
printf("|\n");
|
debugN("|\n");
|
||||||
data += regsPerLine;
|
data += regsPerLine;
|
||||||
len -= regsPerLine;
|
len -= regsPerLine;
|
||||||
offset += regsPerLine * (isArray ? 1 : 2);
|
offset += regsPerLine * (isArray ? 1 : 2);
|
||||||
|
@ -3716,27 +3716,27 @@ void Console::hexDumpReg(const reg_t *data, int len, int regsPerLine, int startO
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
printf("%06x: ", offset);
|
debugN("%06x: ", offset);
|
||||||
for (i = 0; i < regsPerLine; i++) {
|
for (i = 0; i < regsPerLine; i++) {
|
||||||
if (i < len)
|
if (i < len)
|
||||||
printf("%04x:%04x ", PRINT_REG(data[i]));
|
debugN("%04x:%04x ", PRINT_REG(data[i]));
|
||||||
else
|
else
|
||||||
printf(" ");
|
debugN(" ");
|
||||||
}
|
}
|
||||||
printf(" |");
|
debugN(" |");
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
c = data[i].toUint16() & 0xff;
|
c = data[i].toUint16() & 0xff;
|
||||||
if (c < 32 || c >= 127)
|
if (c < 32 || c >= 127)
|
||||||
c = '.';
|
c = '.';
|
||||||
printf("%c", c);
|
debugN("%c", c);
|
||||||
c = data[i].toUint16() >> 8;
|
c = data[i].toUint16() >> 8;
|
||||||
if (c < 32 || c >= 127)
|
if (c < 32 || c >= 127)
|
||||||
c = '.';
|
c = '.';
|
||||||
printf("%c", c);
|
debugN("%c", c);
|
||||||
}
|
}
|
||||||
for (; i < regsPerLine; i++)
|
for (; i < regsPerLine; i++)
|
||||||
printf(" ");
|
debugN(" ");
|
||||||
printf("|\n");
|
debugN("|\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace Sci
|
} // End of namespace Sci
|
||||||
|
|
|
@ -138,7 +138,7 @@ void Kernel::loadSelectorNames() {
|
||||||
|
|
||||||
Common::String tmp((const char *)r->data + offset + 2, len);
|
Common::String tmp((const char *)r->data + offset + 2, len);
|
||||||
_selectorNames.push_back(tmp);
|
_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
|
// 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.
|
// toggle. To compensate for that, we add every selector name twice.
|
||||||
|
@ -430,8 +430,8 @@ static void kernelSignatureDebugType(const uint16 type) {
|
||||||
while (list->typeCheck) {
|
while (list->typeCheck) {
|
||||||
if (type & list->typeCheck) {
|
if (type & list->typeCheck) {
|
||||||
if (!firstPrint)
|
if (!firstPrint)
|
||||||
printf(", ");
|
debugN(", ");
|
||||||
printf("%s", list->text);
|
debugN("%s", list->text);
|
||||||
firstPrint = false;
|
firstPrint = false;
|
||||||
}
|
}
|
||||||
list++;
|
list++;
|
||||||
|
@ -442,38 +442,38 @@ static void kernelSignatureDebugType(const uint16 type) {
|
||||||
void Kernel::signatureDebug(const uint16 *sig, int argc, const reg_t *argv) {
|
void Kernel::signatureDebug(const uint16 *sig, int argc, const reg_t *argv) {
|
||||||
int argnr = 0;
|
int argnr = 0;
|
||||||
while (*sig || argc) {
|
while (*sig || argc) {
|
||||||
printf("parameter %d: ", argnr++);
|
debugN("parameter %d: ", argnr++);
|
||||||
if (argc) {
|
if (argc) {
|
||||||
reg_t parameter = *argv;
|
reg_t parameter = *argv;
|
||||||
printf("%04x:%04x (", PRINT_REG(parameter));
|
debugN("%04x:%04x (", PRINT_REG(parameter));
|
||||||
int regType = findRegType(parameter);
|
int regType = findRegType(parameter);
|
||||||
if (regType)
|
if (regType)
|
||||||
kernelSignatureDebugType(regType);
|
kernelSignatureDebugType(regType);
|
||||||
else
|
else
|
||||||
printf("unknown type of %04x:%04x", PRINT_REG(parameter));
|
debugN("unknown type of %04x:%04x", PRINT_REG(parameter));
|
||||||
printf(")");
|
debugN(")");
|
||||||
argv++;
|
argv++;
|
||||||
argc--;
|
argc--;
|
||||||
} else {
|
} else {
|
||||||
printf("not passed");
|
debugN("not passed");
|
||||||
}
|
}
|
||||||
if (*sig) {
|
if (*sig) {
|
||||||
const uint16 signature = *sig;
|
const uint16 signature = *sig;
|
||||||
if ((signature & SIG_MAYBE_ANY) == SIG_MAYBE_ANY) {
|
if ((signature & SIG_MAYBE_ANY) == SIG_MAYBE_ANY) {
|
||||||
printf(", may be any");
|
debugN(", may be any");
|
||||||
} else {
|
} else {
|
||||||
printf(", should be ");
|
debugN(", should be ");
|
||||||
kernelSignatureDebugType(signature);
|
kernelSignatureDebugType(signature);
|
||||||
}
|
}
|
||||||
if (signature & SIG_IS_OPTIONAL)
|
if (signature & SIG_IS_OPTIONAL)
|
||||||
printf(" (optional)");
|
debugN(" (optional)");
|
||||||
if (signature & SIG_NEEDS_MORE)
|
if (signature & SIG_NEEDS_MORE)
|
||||||
printf(" (needs more)");
|
debugN(" (needs more)");
|
||||||
if (signature & SIG_MORE_MAY_FOLLOW)
|
if (signature & SIG_MORE_MAY_FOLLOW)
|
||||||
printf(" (more may follow)");
|
debugN(" (more may follow)");
|
||||||
sig++;
|
sig++;
|
||||||
}
|
}
|
||||||
printf("\n");
|
debugN("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ reg_t kFlushResources(EngineState *s, int argc, reg_t *argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
reg_t kSetDebug(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.seeking = kDebugSeekNothing;
|
||||||
g_sci->_debugState.runningStep = 0;
|
g_sci->_debugState.runningStep = 0;
|
||||||
|
|
|
@ -62,7 +62,7 @@ reg_t kSaid(EngineState *s, int argc, reg_t *argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_PARSER
|
#ifdef DEBUG_PARSER
|
||||||
printf("Said block: ");
|
debugN("Said block: ");
|
||||||
g_sci->getVocabulary()->debugDecipherSaidBlock(said_block);
|
g_sci->getVocabulary()->debugDecipherSaidBlock(said_block);
|
||||||
#endif
|
#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 */
|
if (new_lastmatch != SAID_NO_MATCH) { /* Build and possibly display a parse tree */
|
||||||
|
|
||||||
#ifdef DEBUG_PARSER
|
#ifdef DEBUG_PARSER
|
||||||
printf("kSaid: Match.\n");
|
debugN("kSaid: Match.\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
s->r_acc = make_reg(0, 1);
|
s->r_acc = make_reg(0, 1);
|
||||||
|
|
|
@ -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
|
opsize &= 1; // byte if true, word if false
|
||||||
|
|
||||||
printf("%04x:%04x: ", PRINT_REG(pos));
|
debugN("%04x:%04x: ", PRINT_REG(pos));
|
||||||
|
|
||||||
if (print_bytecode) {
|
if (print_bytecode) {
|
||||||
if (pos.offset + bytecount > scr_size) {
|
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++)
|
for (i = 0; i < bytecount; i++)
|
||||||
printf("%02x ", scr[pos.offset + i]);
|
debugN("%02x ", scr[pos.offset + i]);
|
||||||
|
|
||||||
for (i = bytecount; i < 5; i++)
|
for (i = bytecount; i < 5; i++)
|
||||||
printf(" ");
|
debugN(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (print_bw_tag)
|
if (print_bw_tag)
|
||||||
printf("[%c] ", opsize ? 'B' : 'W');
|
debugN("[%c] ", opsize ? 'B' : 'W');
|
||||||
|
|
||||||
printf("%s", opcodeNames[opcode]);
|
debugN("%s", opcodeNames[opcode]);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (g_opcode_formats[opcode][i]) {
|
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_SByte:
|
||||||
case Script_Byte:
|
case Script_Byte:
|
||||||
printf(" %02x", scr[retval.offset++]);
|
debugN(" %02x", scr[retval.offset++]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Script_Word:
|
case Script_Word:
|
||||||
case Script_SWord:
|
case Script_SWord:
|
||||||
printf(" %04x", READ_SCI11ENDIAN_UINT16(&scr[retval.offset]));
|
debugN(" %04x", READ_SCI11ENDIAN_UINT16(&scr[retval.offset]));
|
||||||
retval.offset += 2;
|
retval.offset += 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -148,11 +148,11 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opcode == op_callk)
|
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)]")
|
((param_value < kernel->getKernelNamesSize()) ? kernel->getKernelName(param_value).c_str() : "[Unknown(postulated)]")
|
||||||
: "<invalid>", param_value);
|
: "<invalid>", param_value);
|
||||||
else
|
else
|
||||||
printf(opsize ? " %02x" : " %04x", param_value);
|
debugN(opsize ? " %02x" : " %04x", param_value);
|
||||||
|
|
||||||
break;
|
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]);
|
param_value = READ_SCI11ENDIAN_UINT16(&scr[retval.offset]);
|
||||||
retval.offset += 2;
|
retval.offset += 2;
|
||||||
}
|
}
|
||||||
printf(opsize ? " %02x" : " %04x", param_value);
|
debugN(opsize ? " %02x" : " %04x", param_value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Script_SRelative:
|
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]);
|
param_value = READ_SCI11ENDIAN_UINT16(&scr[retval.offset]);
|
||||||
retval.offset += 2;
|
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;
|
break;
|
||||||
|
|
||||||
case Script_End:
|
case Script_End:
|
||||||
|
@ -193,11 +193,11 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod
|
||||||
if (!obj)
|
if (!obj)
|
||||||
warning("Attempted to reference on non-object at %04x:%04x", PRINT_REG(s->xs->objp));
|
warning("Attempted to reference on non-object at %04x:%04x", PRINT_REG(s->xs->objp));
|
||||||
else
|
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 (pos == s->xs->addr.pc) { // Extra information if debugging the current opcode
|
||||||
if (opcode == op_callk) {
|
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)
|
if (!oldScriptHeader)
|
||||||
argc += (s->restAdjust);
|
argc += (s->restAdjust);
|
||||||
|
|
||||||
printf(" Kernel params: (");
|
debugN(" Kernel params: (");
|
||||||
|
|
||||||
for (int j = 0; j < argc; j++) {
|
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)
|
if (j + 1 < argc)
|
||||||
printf(", ");
|
debugN(", ");
|
||||||
}
|
}
|
||||||
printf(")\n");
|
debugN(")\n");
|
||||||
} else if ((opcode == op_send) || (opcode == op_self)) {
|
} else if ((opcode == op_send) || (opcode == op_self)) {
|
||||||
int restmod = s->restAdjust;
|
int restmod = s->restAdjust;
|
||||||
int stackframe = (scr[pos.offset + 1] >> 1) + restmod;
|
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)
|
if (!name)
|
||||||
name = "<invalid>";
|
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)) {
|
switch (lookupSelector(s->_segMan, called_obj_addr, selector, 0, &fun_ref)) {
|
||||||
case kSelectorMethod:
|
case kSelectorMethod:
|
||||||
printf("FUNCT");
|
debugN("FUNCT");
|
||||||
argc += restmod;
|
argc += restmod;
|
||||||
restmod = 0;
|
restmod = 0;
|
||||||
break;
|
break;
|
||||||
case kSelectorVariable:
|
case kSelectorVariable:
|
||||||
printf("VAR");
|
debugN("VAR");
|
||||||
break;
|
break;
|
||||||
case kSelectorNone:
|
case kSelectorNone:
|
||||||
printf("INVALID");
|
debugN("INVALID");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("](");
|
debugN("](");
|
||||||
|
|
||||||
while (argc--) {
|
while (argc--) {
|
||||||
printf("%04x:%04x", PRINT_REG(sb[- stackframe + 2]));
|
debugN("%04x:%04x", PRINT_REG(sb[- stackframe + 2]));
|
||||||
if (argc)
|
if (argc)
|
||||||
printf(", ");
|
debugN(", ");
|
||||||
stackframe--;
|
stackframe--;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(")\n");
|
debugN(")\n");
|
||||||
stackframe -= 2;
|
stackframe -= 2;
|
||||||
} // while (stackframe > 0)
|
} // while (stackframe > 0)
|
||||||
} // Send-like opcodes
|
} // Send-like opcodes
|
||||||
|
@ -334,7 +334,7 @@ void SciEngine::scriptDebug() {
|
||||||
// OK, found whatever we were looking for
|
// 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);
|
disassemble(s, s->xs->addr.pc, 0, 1);
|
||||||
|
|
||||||
if (_debugState.runningStep) {
|
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 namepos = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *) data + 14 + seeker);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
printf("Object\n");
|
debugN("Object\n");
|
||||||
|
|
||||||
Common::hexdump((unsigned char *) data + seeker, objsize - 4, 16, seeker);
|
Common::hexdump((unsigned char *) data + seeker, objsize - 4, 16, seeker);
|
||||||
//-4 because the size includes the two-word header
|
//-4 because the size includes the two-word header
|
||||||
|
|
||||||
printf("Name: %s\n", namepos ? ((char *)(data + namepos)) : "<unknown>");
|
debugN("Name: %s\n", namepos ? ((char *)(data + namepos)) : "<unknown>");
|
||||||
printf("Superclass: %x\n", superclass);
|
debugN("Superclass: %x\n", superclass);
|
||||||
printf("Species: %x\n", species);
|
debugN("Species: %x\n", species);
|
||||||
printf("-info-:%x\n", (int16)READ_SCI11ENDIAN_UINT16((unsigned char *) data + 12 + seeker) & 0xffff);
|
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));
|
debugN("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("Selectors [%x]:\n", selectors = (selectorsize = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *) data + seeker + 6)));
|
||||||
|
|
||||||
seeker += 8;
|
seeker += 8;
|
||||||
|
|
||||||
while (selectors--) {
|
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;
|
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;
|
seeker += 2;
|
||||||
|
|
||||||
|
@ -382,8 +382,8 @@ void Kernel::dumpScriptObject(char *data, int seeker, int objsize) {
|
||||||
while (overloads--) {
|
while (overloads--) {
|
||||||
int selector = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *) data + (seeker));
|
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() : "<?>");
|
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;
|
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 superclass = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *) data + 10 + seeker);
|
||||||
int namepos = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *) data + 14 + 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);
|
Common::hexdump((unsigned char *) data + seeker, objsize - 4, 16, seeker);
|
||||||
|
|
||||||
printf("Name: %s\n", namepos ? ((char *)data + namepos) : "<unknown>");
|
debugN("Name: %s\n", namepos ? ((char *)data + namepos) : "<unknown>");
|
||||||
printf("Superclass: %x\n", superclass);
|
debugN("Superclass: %x\n", superclass);
|
||||||
printf("Species: %x\n", species);
|
debugN("Species: %x\n", species);
|
||||||
printf("-info-:%x\n", (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + 12 + seeker) & 0xffff);
|
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));
|
debugN("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("Selectors [%x]:\n", selectors = (selectorsize = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + seeker + 6)));
|
||||||
|
|
||||||
seeker += 8;
|
seeker += 8;
|
||||||
selectorsize <<= 1;
|
selectorsize <<= 1;
|
||||||
|
@ -413,7 +413,7 @@ void Kernel::dumpScriptClass(char *data, int seeker, int objsize) {
|
||||||
while (selectors--) {
|
while (selectors--) {
|
||||||
int selector = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *) data + (seeker) + selectorsize);
|
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);
|
(int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + seeker) & 0xffff);
|
||||||
|
|
||||||
seeker += 2;
|
seeker += 2;
|
||||||
|
@ -421,16 +421,16 @@ void Kernel::dumpScriptClass(char *data, int seeker, int objsize) {
|
||||||
|
|
||||||
seeker += selectorsize;
|
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;
|
seeker += 2;
|
||||||
|
|
||||||
while (overloads--) {
|
while (overloads--) {
|
||||||
int selector = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + (seeker));
|
int selector = (int16)READ_SCI11ENDIAN_UINT16((unsigned char *)data + (seeker));
|
||||||
fprintf(stderr, "selector=%d; selectorNames.size() =%d\n", selector, _selectorNames.size());
|
debugN("selector=%d; selectorNames.size() =%d\n", selector, _selectorNames.size());
|
||||||
printf(" [%03x] %s: @", selector & 0xffff, (selector >= 0 && selector < (int)_selectorNames.size()) ?
|
debugN(" [%03x] %s: @", selector & 0xffff, (selector >= 0 && selector < (int)_selectorNames.size()) ?
|
||||||
_selectorNames[selector].c_str() : "<?>");
|
_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;
|
seeker += 2;
|
||||||
}
|
}
|
||||||
|
@ -452,17 +452,17 @@ void Kernel::dissectScript(int scriptNumber, Vocabulary *vocab) {
|
||||||
unsigned int seeker = _seeker + 4;
|
unsigned int seeker = _seeker + 4;
|
||||||
|
|
||||||
if (!objType) {
|
if (!objType) {
|
||||||
printf("End of script object (#0) encountered.\n");
|
debugN("End of script object (#0) encountered.\n");
|
||||||
printf("Classes: %i, Objects: %i, Export: %i,\n Var: %i (all base 10)",
|
debugN("Classes: %i, Objects: %i, Export: %i,\n Var: %i (all base 10)",
|
||||||
objectctr[6], objectctr[1], objectctr[7], objectctr[10]);
|
objectctr[6], objectctr[1], objectctr[7], objectctr[10]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n");
|
debugN("\n");
|
||||||
|
|
||||||
objsize = (int16)READ_SCI11ENDIAN_UINT16(script->data + _seeker + 2);
|
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;
|
_seeker += objsize;
|
||||||
|
|
||||||
|
@ -474,28 +474,28 @@ void Kernel::dissectScript(int scriptNumber, Vocabulary *vocab) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCI_OBJ_CODE:
|
case SCI_OBJ_CODE:
|
||||||
printf("Code\n");
|
debugN("Code\n");
|
||||||
Common::hexdump(script->data + seeker, objsize - 4, 16, seeker);
|
Common::hexdump(script->data + seeker, objsize - 4, 16, seeker);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
printf("<unknown>\n");
|
debugN("<unknown>\n");
|
||||||
Common::hexdump(script->data + seeker, objsize - 4, 16, seeker);
|
Common::hexdump(script->data + seeker, objsize - 4, 16, seeker);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCI_OBJ_SAID:
|
case SCI_OBJ_SAID:
|
||||||
printf("Said\n");
|
debugN("Said\n");
|
||||||
Common::hexdump(script->data + seeker, objsize - 4, 16, seeker);
|
Common::hexdump(script->data + seeker, objsize - 4, 16, seeker);
|
||||||
|
|
||||||
printf("%04x: ", seeker);
|
debugN("%04x: ", seeker);
|
||||||
vocab->debugDecipherSaidBlock(script->data + seeker);
|
vocab->debugDecipherSaidBlock(script->data + seeker);
|
||||||
printf("\n");
|
debugN("\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCI_OBJ_STRINGS:
|
case SCI_OBJ_STRINGS:
|
||||||
printf("Strings\n");
|
debugN("Strings\n");
|
||||||
while (script->data [seeker]) {
|
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 += strlen((char *)script->data + seeker) + 1;
|
||||||
}
|
}
|
||||||
seeker++; // the ending zero byte
|
seeker++; // the ending zero byte
|
||||||
|
@ -506,33 +506,33 @@ void Kernel::dissectScript(int scriptNumber, Vocabulary *vocab) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCI_OBJ_EXPORTS:
|
case SCI_OBJ_EXPORTS:
|
||||||
printf("Exports\n");
|
debugN("Exports\n");
|
||||||
Common::hexdump((unsigned char *)script->data + seeker, objsize - 4, 16, seeker);
|
Common::hexdump((unsigned char *)script->data + seeker, objsize - 4, 16, seeker);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCI_OBJ_POINTERS:
|
case SCI_OBJ_POINTERS:
|
||||||
printf("Pointers\n");
|
debugN("Pointers\n");
|
||||||
Common::hexdump(script->data + seeker, objsize - 4, 16, seeker);
|
Common::hexdump(script->data + seeker, objsize - 4, 16, seeker);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9:
|
case 9:
|
||||||
printf("<unknown>\n");
|
debugN("<unknown>\n");
|
||||||
Common::hexdump(script->data + seeker, objsize - 4, 16, seeker);
|
Common::hexdump(script->data + seeker, objsize - 4, 16, seeker);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCI_OBJ_LOCALVARS:
|
case SCI_OBJ_LOCALVARS:
|
||||||
printf("Local vars\n");
|
debugN("Local vars\n");
|
||||||
Common::hexdump(script->data + seeker, objsize - 4, 16, seeker);
|
Common::hexdump(script->data + seeker, objsize - 4, 16, seeker);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("Unsupported!\n");
|
debugN("Unsupported!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Script ends without terminator\n");
|
debugN("Script ends without terminator\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace Sci
|
} // End of namespace Sci
|
||||||
|
|
|
@ -301,9 +301,9 @@ reg_t SegManager::findObjectByName(const Common::String &name, int index) {
|
||||||
return NULL_REG;
|
return NULL_REG;
|
||||||
|
|
||||||
if (result.size() > 1 && index < 0) {
|
if (result.size() > 1 && index < 0) {
|
||||||
printf("Ambiguous:\n");
|
debug("findObjectByName(%s): multiple matches:", name.c_str());
|
||||||
for (i = 0; i < result.size(); i++)
|
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
|
return NULL_REG; // Ambiguous
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,10 +40,10 @@ namespace Sci {
|
||||||
// The defines below can be used to construct static selector tables for games which don't have
|
// 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
|
// a vocab.997 resource, by dumping the selector table from other similar versions or games
|
||||||
#define FIND_SELECTOR(_slc_) _selectorCache._slc_ = findSelector(#_slc_); \
|
#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_); \
|
#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
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -423,7 +423,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VM_DEBUG_SEND
|
#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,
|
s->_segMan->getObjectName(send_obj), selector,
|
||||||
g_sci->getKernel()->getSelectorName(selector).c_str());
|
g_sci->getKernel()->getSelectorName(selector).c_str());
|
||||||
#endif // VM_DEBUG_SEND
|
#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
|
#ifdef VM_DEBUG_SEND
|
||||||
if (argc)
|
if (argc)
|
||||||
printf("Varselector: Write %04x:%04x\n", PRINT_REG(argp[1]));
|
debugN("Varselector: Write %04x:%04x\n", PRINT_REG(argp[1]));
|
||||||
else
|
else
|
||||||
printf("Varselector: Read\n");
|
debugN("Varselector: Read\n");
|
||||||
#endif // VM_DEBUG_SEND
|
#endif // VM_DEBUG_SEND
|
||||||
|
|
||||||
// argc == 0: read selector
|
// 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
|
#ifndef VM_DEBUG_SEND
|
||||||
if (activeBreakpointTypes & BREAK_SELECTOREXEC) {
|
if (activeBreakpointTypes & BREAK_SELECTOREXEC) {
|
||||||
if (g_sci->checkSelectorBreakpoint(BREAK_SELECTOREXEC, send_obj, selector)) {
|
if (g_sci->checkSelectorBreakpoint(BREAK_SELECTOREXEC, send_obj, selector)) {
|
||||||
printf("[execute selector]");
|
debugN("[execute selector]");
|
||||||
|
|
||||||
int displaySize = 0;
|
int displaySize = 0;
|
||||||
for (int argNr = 1; argNr <= argc; argNr++) {
|
for (int argNr = 1; argNr <= argc; argNr++) {
|
||||||
if (argNr == 1)
|
if (argNr == 1)
|
||||||
printf(" - ");
|
debugN(" - ");
|
||||||
reg_t curParam = argp[argNr];
|
reg_t curParam = argp[argNr];
|
||||||
if (curParam.segment) {
|
if (curParam.segment) {
|
||||||
printf("[%04x:%04x] ", PRINT_REG(curParam));
|
debugN("[%04x:%04x] ", PRINT_REG(curParam));
|
||||||
displaySize += 12;
|
displaySize += 12;
|
||||||
} else {
|
} else {
|
||||||
printf("[%04x] ", curParam.offset);
|
debugN("[%04x] ", curParam.offset);
|
||||||
displaySize += 7;
|
displaySize += 7;
|
||||||
}
|
}
|
||||||
if (displaySize > 50) {
|
if (displaySize > 50) {
|
||||||
if (argNr < argc)
|
if (argNr < argc)
|
||||||
printf("...");
|
debugN("...");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\n");
|
debugN("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else // VM_DEBUG_SEND
|
#else // VM_DEBUG_SEND
|
||||||
if (activeBreakpointTypes & BREAK_SELECTOREXEC)
|
if (activeBreakpointTypes & BREAK_SELECTOREXEC)
|
||||||
g_sci->checkSelectorBreakpoint(BREAK_SELECTOREXEC, send_obj, selector);
|
g_sci->checkSelectorBreakpoint(BREAK_SELECTOREXEC, send_obj, selector);
|
||||||
printf("Funcselector(");
|
debugN("Funcselector(");
|
||||||
for (int i = 0; i < argc; i++) {
|
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)
|
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
|
#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
|
// Returns new TOS element for the execution stack
|
||||||
// _localsSegment may be -1 if derived from the called object
|
// _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;
|
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) {
|
static void logKernelCall(const KernelFunction *kernelCall, const KernelSubFunction *kernelSubCall, EngineState *s, int argc, reg_t *argv, reg_t result) {
|
||||||
Kernel *kernel = g_sci->getKernel();
|
Kernel *kernel = g_sci->getKernel();
|
||||||
if (!kernelSubCall) {
|
if (!kernelSubCall) {
|
||||||
printf("k%s: ", kernelCall->name);
|
debugN("k%s: ", kernelCall->name);
|
||||||
} else {
|
} else {
|
||||||
int callNameLen = strlen(kernelCall->name);
|
int callNameLen = strlen(kernelCall->name);
|
||||||
if (strncmp(kernelCall->name, kernelSubCall->name, callNameLen) == 0) {
|
if (strncmp(kernelCall->name, kernelSubCall->name, callNameLen) == 0) {
|
||||||
const char *subCallName = kernelSubCall->name + callNameLen;
|
const char *subCallName = kernelSubCall->name + callNameLen;
|
||||||
printf("k%s(%s): ", kernelCall->name, subCallName);
|
debugN("k%s(%s): ", kernelCall->name, subCallName);
|
||||||
} else {
|
} else {
|
||||||
printf("k%s(%s): ", kernelCall->name, kernelSubCall->name);
|
debugN("k%s(%s): ", kernelCall->name, kernelSubCall->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int parmNr = 0; parmNr < argc; parmNr++) {
|
for (int parmNr = 0; parmNr < argc; parmNr++) {
|
||||||
if (parmNr)
|
if (parmNr)
|
||||||
printf(", ");
|
debugN(", ");
|
||||||
uint16 regType = kernel->findRegType(argv[parmNr]);
|
uint16 regType = kernel->findRegType(argv[parmNr]);
|
||||||
if (regType & SIG_TYPE_NULL)
|
if (regType & SIG_TYPE_NULL)
|
||||||
printf("0");
|
debugN("0");
|
||||||
else if (regType & SIG_TYPE_UNINITIALIZED)
|
else if (regType & SIG_TYPE_UNINITIALIZED)
|
||||||
printf("UNINIT");
|
debugN("UNINIT");
|
||||||
else if (regType & SIG_IS_INVALID)
|
else if (regType & SIG_IS_INVALID)
|
||||||
printf("INVALID");
|
debugN("INVALID");
|
||||||
else if (regType & SIG_TYPE_INTEGER)
|
else if (regType & SIG_TYPE_INTEGER)
|
||||||
printf("%d", argv[parmNr].offset);
|
debugN("%d", argv[parmNr].offset);
|
||||||
else {
|
else {
|
||||||
printf("%04x:%04x", PRINT_REG(argv[parmNr]));
|
debugN("%04x:%04x", PRINT_REG(argv[parmNr]));
|
||||||
switch (regType) {
|
switch (regType) {
|
||||||
case SIG_TYPE_OBJECT:
|
case SIG_TYPE_OBJECT:
|
||||||
printf(" (%s)", s->_segMan->getObjectName(argv[parmNr]));
|
debugN(" (%s)", s->_segMan->getObjectName(argv[parmNr]));
|
||||||
break;
|
break;
|
||||||
case SIG_TYPE_REFERENCE:
|
case SIG_TYPE_REFERENCE:
|
||||||
if (kernelCall->function == kSaid) {
|
if (kernelCall->function == kSaid) {
|
||||||
SegmentRef saidSpec = s->_segMan->dereference(argv[parmNr]);
|
SegmentRef saidSpec = s->_segMan->dereference(argv[parmNr]);
|
||||||
if (saidSpec.isRaw) {
|
if (saidSpec.isRaw) {
|
||||||
printf(" ('");
|
debugN(" ('");
|
||||||
g_sci->getVocabulary()->debugDecipherSaidBlock(saidSpec.raw);
|
g_sci->getVocabulary()->debugDecipherSaidBlock(saidSpec.raw);
|
||||||
printf("')");
|
debugN("')");
|
||||||
} else {
|
} else {
|
||||||
printf(" (non-raw said-spec)");
|
debugN(" (non-raw said-spec)");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
printf(" ('%s')", s->_segMan->getString(argv[parmNr]).c_str());
|
debugN(" ('%s')", s->_segMan->getString(argv[parmNr]).c_str());
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -702,9 +702,9 @@ static void logKernelCall(const KernelFunction *kernelCall, const KernelSubFunct
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result.segment)
|
if (result.segment)
|
||||||
printf(" = %04x:%04x\n", PRINT_REG(result));
|
debugN(" = %04x:%04x\n", PRINT_REG(result));
|
||||||
else
|
else
|
||||||
printf(" = %d\n", result.offset);
|
debugN(" = %d\n", result.offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) {
|
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)
|
if (kernelCall.debugLogging)
|
||||||
logKernelCall(&kernelCall, NULL, s, argc, argv, s->r_acc);
|
logKernelCall(&kernelCall, NULL, s, argc, argv, s->r_acc);
|
||||||
if (kernelCall.debugBreakpoint) {
|
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.debugging = true;
|
||||||
g_sci->_debugState.breakpointWasHit = true;
|
g_sci->_debugState.breakpointWasHit = true;
|
||||||
}
|
}
|
||||||
|
@ -804,7 +804,7 @@ static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) {
|
||||||
if (kernelSubCall.debugLogging)
|
if (kernelSubCall.debugLogging)
|
||||||
logKernelCall(&kernelCall, &kernelSubCall, s, argc, argv, s->r_acc);
|
logKernelCall(&kernelCall, &kernelSubCall, s, argc, argv, s->r_acc);
|
||||||
if (kernelSubCall.debugBreakpoint) {
|
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.debugging = true;
|
||||||
g_sci->_debugState.breakpointWasHit = 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));
|
memset(opparams, 0, sizeof(opparams));
|
||||||
|
|
||||||
for (int i = 0; g_opcode_formats[opcode][i]; ++i) {
|
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);
|
assert(i < 3);
|
||||||
switch (g_opcode_formats[opcode][i]) {
|
switch (g_opcode_formats[opcode][i]) {
|
||||||
|
|
||||||
|
|
|
@ -296,7 +296,7 @@ void GfxMenu::kernelSetAttribute(uint16 menuId, uint16 itemId, uint16 attributeI
|
||||||
itemEntry->keyPress = tolower(value.offset);
|
itemEntry->keyPress = tolower(value.offset);
|
||||||
itemEntry->keyModifier = 0;
|
itemEntry->keyModifier = 0;
|
||||||
// TODO: Find out how modifier is handled
|
// TODO: Find out how modifier is handled
|
||||||
printf("setAttr keypress %X %X\n", value.segment, value.offset);
|
debug("setAttr keypress %X %X", value.segment, value.offset);
|
||||||
break;
|
break;
|
||||||
case SCI_MENU_ATTRIBUTE_TAG:
|
case SCI_MENU_ATTRIBUTE_TAG:
|
||||||
itemEntry->tag = value.offset;
|
itemEntry->tag = value.offset;
|
||||||
|
|
|
@ -93,49 +93,49 @@ static void vocab_print_rule(ParseRule *rule) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("[%03x] -> ", rule->_id);
|
debugN("[%03x] -> ", rule->_id);
|
||||||
|
|
||||||
if (rule->_data.empty())
|
if (rule->_data.empty())
|
||||||
printf("e");
|
debugN("e");
|
||||||
|
|
||||||
for (uint i = 0; i < rule->_data.size(); i++) {
|
for (uint i = 0; i < rule->_data.size(); i++) {
|
||||||
uint token = rule->_data[i];
|
uint token = rule->_data[i];
|
||||||
|
|
||||||
if (token == TOKEN_OPAREN) {
|
if (token == TOKEN_OPAREN) {
|
||||||
if (i == rule->_firstSpecial)
|
if (i == rule->_firstSpecial)
|
||||||
printf("_");
|
debugN("_");
|
||||||
|
|
||||||
printf("(");
|
debugN("(");
|
||||||
wspace = 0;
|
wspace = 0;
|
||||||
} else if (token == TOKEN_CPAREN) {
|
} else if (token == TOKEN_CPAREN) {
|
||||||
if (i == rule->_firstSpecial)
|
if (i == rule->_firstSpecial)
|
||||||
printf("_");
|
debugN("_");
|
||||||
|
|
||||||
printf(")");
|
debugN(")");
|
||||||
wspace = 0;
|
wspace = 0;
|
||||||
} else {
|
} else {
|
||||||
if (wspace)
|
if (wspace)
|
||||||
printf(" ");
|
debugN(" ");
|
||||||
|
|
||||||
if (i == rule->_firstSpecial)
|
if (i == rule->_firstSpecial)
|
||||||
printf("_");
|
debugN("_");
|
||||||
if (token & TOKEN_TERMINAL_CLASS)
|
if (token & TOKEN_TERMINAL_CLASS)
|
||||||
printf("C(%04x)", token & 0xffff);
|
debugN("C(%04x)", token & 0xffff);
|
||||||
else if (token & TOKEN_TERMINAL_GROUP)
|
else if (token & TOKEN_TERMINAL_GROUP)
|
||||||
printf("G(%04x)", token & 0xffff);
|
debugN("G(%04x)", token & 0xffff);
|
||||||
else if (token & TOKEN_STUFFING_LEAF)
|
else if (token & TOKEN_STUFFING_LEAF)
|
||||||
printf("%03x", token & 0xffff);
|
debugN("%03x", token & 0xffff);
|
||||||
else if (token & TOKEN_STUFFING_WORD)
|
else if (token & TOKEN_STUFFING_WORD)
|
||||||
printf("{%03x}", token & 0xffff);
|
debugN("{%03x}", token & 0xffff);
|
||||||
else
|
else
|
||||||
printf("[%03x]", token); /* non-terminal */
|
debugN("[%03x]", token); /* non-terminal */
|
||||||
wspace = 1;
|
wspace = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == rule->_firstSpecial)
|
if (i == rule->_firstSpecial)
|
||||||
printf("_");
|
debugN("_");
|
||||||
}
|
}
|
||||||
printf(" [%d specials]", rule->_numSpecials);
|
debugN(" [%d specials]", rule->_numSpecials);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ParseRule *_vdup(ParseRule *a) {
|
static ParseRule *_vdup(ParseRule *a) {
|
||||||
|
@ -321,13 +321,13 @@ void ParseRuleList::print() const {
|
||||||
const ParseRuleList *list = this;
|
const ParseRuleList *list = this;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
while (list) {
|
while (list) {
|
||||||
printf("R%03d: ", pos);
|
debugN("R%03d: ", pos);
|
||||||
vocab_print_rule(list->rule);
|
vocab_print_rule(list->rule);
|
||||||
printf("\n");
|
debugN("\n");
|
||||||
list = list->next;
|
list = list->next;
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
printf("%d rules total.\n", pos);
|
debugN("%d rules total.\n", pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ParseRuleList *_vocab_split_rule_list(ParseRuleList *list) {
|
static ParseRuleList *_vocab_split_rule_list(ParseRuleList *list) {
|
||||||
|
@ -524,9 +524,9 @@ static int _vbpt_write_subexpression(ParseTreeNode *nodes, int *pos, ParseRule *
|
||||||
else
|
else
|
||||||
writepos = _vbpt_append_word(nodes, pos, writepos, token & 0xffff);
|
writepos = _vbpt_append_word(nodes, pos, writepos, token & 0xffff);
|
||||||
} else {
|
} else {
|
||||||
printf("\nError in parser (grammar.cpp, _vbpt_write_subexpression()): Rule data broken in rule ");
|
warning("\nError in parser (grammar.cpp, _vbpt_write_subexpression()): Rule data broken in rule ");
|
||||||
vocab_print_rule(rule);
|
vocab_print_rule(rule);
|
||||||
printf(", at token position %d\n", *pos);
|
debugN(", at token position %d\n", *pos);
|
||||||
return rulepos;
|
return rulepos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace Sci {
|
||||||
|
|
||||||
|
|
||||||
#ifdef SCI_DEBUG_PARSE_TREE_AUGMENTATION
|
#ifdef SCI_DEBUG_PARSE_TREE_AUGMENTATION
|
||||||
#define scidprintf printf
|
#define scidprintf debugN
|
||||||
#else
|
#else
|
||||||
void print_nothing(...) { }
|
void print_nothing(...) { }
|
||||||
#define scidprintf print_nothing
|
#define scidprintf print_nothing
|
||||||
|
|
|
@ -458,44 +458,44 @@ void Vocabulary::debugDecipherSaidBlock(const byte *addr) {
|
||||||
nextItem = *addr++;
|
nextItem = *addr++;
|
||||||
if (nextItem != 0xff) {
|
if (nextItem != 0xff) {
|
||||||
if ((!first) && (nextItem != 0xf0))
|
if ((!first) && (nextItem != 0xf0))
|
||||||
printf(" ");
|
debugN(" ");
|
||||||
first = false;
|
first = false;
|
||||||
|
|
||||||
if (nextItem < 0xf0) {
|
if (nextItem < 0xf0) {
|
||||||
nextItem = nextItem << 8 | *addr++;
|
nextItem = nextItem << 8 | *addr++;
|
||||||
printf("%s{%03x}", getAnyWordFromGroup(nextItem), nextItem);
|
debugN("%s{%03x}", getAnyWordFromGroup(nextItem), nextItem);
|
||||||
|
|
||||||
nextItem = 0; // Make sure that group 0xff doesn't abort
|
nextItem = 0; // Make sure that group 0xff doesn't abort
|
||||||
} else switch (nextItem) {
|
} else switch (nextItem) {
|
||||||
case 0xf0:
|
case 0xf0:
|
||||||
printf(",");
|
debugN(",");
|
||||||
break;
|
break;
|
||||||
case 0xf1:
|
case 0xf1:
|
||||||
printf("&");
|
debugN("&");
|
||||||
break;
|
break;
|
||||||
case 0xf2:
|
case 0xf2:
|
||||||
printf("/");
|
debugN("/");
|
||||||
break;
|
break;
|
||||||
case 0xf3:
|
case 0xf3:
|
||||||
printf("(");
|
debugN("(");
|
||||||
break;
|
break;
|
||||||
case 0xf4:
|
case 0xf4:
|
||||||
printf(")");
|
debugN(")");
|
||||||
break;
|
break;
|
||||||
case 0xf5:
|
case 0xf5:
|
||||||
printf("[");
|
debugN("[");
|
||||||
break;
|
break;
|
||||||
case 0xf6:
|
case 0xf6:
|
||||||
printf("]");
|
debugN("]");
|
||||||
break;
|
break;
|
||||||
case 0xf7:
|
case 0xf7:
|
||||||
printf("#");
|
debugN("#");
|
||||||
break;
|
break;
|
||||||
case 0xf8:
|
case 0xf8:
|
||||||
printf("<");
|
debugN("<");
|
||||||
break;
|
break;
|
||||||
case 0xf9:
|
case 0xf9:
|
||||||
printf(">");
|
debugN(">");
|
||||||
break;
|
break;
|
||||||
case 0xff:
|
case 0xff:
|
||||||
break;
|
break;
|
||||||
|
@ -611,48 +611,48 @@ void _vocab_recursive_ptree_dump(ParseTreeNode *tree, int blanks) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (tree->type == kParseTreeLeafNode) {
|
if (tree->type == kParseTreeLeafNode) {
|
||||||
printf("vocab_dump_parse_tree: Error: consp is nil\n");
|
debugN("vocab_dump_parse_tree: Error: consp is nil\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lbranch) {
|
if (lbranch) {
|
||||||
if (lbranch->type == kParseTreeBranchNode) {
|
if (lbranch->type == kParseTreeBranchNode) {
|
||||||
printf("\n");
|
debugN("\n");
|
||||||
for (i = 0; i < blanks; i++)
|
for (i = 0; i < blanks; i++)
|
||||||
printf(" ");
|
debugN(" ");
|
||||||
printf("(");
|
debugN("(");
|
||||||
_vocab_recursive_ptree_dump(lbranch, blanks + 1);
|
_vocab_recursive_ptree_dump(lbranch, blanks + 1);
|
||||||
printf(")\n");
|
debugN(")\n");
|
||||||
for (i = 0; i < blanks; i++)
|
for (i = 0; i < blanks; i++)
|
||||||
printf(" ");
|
debugN(" ");
|
||||||
} else
|
} else
|
||||||
printf("%x", lbranch->value);
|
debugN("%x", lbranch->value);
|
||||||
printf(" ");
|
debugN(" ");
|
||||||
}/* else printf ("nil");*/
|
}/* else debugN ("nil");*/
|
||||||
|
|
||||||
if (rbranch) {
|
if (rbranch) {
|
||||||
if (rbranch->type == kParseTreeBranchNode)
|
if (rbranch->type == kParseTreeBranchNode)
|
||||||
_vocab_recursive_ptree_dump(rbranch, blanks);
|
_vocab_recursive_ptree_dump(rbranch, blanks);
|
||||||
else {
|
else {
|
||||||
printf("%x", rbranch->value);
|
debugN("%x", rbranch->value);
|
||||||
while (rbranch->right) {
|
while (rbranch->right) {
|
||||||
rbranch = rbranch->right;
|
rbranch = rbranch->right;
|
||||||
printf("/%x", rbranch->value);
|
debugN("/%x", rbranch->value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}/* else printf("nil");*/
|
}/* else debugN("nil");*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void vocab_dump_parse_tree(const char *tree_name, ParseTreeNode *nodes) {
|
void vocab_dump_parse_tree(const char *tree_name, ParseTreeNode *nodes) {
|
||||||
printf("(setq %s \n'(", tree_name);
|
debugN("(setq %s \n'(", tree_name);
|
||||||
_vocab_recursive_ptree_dump(nodes, 1);
|
_vocab_recursive_ptree_dump(nodes, 1);
|
||||||
printf("))\n");
|
debugN("))\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Vocabulary::dumpParseTree() {
|
void Vocabulary::dumpParseTree() {
|
||||||
printf("(setq parse-tree \n'(");
|
debugN("(setq parse-tree \n'(");
|
||||||
_vocab_recursive_ptree_dump(_parserNodes, 1);
|
_vocab_recursive_ptree_dump(_parserNodes, 1);
|
||||||
printf("))\n");
|
debugN("))\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Vocabulary::synonymizeTokens(ResultWordListList &words) {
|
void Vocabulary::synonymizeTokens(ResultWordListList &words) {
|
||||||
|
|
|
@ -243,7 +243,7 @@ public:
|
||||||
ParseRuleList *buildGNF(bool verbose = false);
|
ParseRuleList *buildGNF(bool verbose = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deciphers a said block and dumps its content via printf.
|
* Deciphers a said block and dumps its content via debugN.
|
||||||
* For debugging only.
|
* For debugging only.
|
||||||
* @param pos pointer to the data to dump
|
* @param pos pointer to the data to dump
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -940,7 +940,7 @@ void ResourceManager::freeOldResources() {
|
||||||
removeFromLRU(goner);
|
removeFromLRU(goner);
|
||||||
goner->unalloc();
|
goner->unalloc();
|
||||||
#ifdef SCI_VERBOSE_RESMAN
|
#ifdef SCI_VERBOSE_RESMAN
|
||||||
printf("resMan-debug: LRU: Freeing %s.%03d (%d bytes)\n", getResourceTypeName(goner->type), goner->number, goner->size);
|
debug("resMan-debug: LRU: Freeing %s.%03d (%d bytes)", getResourceTypeName(goner->type), goner->number, goner->size);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,7 +288,7 @@ void MidiDriver_AmigaMac::playInstrument(int16 *dest, Voice *channel, int count)
|
||||||
void MidiDriver_AmigaMac::changeInstrument(int channel, int instrument) {
|
void MidiDriver_AmigaMac::changeInstrument(int channel, int instrument) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (_bank.instruments[instrument][0])
|
if (_bank.instruments[instrument][0])
|
||||||
printf("[sfx:seq:amiga] Setting channel %i to \"%s\" (%i)\n", channel, _bank.instruments[instrument]->name, instrument);
|
debugN("[sfx:seq:amiga] Setting channel %i to \"%s\" (%i)\n", channel, _bank.instruments[instrument]->name, instrument);
|
||||||
else
|
else
|
||||||
warning("[sfx:seq:amiga] instrument %i does not exist (channel %i)", instrument, channel);
|
warning("[sfx:seq:amiga] instrument %i does not exist (channel %i)", instrument, channel);
|
||||||
#endif
|
#endif
|
||||||
|
@ -488,13 +488,13 @@ MidiDriver_AmigaMac::InstrumentSample *MidiDriver_AmigaMac::readInstrumentSCI0(C
|
||||||
instrument->name[29] = 0;
|
instrument->name[29] = 0;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("[sfx:seq:amiga] Reading instrument %i: \"%s\" (%i bytes)\n",
|
debugN("[sfx:seq:amiga] Reading instrument %i: \"%s\" (%i bytes)\n",
|
||||||
*id, instrument->name, size);
|
*id, instrument->name, size);
|
||||||
printf(" Mode: %02x\n", instrument->mode);
|
debugN(" Mode: %02x\n", instrument->mode);
|
||||||
printf(" Looping: %s\n", instrument->mode & kModeLoop ? "on" : "off");
|
debugN(" Looping: %s\n", instrument->mode & kModeLoop ? "on" : "off");
|
||||||
printf(" Pitch changes: %s\n", instrument->mode & kModePitch ? "on" : "off");
|
debugN(" Pitch changes: %s\n", instrument->mode & kModePitch ? "on" : "off");
|
||||||
printf(" Segment sizes: %i %i %i\n", seg_size[0], seg_size[1], seg_size[2]);
|
debugN(" Segment sizes: %i %i %i\n", seg_size[0], seg_size[1], seg_size[2]);
|
||||||
printf(" Segment offsets: 0 %i %i\n", loop_offset, read_int32(header + 43));
|
debugN(" Segment offsets: 0 %i %i\n", loop_offset, read_int32(header + 43));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
instrument->samples = (int8 *) malloc(size + 1);
|
instrument->samples = (int8 *) malloc(size + 1);
|
||||||
|
@ -745,7 +745,7 @@ bool MidiDriver_AmigaMac::loadInstrumentsSCI0(Common::File &file) {
|
||||||
strncpy(_bank.name, (char *) header + 8, 29);
|
strncpy(_bank.name, (char *) header + 8, 29);
|
||||||
_bank.name[29] = 0;
|
_bank.name[29] = 0;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("[sfx:seq:amiga] Reading %i instruments from bank \"%s\"\n", _bank.size, _bank.name);
|
debugN("[sfx:seq:amiga] Reading %i instruments from bank \"%s\"\n", _bank.size, _bank.name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (uint i = 0; i < _bank.size; i++) {
|
for (uint i = 0; i < _bank.size; i++) {
|
||||||
|
@ -784,7 +784,7 @@ bool MidiDriver_AmigaMac::loadInstrumentsSCI0Mac(Common::SeekableReadStream &fil
|
||||||
strncpy(_bank.name, (char *) header + 8, 29);
|
strncpy(_bank.name, (char *) header + 8, 29);
|
||||||
_bank.name[29] = 0;
|
_bank.name[29] = 0;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("[sfx:seq:amiga] Reading %i instruments from bank \"%s\"\n", _bank.size, _bank.name);
|
debugN("[sfx:seq:amiga] Reading %i instruments from bank \"%s\"\n", _bank.size, _bank.name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Common::Array<uint32> instrumentOffsets;
|
Common::Array<uint32> instrumentOffsets;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue