aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorFilippos Karapetis2010-06-25 12:15:36 +0000
committerFilippos Karapetis2010-06-25 12:15:36 +0000
commit279da6ac48c1d68d724cbb46e560a7439be8a4d8 (patch)
tree26d2ad51640ded39465c3c040c069cf82fbf7f98 /engines/sci/engine
parentc6b0a5e8962297cfd808c708ff3e1022a875fd18 (diff)
downloadscummvm-rg350-279da6ac48c1d68d724cbb46e560a7439be8a4d8.tar.gz
scummvm-rg350-279da6ac48c1d68d724cbb46e560a7439be8a4d8.tar.bz2
scummvm-rg350-279da6ac48c1d68d724cbb46e560a7439be8a4d8.zip
Added workarounds for two issues which appear when throwing the water at Orat in SQ1, room 28
svn-id: r50262
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/vm.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 87280d1f9b..5f59e5c547 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -931,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;
@@ -1051,6 +1059,11 @@ void run_vm(EngineState *s, bool restoring) {
if (r_temp.segment != s->r_acc.segment)
warning("[VM] Comparing pointers in different segments (%04x:%04x vs. %04x:%04x)", PRINT_REG(r_temp), PRINT_REG(s->r_acc));
s->r_acc = make_reg(0, (r_temp.segment == s->r_acc.segment) && r_temp.offset > s->r_acc.offset);
+ } else if (r_temp.segment && !s->r_acc.segment) {
+ // Happens in SQ1, room 28, when throwing the water at Orat
+ // WORKAROUND: return false
+ warning("[VM] op_gt_: comparison between a pointer and a number");
+ s->r_acc = NULL_REG;
} else
s->r_acc = ACC_ARITHMETIC_L(signed_validate_arithmetic(r_temp) > (int16)/*acc*/);
break;