aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/console.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2010-11-17 20:46:59 +0000
committerFilippos Karapetis2010-11-17 20:46:59 +0000
commitba6de1bcdf075747e855ed681fa8926dd89cc906 (patch)
treebe12650fd6d7d04a94f519737be7d1bd7bc15b26 /engines/sci/console.cpp
parent8a6efcac65c91ed9760bd11824582f05dfd45320 (diff)
downloadscummvm-rg350-ba6de1bcdf075747e855ed681fa8926dd89cc906.tar.gz
scummvm-rg350-ba6de1bcdf075747e855ed681fa8926dd89cc906.tar.bz2
scummvm-rg350-ba6de1bcdf075747e855ed681fa8926dd89cc906.zip
SCI: Added sanity checks for SCI3 scripts bigger than 64KB
- Extended the "verify_scripts" console command for SCI3 scripts - Added a check for such large scripts when scripts are loaded, with an error for now, till a mechanism to support such scripts with a 16-bit addressing scheme is in place (e.g. overlaying, or splitting scripts). Either way, such scripts should span over more than one segment svn-id: r54304
Diffstat (limited to 'engines/sci/console.cpp')
-rw-r--r--engines/sci/console.cpp26
1 files changed, 16 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;
}