aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/console.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/console.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/console.cpp')
-rw-r--r--engines/sci/console.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 34109fff39..39fa95a956 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -2812,7 +2812,7 @@ bool Console::cmdViewReference(int argc, const char **argv) {
arrayType = "byte";
break;
case kArrayTypeInt16:
- arrayType = "int16";
+ arrayType = "int16 (as reg_t)";
break;
case kArrayTypeString:
arrayType = "string";
@@ -2823,24 +2823,16 @@ bool Console::cmdViewReference(int argc, const char **argv) {
}
debugPrintf("SCI32 %s array (%u entries):\n", arrayType, array->size());
switch (array->getType()) {
- case kArrayTypeID:
+ case kArrayTypeInt16:
+ case kArrayTypeID: {
hexDumpReg((const reg_t *)array->getRawData(), array->size(), 4, 0, true);
break;
+ }
case kArrayTypeByte:
case kArrayTypeString: {
Common::hexdump((const byte *)array->getRawData(), array->size(), 16, 0);
break;
}
- case kArrayTypeInt16: {
- const int16 *data = (const int16 *)array->getRawData();
- for (int i = 0; i < array->size(); ++i) {
- debugN("% 6d ", *data++);
- if ((i % 8) == 0) {
- debugN("\n");
- }
- }
- break;
- }
default:
break;
}