aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorFilippos Karapetis2010-06-25 12:43:43 +0000
committerFilippos Karapetis2010-06-25 12:43:43 +0000
commit494a7fa8abc41915b70f37047149e23fa1980e25 (patch)
tree7ec399dc150370df057d93033bc630f78292585c /engines/sci/engine
parent279da6ac48c1d68d724cbb46e560a7439be8a4d8 (diff)
downloadscummvm-rg350-494a7fa8abc41915b70f37047149e23fa1980e25.tar.gz
scummvm-rg350-494a7fa8abc41915b70f37047149e23fa1980e25.tar.bz2
scummvm-rg350-494a7fa8abc41915b70f37047149e23fa1980e25.zip
Extended validate_read_var to check for parameters too, and fixed the uninitialized variable in SQ1 there
svn-id: r50263
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/vm.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 5f59e5c547..d9758650ea 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -197,12 +197,13 @@ struct UninitializedReadWorkaround {
{ "lsl1sci", 720, "rm720", "init", 0, 0 }, // age check room
{ "islandbrain", 140, "piece", "init", 3, 1 }, // some initialization variable. bnt is done on it, and it should be non-0
{ "sq4", 928, "Narrator", "startText", 1000, 1 }, // sq4cd: method returns this to the caller
+ { "sq1sci", 992, "CT", "init", 3, 0 }, // is used as cel number
{ NULL, -1, NULL, NULL, 0, 0 }
};
static reg_t validate_read_var(reg_t *r, reg_t *stack_base, int type, int max, int index, int line, reg_t default_value) {
if (validate_variable(r, stack_base, type, max, index, line)) {
- if (type == VAR_TEMP && r[index].segment == 0xffff) {
+ if ((type == VAR_TEMP || type == VAR_PARAM) && r[index].segment == 0xffff) {
// Uninitialized read on a temp
// We need to find correct replacements for each situation manually
EngineState *state = g_sci->getEngineState();
@@ -234,7 +235,8 @@ static reg_t validate_read_var(reg_t *r, reg_t *stack_base, int type, int max, i
}
workaround++;
}
- error("Uninitialized read for temp %d from method %s::%s (script %d)", index, curObjectName.c_str(), curMethodName.c_str(), curScriptNr);
+ Common::String varType = (type == VAR_TEMP) ? "temp" : "param";
+ error("Uninitialized read for %s %d from method %s::%s (script %d)", varType.c_str(), index, curObjectName.c_str(), curMethodName.c_str(), curScriptNr);
}
return r[index];
} else
@@ -931,14 +933,6 @@ void run_vm(EngineState *s, bool restoring) {
case op_add: // 0x01 (01)
r_temp = POP32();
-
- // Happens in SQ1, room 28, when throwing the water at Orat
- if (s->r_acc.segment == 0xFFFF) {
- // WORKAROUND: init uninitialized variable to 0
- warning("op_add: attempt to write to uninitialized variable");
- s->r_acc = NULL_REG;
- }
-
if (r_temp.segment || s->r_acc.segment) {
reg_t r_ptr = NULL_REG;
int offset;