aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2009-07-07 07:51:26 +0000
committerFilippos Karapetis2009-07-07 07:51:26 +0000
commite4f6330418d0261c5270d178c39412b8a850c6b7 (patch)
tree1e14a568d1bc949172930578c918c63b9ec3c831
parent45b7e5bbc2ef9d70b004d5c341334f92448c373d (diff)
downloadscummvm-rg350-e4f6330418d0261c5270d178c39412b8a850c6b7.tar.gz
scummvm-rg350-e4f6330418d0261c5270d178c39412b8a850c6b7.tar.bz2
scummvm-rg350-e4f6330418d0261c5270d178c39412b8a850c6b7.zip
Added a SCI1.1 case in the lofss opcode, like in the lofsa opcode (essentially, lofss and lofsa both load an offset, with lofsa loading it in the accumulator and lofss in the stack). lofss is rarely used in SCI1.1 games, which explains why no lofss-related crashes have been observed in SCI1.1
svn-id: r42209
-rw-r--r--engines/sci/engine/vm.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 09ed541d17..b3852f10ef 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -1211,10 +1211,15 @@ void run_vm(EngineState *s, int restoring) {
case 0x3a: // lofss
r_temp.segment = xs->addr.pc.segment;
- if (s->_kernel->hasLofsAbsolute())
- r_temp.offset = opparams[0];
- else
- r_temp.offset = xs->addr.pc.offset + opparams[0];
+ if (s->_version >= SCI_VERSION_1_1) {
+ r_temp.offset = opparams[0] + local_script->script_size;
+ } else {
+ if (s->_kernel->hasLofsAbsolute())
+ r_temp.offset = opparams[0];
+ else
+ r_temp.offset = xs->addr.pc.offset + opparams[0];
+ }
+
#ifndef DISABLE_VALIDATIONS
if (r_temp.offset >= code_buf_size) {
error("VM: lofss operation overflowed: %04x:%04x beyond end"