diff options
-rw-r--r-- | engines/sci/console.cpp | 26 | ||||
-rw-r--r-- | engines/sci/engine/script.cpp | 9 |
2 files changed, 25 insertions, 10 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 5915c14fba..276109e9af 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -834,8 +834,8 @@ bool Console::cmdHexgrep(int argc, const char **argv) { } bool Console::cmdVerifyScripts(int argc, const char **argv) { - if (getSciVersion() < SCI_VERSION_1_1 || getSciVersion() == SCI_VERSION_3) { - DebugPrintf("This script check is only meant for SCI1.1-SCI2.1 games\n"); + if (getSciVersion() < SCI_VERSION_1_1) { + DebugPrintf("This script check is only meant for SCI1.1-SCI3 games\n"); return true; } @@ -843,7 +843,7 @@ bool Console::cmdVerifyScripts(int argc, const char **argv) { Common::sort(resources->begin(), resources->end()); Common::List<ResourceId>::iterator itr = resources->begin(); - DebugPrintf("%d SCI1.1-SCI2.1 scripts found, performing sanity checks...\n", resources->size()); + DebugPrintf("%d SCI1.1-SCI3 scripts found, performing sanity checks...\n", resources->size()); Resource *script, *heap; while (itr != resources->end()) { @@ -851,13 +851,19 @@ bool Console::cmdVerifyScripts(int argc, const char **argv) { if (!script) DebugPrintf("Error: script %d couldn't be loaded\n", itr->getNumber()); - heap = _engine->getResMan()->findResource(ResourceId(kResourceTypeHeap, itr->getNumber()), false); - if (!heap) - DebugPrintf("Error: script %d doesn't have a corresponding heap\n", itr->getNumber()); - - if (script && heap && (script->size + heap->size > 65535)) - DebugPrintf("Error: script and heap %d together are larger than 64KB (%d bytes)\n", - itr->getNumber(), script->size + heap->size); + if (getSciVersion() <= SCI_VERSION_2_1) { + heap = _engine->getResMan()->findResource(ResourceId(kResourceTypeHeap, itr->getNumber()), false); + if (!heap) + DebugPrintf("Error: script %d doesn't have a corresponding heap\n", itr->getNumber()); + + if (script && heap && (script->size + heap->size > 65535)) + DebugPrintf("Error: script and heap %d together are larger than 64KB (%d bytes)\n", + itr->getNumber(), script->size + heap->size); + } else { // SCI3 + if (script && script->size > 65535) + DebugPrintf("Error: script %d is larger than 64KB (%d bytes)\n", + itr->getNumber(), script->size); + } ++itr; } diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index 6216e1b201..424102a90d 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -113,6 +113,15 @@ void Script::init(int script_nr, ResourceManager *resMan) { error("Script and heap sizes combined exceed 64K. This means a fundamental " "design bug was made regarding SCI1.1 and newer games.\n" "Please report this error to the ScummVM team"); + } else if (getSciVersion() == SCI_VERSION_3) { + // Check for scripts over 64KB. These won't work with the current 16-bit address + // scheme. We need an overlaying mechanism, or a mechanism to split script parts + // in different segments to handle these. For now, simply stop when such a script + // is found. + // TODO: Remove this once such a mechanism is in place + if (script->size > 65535) + error("TODO: SCI script %d is over 64KB - it's %d bytes long. This can't " + "be handled at the moment, thus stopping", script_nr, script->size); } } |