diff options
-rw-r--r-- | engines/sci/engine/script.h | 12 | ||||
-rw-r--r-- | engines/sci/engine/vm.cpp | 4 |
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"); |