From 279da6ac48c1d68d724cbb46e560a7439be8a4d8 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 25 Jun 2010 12:15:36 +0000 Subject: Added workarounds for two issues which appear when throwing the water at Orat in SQ1, room 28 svn-id: r50262 --- engines/sci/engine/vm.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'engines/sci/engine') 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; -- cgit v1.2.3