aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/savegame.cpp
diff options
context:
space:
mode:
authorColin Snover2016-10-03 16:02:59 -0500
committerColin Snover2016-10-09 11:21:13 -0500
commit8c555200d94470e554fb08324490dfb733952368 (patch)
tree874870b0e28611eb9eeda3ccc8a77d961adcb517 /engines/sci/engine/savegame.cpp
parentcb4ec21d1334def596bea48dee8cbc7dd6ddc3b1 (diff)
downloadscummvm-rg350-8c555200d94470e554fb08324490dfb733952368.tar.gz
scummvm-rg350-8c555200d94470e554fb08324490dfb733952368.tar.bz2
scummvm-rg350-8c555200d94470e554fb08324490dfb733952368.zip
SCI32: Change storage type of int16 arrays to hold reg_ts instead
Memory references and integers in SSCI are both 16-bit numbers, so game scripts frequently (incorrectly) use an IntArray instead of an IDArray for holding references. Since references in ScummVM are 32-bit reg_ts, IntArray entries must be large enough to hold reg_ts in order to be compatible with game scripts that store references in integer arrays. The alternative solution is to find and patch all incorrect use of IntArray across all games. This is possible, but a bit risky from a save game stability perspective, since incorrect IntArray usage is sometimes not apparent until well after the array is instantiated (like GK1's global interview array). This change invalidates existing SCI32 save games.
Diffstat (limited to 'engines/sci/engine/savegame.cpp')
-rw-r--r--engines/sci/engine/savegame.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index f01e2a677e..2e4da46b70 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -685,20 +685,16 @@ void SciArray::saveLoadWithSerializer(Common::Serializer &s) {
}
switch (_type) {
- case kArrayTypeByte:
- case kArrayTypeString:
- s.syncBytes((byte *)_data, savedSize);
- break;
case kArrayTypeInt16:
- for (int i = 0; i < savedSize; ++i) {
- s.syncAsUint16LE(((int16 *)_data)[i]);
- }
- break;
case kArrayTypeID:
for (int i = 0; i < savedSize; ++i) {
syncWithSerializer(s, ((reg_t *)_data)[i]);
}
break;
+ case kArrayTypeByte:
+ case kArrayTypeString:
+ s.syncBytes((byte *)_data, savedSize);
+ break;
default:
error("Attempt to sync invalid SciArray type %d", _type);
}