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.
This commit is contained in:
parent
cb4ec21d13
commit
8c555200d9
9 changed files with 62 additions and 159 deletions
|
@ -253,10 +253,10 @@ SegmentRef ArrayTable::dereference(reg_t pointer) {
|
|||
SegmentRef ret;
|
||||
|
||||
SciArray &array = at(pointer.getOffset());
|
||||
const bool isRaw = array.getType() != kArrayTypeID;
|
||||
const bool isRaw = array.getType() == kArrayTypeByte || array.getType() == kArrayTypeString;
|
||||
|
||||
ret.isRaw = isRaw;
|
||||
ret.maxSize = isRaw ? array.byteSize() : array.size();
|
||||
ret.maxSize = array.byteSize();
|
||||
if (isRaw) {
|
||||
ret.raw = (byte *)array.getRawData();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue