aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/savegame.cpp
diff options
context:
space:
mode:
authorWalter van Niftrik2009-09-03 11:51:18 +0000
committerWalter van Niftrik2009-09-03 11:51:18 +0000
commitac078040e1739d29ddc64f85241a238ed3099b54 (patch)
treef7105b9aa2091db46781951c81654aa86e3c57f0 /engines/sci/engine/savegame.cpp
parent557aaab0e6148daaf8bdc896ec64f2a37cc6f8bb (diff)
downloadscummvm-rg350-ac078040e1739d29ddc64f85241a238ed3099b54.tar.gz
scummvm-rg350-ac078040e1739d29ddc64f85241a238ed3099b54.tar.bz2
scummvm-rg350-ac078040e1739d29ddc64f85241a238ed3099b54.zip
SCI: Relocate export table when restoring SCI1.1 savegames
svn-id: r43916
Diffstat (limited to 'engines/sci/engine/savegame.cpp')
-rw-r--r--engines/sci/engine/savegame.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 9812a16ab8..3f785c3a13 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -543,8 +543,10 @@ static void load_script(EngineState *s, SegmentId seg) {
heap = s->resMan->findResource(ResourceId(kResourceTypeHeap, scr->nr), 0);
memcpy(scr->buf, script->data, script->size);
- if (s->resMan->sciVersion() == SCI_VERSION_1_1)
- memcpy(scr->buf + scr->script_size, heap->data, heap->size);
+ if (s->resMan->sciVersion() >= SCI_VERSION_1_1) {
+ scr->heap_start = scr->buf + scr->script_size;
+ memcpy(scr->heap_start, heap->data, heap->size);
+ }
}
// FIXME: The following should likely become a SegManager method
@@ -563,11 +565,12 @@ static void reconstruct_scripts(EngineState *s, SegManager *self) {
// FIXME: Unify this code with script_instantiate_*
load_script(s, i);
scr->locals_block = (scr->locals_segment == 0) ? NULL : (LocalVariables *)(s->segMan->_heap[scr->locals_segment]);
- if (s->resMan->sciVersion() == SCI_VERSION_1_1) {
+ if (s->resMan->sciVersion() >= SCI_VERSION_1_1) {
scr->export_table = 0;
scr->synonyms = 0;
if (READ_LE_UINT16(scr->buf + 6) > 0) {
scr->setExportTableOffset(6);
+ s->segMan->scriptRelocateExportsSci11(i);
}
} else {
scr->export_table = (uint16 *) find_unique_script_block(s, scr->buf, SCI_OBJ_EXPORTS);
@@ -599,7 +602,7 @@ static void reconstruct_scripts(EngineState *s, SegManager *self) {
for (j = 0; j < scr->_objects.size(); j++) {
byte *data = scr->buf + scr->_objects[j].pos.offset;
- if (s->resMan->sciVersion() == SCI_VERSION_1_1) {
+ if (s->resMan->sciVersion() >= SCI_VERSION_1_1) {
uint16 *funct_area = (uint16 *) (scr->buf + READ_LE_UINT16( data + 6 ));
uint16 *prop_area = (uint16 *) (scr->buf + READ_LE_UINT16( data + 4 ));