aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/vm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine/vm.cpp')
-rw-r--r--engines/sci/engine/vm.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 499574957e..274b0bbbc9 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -42,7 +42,7 @@ const reg_t NULL_REG = {0, 0};
const reg_t SIGNAL_REG = {0, SIGNAL_OFFSET};
const reg_t TRUE_REG = {0, 1};
//#define VM_DEBUG_SEND
-// Enable the define below to have the VM abort on cases where a conditional
+// Enable the define below to have the VM abort on cases where a conditional
// statement is followed by an unconditional jump (which will most likely lead
// to an infinite loop). Aids in detecting script bugs such as #3040722.
//#define ABORT_ON_INFINITE_LOOP
@@ -130,16 +130,16 @@ static reg_t read_var(EngineState *s, int type, int index) {
if (solution.type == WORKAROUND_NONE) {
#ifdef RELEASE_BUILD
// If we are running an official ScummVM release -> fake 0 in unknown cases
- warning("Uninitialized read for temp %d from method %s::%s (script %d, room %d, localCall %x)",
- index, originReply.objectName.c_str(), originReply.methodName.c_str(), originReply.scriptNr,
- g_sci->getEngineState()->currentRoomNumber(), originReply.localCallOffset);
+ warning("Uninitialized read for temp %d from method %s::%s (room %d, script %d, localCall %x)",
+ index, originReply.objectName.c_str(), originReply.methodName.c_str(), s->currentRoomNumber(),
+ originReply.scriptNr, originReply.localCallOffset);
s->variables[type][index] = NULL_REG;
break;
#else
- error("Uninitialized read for temp %d from method %s::%s (script %d, room %d, localCall %x)",
- index, originReply.objectName.c_str(), originReply.methodName.c_str(), originReply.scriptNr,
- g_sci->getEngineState()->currentRoomNumber(), originReply.localCallOffset);
+ error("Uninitialized read for temp %d from method %s::%s (room %d, script %d, localCall %x)",
+ index, originReply.objectName.c_str(), originReply.methodName.c_str(), s->currentRoomNumber(),
+ originReply.scriptNr, originReply.localCallOffset);
#endif
}
assert(solution.type == WORKAROUND_FAKE);
@@ -366,9 +366,9 @@ static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) {
switch (solution.type) {
case WORKAROUND_NONE:
kernel->signatureDebug(kernelCall.signature, argc, argv);
- error("[VM] k%s[%x]: signature mismatch via method %s::%s (script %d, room %d, localCall 0x%x)",
- kernelCall.name, kernelCallNr, originReply.objectName.c_str(), originReply.methodName.c_str(),
- originReply.scriptNr, s->currentRoomNumber(), originReply.localCallOffset);
+ error("[VM] k%s[%x]: signature mismatch via method %s::%s (room %d, script %d, localCall 0x%x)",
+ kernelCall.name, kernelCallNr, originReply.objectName.c_str(), originReply.methodName.c_str(),
+ s->currentRoomNumber(), originReply.scriptNr, originReply.localCallOffset);
break;
case WORKAROUND_IGNORE: // don't do kernel call, leave acc alone
return;
@@ -418,13 +418,13 @@ static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) {
int callNameLen = strlen(kernelCall.name);
if (strncmp(kernelCall.name, kernelSubCall.name, callNameLen) == 0) {
const char *subCallName = kernelSubCall.name + callNameLen;
- error("[VM] k%s(%s): signature mismatch via method %s::%s (script %d, room %d, localCall %x)",
- kernelCall.name, subCallName, originReply.objectName.c_str(), originReply.methodName.c_str(),
- originReply.scriptNr, s->currentRoomNumber(), originReply.localCallOffset);
+ error("[VM] k%s(%s): signature mismatch via method %s::%s (room %d, script %d, localCall %x)",
+ kernelCall.name, subCallName, originReply.objectName.c_str(), originReply.methodName.c_str(),
+ s->currentRoomNumber(), originReply.scriptNr, originReply.localCallOffset);
}
- error("[VM] k%s: signature mismatch via method %s::%s (script %d, room %d, localCall %x)",
- kernelSubCall.name, originReply.objectName.c_str(), originReply.methodName.c_str(),
- originReply.scriptNr, s->currentRoomNumber(), originReply.localCallOffset);
+ error("[VM] k%s: signature mismatch via method %s::%s (room %d, script %d, localCall %x)",
+ kernelSubCall.name, originReply.objectName.c_str(), originReply.methodName.c_str(),
+ s->currentRoomNumber(), originReply.scriptNr, originReply.localCallOffset);
break;
}
case WORKAROUND_IGNORE: // don't do kernel call, leave acc alone
@@ -462,7 +462,7 @@ int readPMachineInstruction(const byte *src, byte &extOpcode, int16 opparams[4])
extOpcode = src[offset++]; // Get "extended" opcode (lower bit has special meaning)
const byte opcode = extOpcode >> 1; // get the actual opcode
- memset(opparams, 0, sizeof(opparams));
+ memset(opparams, 0, 4*sizeof(int16));
for (int i = 0; g_opcode_formats[opcode][i]; ++i) {
//debugN("Opcode: 0x%x, Opnumber: 0x%x, temp: %d\n", opcode, opcode, temp);
@@ -828,10 +828,10 @@ void run_vm(EngineState *s) {
uint16 localCallOffset = s->xs->addr.pc.offset + opparams[0];
- ExecStack xstack(s->xs->objp, s->xs->objp, s->xs->sp,
+ ExecStack xstack(s->xs->objp, s->xs->objp, s->xs->sp,
(call_base->requireUint16()) + s->r_rest, call_base,
s->xs->local_segment, make_reg(s->xs->addr.pc.segment, localCallOffset),
- NULL_SELECTOR, -1, localCallOffset, s->_executionStack.size() - 1,
+ NULL_SELECTOR, -1, localCallOffset, s->_executionStack.size() - 1,
EXEC_STACK_TYPE_CALL);
s->_executionStack.push_back(xstack);