aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2017-05-20 19:21:24 -0500
committerColin Snover2017-05-20 21:14:18 -0500
commit66efb750a0ccaa3c2ff8b77f60544a345328da8b (patch)
tree8393fd2462a1f13a8ed8f10e40866554ef20fe56
parent14a521a21177361184fee38242065a64c5fcdf05 (diff)
downloadscummvm-rg350-66efb750a0ccaa3c2ff8b77f60544a345328da8b.tar.gz
scummvm-rg350-66efb750a0ccaa3c2ff8b77f60544a345328da8b.tar.bz2
scummvm-rg350-66efb750a0ccaa3c2ff8b77f60544a345328da8b.zip
SCI: Add more support for >16-bit SCI3 offsets
Basically just grepped for getOffset calls being assigned to uint16s and expanded those to uint32 when they looked trivial. While some of these changes seem superfluous, at least for the US/English SCI3 games where potentially impacted game scripts are not large enough to have a problem with 16-bit offsets (e.g. when feature detecting the sound type), at least some of these changes are necessary for correct operation of the find_callk debugger command in SCI3 games. There should not be a reason why any of these variables need to be kept as uint16, in any case.
-rw-r--r--engines/sci/console.cpp8
-rw-r--r--engines/sci/engine/features.cpp10
-rw-r--r--engines/sci/engine/kscripts.cpp4
3 files changed, 11 insertions, 11 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index d67bd694ab..bc115341b7 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -1104,8 +1104,8 @@ bool Console::cmdVerifyScripts(int argc, const char **argv) {
debugPrintf("Error: script and heap %d together are larger than 64KB (%u bytes)\n",
itr->getNumber(), script->size() + heap->size());
} else { // SCI3
- if (script && script->size() > 65535)
- debugPrintf("Error: script %d is larger than 64KB (%u bytes)\n",
+ if (script && script->size() > 0x3FFFF)
+ debugPrintf("Error: script %d is larger than 256KB (%u bytes)\n",
itr->getNumber(), script->size());
}
}
@@ -1922,7 +1922,7 @@ bool Console::cmdSavedBits(int argc, const char **argv) {
Common::Array<reg_t> entries = hunks->listAllDeallocatable(id);
for (uint i = 0; i < entries.size(); ++i) {
- uint16 offset = entries[i].getOffset();
+ uint32 offset = entries[i].getOffset();
const Hunk& h = hunks->at(offset);
if (strcmp(h.type, "SaveBits()") == 0) {
byte* memoryPtr = (byte *)h.mem;
@@ -3556,7 +3556,7 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) {
// Now dissassemble each method of the script object
for (uint16 i = 0; i < obj->getMethodCount(); i++) {
reg_t fptr = obj->getFunction(i);
- uint16 offset = fptr.getOffset();
+ uint32 offset = fptr.getOffset();
int16 opparams[4];
byte extOpcode;
byte opcode;
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp
index 1e8cc6dfb9..9251ac69e1 100644
--- a/engines/sci/engine/features.cpp
+++ b/engines/sci/engine/features.cpp
@@ -77,7 +77,7 @@ bool GameFeatures::autoDetectSoundType() {
if (!addr.getSegment())
return false;
- uint16 offset = addr.getOffset();
+ uint32 offset = addr.getOffset();
Script *script = _segMan->getScript(addr.getSegment());
uint16 intParam = 0xFFFF;
bool foundTarget = false;
@@ -224,7 +224,7 @@ bool GameFeatures::autoDetectLofsType(Common::String gameSuperClassName, int met
if (!addr.getSegment())
return false;
- uint16 offset = addr.getOffset();
+ uint32 offset = addr.getOffset();
Script *script = _segMan->getScript(addr.getSegment());
while (true) {
@@ -323,7 +323,7 @@ bool GameFeatures::autoDetectGfxFunctionsType(int methodNum) {
if (!addr.getSegment())
return false;
- uint16 offset = addr.getOffset();
+ uint32 offset = addr.getOffset();
Script *script = _segMan->getScript(addr.getSegment());
while (true) {
@@ -485,7 +485,7 @@ bool GameFeatures::autoDetectSci21KernelType() {
if (!addr.getSegment())
return false;
- uint16 offset = addr.getOffset();
+ uint32 offset = addr.getOffset();
Script *script = _segMan->getScript(addr.getSegment());
while (true) {
@@ -620,7 +620,7 @@ bool GameFeatures::autoDetectMoveCountType() {
if (!addr.getSegment())
return false;
- uint16 offset = addr.getOffset();
+ uint32 offset = addr.getOffset();
Script *script = _segMan->getScript(addr.getSegment());
bool foundTarget = false;
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index 98c35fcb49..af4b8ff081 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -160,7 +160,7 @@ reg_t kClone(EngineState *s, int argc, reg_t *argv) {
debugC(kDebugLevelMemory, "Attempting to clone from %04x:%04x", PRINT_REG(parentAddr));
- uint16 infoSelector = parentObj->getInfoSelector().getOffset();
+ uint16 infoSelector = parentObj->getInfoSelector().toUint16();
cloneObj = s->_segMan->allocateClone(&cloneAddr);
if (!cloneObj) {
@@ -211,7 +211,7 @@ reg_t kDisposeClone(EngineState *s, int argc, reg_t *argv) {
// At least kq4early relies on this behavior. The scripts clone "Sound", then set bit 1 manually
// and call kDisposeClone later. In that case we may not free it, otherwise we will run into issues
// later, because kIsObject would then return false and Sound object wouldn't get checked.
- uint16 infoSelector = object->getInfoSelector().getOffset();
+ uint16 infoSelector = object->getInfoSelector().toUint16();
if ((infoSelector & 3) == kInfoFlagClone)
object->markAsFreed();