aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2010-06-25 15:28:24 +0000
committerFilippos Karapetis2010-06-25 15:28:24 +0000
commite55686590e2ca6a6e7eeca7a73def9dd3a0722c9 (patch)
tree482a5bd26f54588eb5da1d3b5c35066d8236160c /engines/sci
parent159958fbe233c1b58b4df4cd3fcacffd9d40f7c2 (diff)
downloadscummvm-rg350-e55686590e2ca6a6e7eeca7a73def9dd3a0722c9.tar.gz
scummvm-rg350-e55686590e2ca6a6e7eeca7a73def9dd3a0722c9.tar.bz2
scummvm-rg350-e55686590e2ca6a6e7eeca7a73def9dd3a0722c9.zip
Removed the checking of parameters again (it's wrong, as it happens after, instead of before) and restored the workaround for SQ1 in op_add again
svn-id: r50268
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/vm.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index a5cacf40b3..fa97dcf718 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -197,13 +197,12 @@ 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 || type == VAR_PARAM) && r[index].segment == 0xffff) {
+ if (type == VAR_TEMP && r[index].segment == 0xffff) {
// Uninitialized read on a temp
// We need to find correct replacements for each situation manually
EngineState *state = g_sci->getEngineState();
@@ -235,8 +234,7 @@ static reg_t validate_read_var(reg_t *r, reg_t *stack_base, int type, int max, i
}
workaround++;
}
- 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);
+ error("Uninitialized read for temp %d from method %s::%s (script %d)", index, curObjectName.c_str(), curMethodName.c_str(), curScriptNr);
}
return r[index];
} else
@@ -933,6 +931,14 @@ 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;