aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/selector.cpp10
-rw-r--r--engines/sci/engine/state.h4
-rw-r--r--engines/sci/engine/vm.cpp27
-rw-r--r--engines/sci/engine/vm_types.cpp5
-rw-r--r--engines/sci/graphics/celobj32.cpp2
-rw-r--r--engines/sci/graphics/paint16.cpp4
6 files changed, 21 insertions, 31 deletions
diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp
index 79126553d9..3ae902215c 100644
--- a/engines/sci/engine/selector.cpp
+++ b/engines/sci/engine/selector.cpp
@@ -227,12 +227,12 @@ void writeSelector(SegManager *segMan, reg_t object, Selector selectorId, reg_t
if ((selectorId < 0) || (selectorId > (int)g_sci->getKernel()->getSelectorNamesSize())) {
const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
- error("Attempt to write to invalid selector %d. Address %04x:%04x, method %s::%s (room %d, script %d, localCall %x)", selectorId, PRINT_REG(object), origin.objectName.c_str(), origin.methodName.c_str(), origin.roomNr, origin.scriptNr, origin.localCallOffset);
+ error("Attempt to write to invalid selector %d. Address %04x:%04x, %s", selectorId, PRINT_REG(object), origin.toString().c_str());
}
if (lookupSelector(segMan, object, selectorId, &address, NULL) != kSelectorVariable) {
const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
- error("Selector '%s' of object could not be written to. Address %04x:%04x, method %s::%s (room %d, script %d, localCall %x)", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object), origin.objectName.c_str(), origin.methodName.c_str(), origin.roomNr, origin.scriptNr, origin.localCallOffset);
+ error("Selector '%s' of object could not be written to. Address %04x:%04x, %s", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object), origin.toString().c_str());
} else {
*address.getPointer(segMan) = value;
#ifdef ENABLE_SCI32
@@ -255,11 +255,11 @@ void invokeSelector(EngineState *s, reg_t object, int selectorId,
if (slc_type == kSelectorNone) {
const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
- error("invokeSelector: Selector '%s' could not be invoked. Address %04x:%04x, method %s::%s (room %d, script %d, localCall %x)", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object), origin.objectName.c_str(), origin.methodName.c_str(), origin.roomNr, origin.scriptNr, origin.localCallOffset);
+ error("invokeSelector: Selector '%s' could not be invoked. Address %04x:%04x, %s", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object), origin.toString().c_str());
}
if (slc_type == kSelectorVariable) {
const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
- error("invokeSelector: Attempting to invoke variable selector %s. Address %04x:%04x, method %s::%s (room %d, script %d, localCall %x)", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object), origin.objectName.c_str(), origin.methodName.c_str(), origin.roomNr, origin.scriptNr, origin.localCallOffset);
+ error("invokeSelector: Attempting to invoke variable selector %s. Address %04x:%04x, %s", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object), origin.toString().c_str());
}
for (i = 0; i < argc; i++)
@@ -288,7 +288,7 @@ SelectorType lookupSelector(SegManager *segMan, reg_t obj_location, Selector sel
if (!obj) {
const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
- error("lookupSelector: Attempt to send to non-object or invalid script. Address %04x:%04x, method %s::%s (room %d, script %d, localCall %x)", PRINT_REG(obj_location), origin.objectName.c_str(), origin.methodName.c_str(), origin.roomNr, origin.scriptNr, origin.localCallOffset);
+ error("lookupSelector: Attempt to send to non-object or invalid script. Address %04x:%04x, %s", PRINT_REG(obj_location), origin.toString().c_str());
}
index = obj->locateVarSelector(segMan, selectorId);
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index 36ae784260..5297a176d3 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -104,6 +104,10 @@ struct SciCallOrigin {
Common::String methodName; //< The name of the method being called
int localCallOffset; //< The byte offset of a local script subroutine called by the origin method. -1 if not in a local subroutine.
int roomNr; //< The room that was loaded at the time of the call
+
+ Common::String toString() const {
+ return Common::String::format("method %s::%s (room %d, script %d, localCall %x)", objectName.c_str(), methodName.c_str(), roomNr, scriptNr, localCallOffset);
+ }
};
struct EngineState : public Common::Serializable {
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index c0334f52ad..9d8c5f7fc6 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -129,16 +129,12 @@ 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 (room %d, script %d, localCall %x)",
- index, originReply.objectName.c_str(), originReply.methodName.c_str(), s->currentRoomNumber(),
- originReply.scriptNr, originReply.localCallOffset);
+ warning("Uninitialized read for temp %d from %s", index, originReply.toString().c_str());
s->variables[type][index] = NULL_REG;
break;
#else
- 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);
+ error("Uninitialized read for temp %d from %s", index, originReply.toString().c_str());
#endif
}
assert(solution.type == WORKAROUND_FAKE);
@@ -367,10 +363,7 @@ static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) {
case WORKAROUND_NONE: {
Common::String signatureDetailsStr;
kernel->signatureDebug(signatureDetailsStr, kernelCall.signature, argc, argv);
- error("\n%s[VM] k%s[%x]: signature mismatch in method %s::%s (room %d, script %d, localCall 0x%x)",
- signatureDetailsStr.c_str(),
- kernelCall.name, kernelCallNr, originReply.objectName.c_str(), originReply.methodName.c_str(),
- s->currentRoomNumber(), originReply.scriptNr, originReply.localCallOffset);
+ error("\n%s[VM] k%s[%x]: signature mismatch in %s", signatureDetailsStr.c_str(), kernelCall.name, kernelCallNr, originReply.toString().c_str());
break;
}
case WORKAROUND_IGNORE: // don't do kernel call, leave acc alone
@@ -438,15 +431,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("\n%s[VM] k%s(%s): signature mismatch in method %s::%s (room %d, script %d, localCall %x)",
- signatureDetailsStr.c_str(),
- kernelCall.name, subCallName, originReply.objectName.c_str(), originReply.methodName.c_str(),
- s->currentRoomNumber(), originReply.scriptNr, originReply.localCallOffset);
+ error("\n%s[VM] k%s(%s): signature mismatch in %s",
+ signatureDetailsStr.c_str(), kernelCall.name, subCallName,
+ originReply.toString().c_str());
}
- error("\n%s[VM] k%s: signature mismatch in method %s::%s (room %d, script %d, localCall %x)",
- signatureDetailsStr.c_str(),
- kernelSubCall.name, originReply.objectName.c_str(), originReply.methodName.c_str(),
- s->currentRoomNumber(), originReply.scriptNr, originReply.localCallOffset);
+ error("\n%s[VM] k%s: signature mismatch in %s",
+ signatureDetailsStr.c_str(), kernelSubCall.name,
+ originReply.toString().c_str());
break;
}
case WORKAROUND_IGNORE: // don't do kernel call, leave acc alone
diff --git a/engines/sci/engine/vm_types.cpp b/engines/sci/engine/vm_types.cpp
index 1076863ea5..b2e250ab8b 100644
--- a/engines/sci/engine/vm_types.cpp
+++ b/engines/sci/engine/vm_types.cpp
@@ -69,10 +69,7 @@ reg_t reg_t::lookForWorkaround(const reg_t right, const char *operation) const {
SciCallOrigin originReply;
SciWorkaroundSolution solution = trackOriginAndFindWorkaround(0, arithmeticWorkarounds, &originReply);
if (solution.type == WORKAROUND_NONE)
- error("Invalid arithmetic operation (%s - params: %04x:%04x and %04x:%04x) from method %s::%s (room %d, script %d, localCall %x)",
- operation, PRINT_REG(*this), PRINT_REG(right), originReply.objectName.c_str(),
- originReply.methodName.c_str(), g_sci->getEngineState()->currentRoomNumber(), originReply.scriptNr,
- originReply.localCallOffset);
+ error("Invalid arithmetic operation (%s - params: %04x:%04x and %04x:%04x) from %s", operation, PRINT_REG(*this), PRINT_REG(right), originReply.toString().c_str());
assert(solution.type == WORKAROUND_FAKE);
return make_reg(0, solution.value);
}
diff --git a/engines/sci/graphics/celobj32.cpp b/engines/sci/graphics/celobj32.cpp
index e5149246e4..5aa6ea3fb3 100644
--- a/engines/sci/graphics/celobj32.cpp
+++ b/engines/sci/graphics/celobj32.cpp
@@ -824,7 +824,7 @@ int16 CelObjView::getNumCels(const GuiResourceId viewId, const int16 loopNo) {
SciWorkaroundSolution solution = trackOriginAndFindWorkaround(0, kNumCels_workarounds, &origin);
switch (solution.type) {
case WORKAROUND_NONE:
- error("[CelObjView::getNumCels]: loop number is equal to loop count in method %s::%s (room %d, script %d, localCall %x)", origin.objectName.c_str(), origin.methodName.c_str(), origin.roomNr, origin.scriptNr, origin.localCallOffset);
+ error("[CelObjView::getNumCels]: loop number is equal to loop count in %s", origin.toString().c_str());
case WORKAROUND_FAKE:
return (int16)solution.value;
case WORKAROUND_IGNORE:
diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp
index 53449fbeb4..aac922d278 100644
--- a/engines/sci/graphics/paint16.cpp
+++ b/engines/sci/graphics/paint16.cpp
@@ -544,9 +544,7 @@ reg_t GfxPaint16::kernelDisplay(const char *text, uint16 languageSplitter, int a
SciCallOrigin originReply;
SciWorkaroundSolution solution = trackOriginAndFindWorkaround(0, kDisplay_workarounds, &originReply);
if (solution.type == WORKAROUND_NONE)
- error("Unknown kDisplay argument (%04x:%04x) from method %s::%s (script %d, localCall %x)",
- PRINT_REG(displayArg), originReply.objectName.c_str(), originReply.methodName.c_str(),
- originReply.scriptNr, originReply.localCallOffset);
+ error("Unknown kDisplay argument (%04x:%04x) from %s", PRINT_REG(displayArg), originReply.toString().c_str());
assert(solution.type == WORKAROUND_IGNORE);
break;
}