aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorLars Skovlund2010-11-17 20:29:10 +0000
committerLars Skovlund2010-11-17 20:29:10 +0000
commit5ab823b16a78de112df27ee1cfdd75dc9609f3f1 (patch)
treea33c5fbb8f8fdedeb977f4d30f9f0696f9f0e4bf /engines/sci/engine
parentecb42156ce6f4530f3e5fcaec68544d2ab552565 (diff)
downloadscummvm-rg350-5ab823b16a78de112df27ee1cfdd75dc9609f3f1.tar.gz
scummvm-rg350-5ab823b16a78de112df27ee1cfdd75dc9609f3f1.tar.bz2
scummvm-rg350-5ab823b16a78de112df27ee1cfdd75dc9609f3f1.zip
SCI3: relocate operand of the lofsa opcode
svn-id: r54301
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/script.h12
-rw-r--r--engines/sci/engine/vm.cpp4
2 files changed, 9 insertions, 7 deletions
diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h
index 313f53600c..2d17dde5d4 100644
--- a/engines/sci/engine/script.h
+++ b/engines/sci/engine/script.h
@@ -248,6 +248,12 @@ public:
*/
void syncStringHeap(Common::Serializer &ser);
+ /**
+ * Resolve a relocation in an SCI3 script
+ * @param offset The offset to relocate from
+ */
+ int relocateOffsetSci3(uint32 offset);
+
private:
/**
* Processes a relocation block within a SCI0-SCI2.1 script
@@ -268,12 +274,6 @@ private:
bool relocateLocal(SegmentId segment, int location);
/**
- * Resolve a relocation in an SCI3 script
- * @param offset The offset to relocate from
- */
- int relocateOffsetSci3(uint32 offset);
-
- /**
* Gets a pointer to the beginning of the objects in a SCI3 script
*/
const byte *getSci3ObjectsPointer();
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 9d08b55546..5f506d3624 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -1738,7 +1738,9 @@ void run_vm(EngineState *s) {
s->r_acc.offset = opparams[0] + local_script->getScriptSize();
break;
case SCI_VERSION_3:
- s->r_acc.offset = opparams[0];
+ // In theory this can break if the variant with a one-byte argument is
+ // used. For now, assume it doesn't happen.
+ s->r_acc.offset = local_script->relocateOffsetSci3(s->xs->addr.pc.offset-2);
break;
default:
error("Unknown lofs type");