aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2016-02-20 16:55:01 +0200
committerFilippos Karapetis2016-02-20 16:56:08 +0200
commit9cb7caeb247adbc60ab67045c79ee24f3f497026 (patch)
tree3a68648518f8dbebfeb8ae75c33bfcbda06eea69 /engines/sci
parented251ea004497b16198149cbe1d048404d05a900 (diff)
downloadscummvm-rg350-9cb7caeb247adbc60ab67045c79ee24f3f497026.tar.gz
scummvm-rg350-9cb7caeb247adbc60ab67045c79ee24f3f497026.tar.bz2
scummvm-rg350-9cb7caeb247adbc60ab67045c79ee24f3f497026.zip
SCI: Fix a regression in the fallback detector. Some cleanup
Removed the superfluous initForDetection() function, which was not updated in commit 2f17ba2b0ab77ef939c21efa04f7aaafccbd0c37 and caused the fallback detector to crash because of uninitialized variables
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/detection.cpp2
-rw-r--r--engines/sci/resource.cpp35
-rw-r--r--engines/sci/resource.h5
3 files changed, 9 insertions, 33 deletions
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index f4f104010f..05c00bff0b 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -578,7 +578,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
ResourceManager resMan;
resMan.addAppropriateSourcesForDetection(fslist);
- resMan.initForDetection();
+ resMan.init();
// TODO: Add error handling.
#ifndef ENABLE_SCI32
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 86c5f52455..2a4cd95b91 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -944,35 +944,14 @@ void ResourceManager::init() {
debugC(1, kDebugLevelResMan, "resMan: Detected SCI1.1 VGA graphic resources");
break;
default:
-#ifdef ENABLE_SCI32
- error("resMan: Couldn't determine view type");
-#else
- if (getSciVersion() >= SCI_VERSION_2) {
- // SCI support isn't built in, thus the view type won't be determined for
- // SCI2+ games. This will be handled further up, so throw no error here
- } else {
- error("resMan: Couldn't determine view type");
- }
-#endif
+ // Throw a warning, but do not error out here, because this is called from the
+ // fallback detector, and the user could be pointing to a folder with a non-SCI
+ // game, but with SCI-like file names (e.g. Pinball Creep)
+ warning("resMan: Couldn't determine view type");
+ break;
}
}
-void ResourceManager::initForDetection() {
- assert(!g_sci);
-
- _memoryLocked = 0;
- _memoryLRU = 0;
- _LRU.clear();
- _resMap.clear();
- _audioMapSCI1 = NULL;
-
- _mapVersion = detectMapVersion();
- _volVersion = detectVolVersion();
-
- scanNewSources();
- detectSciVersion();
-}
-
ResourceManager::~ResourceManager() {
// freeing resources
ResourceMap::iterator itr = _resMap.begin();
@@ -2483,7 +2462,9 @@ bool ResourceManager::hasOldScriptHeader() {
Resource *res = findResource(ResourceId(kResourceTypeScript, 0), 0);
if (!res) {
- error("resMan: Failed to find script.000");
+ // Script 0 missing -> corrupted / non-SCI resource files.
+ // Don't error out here, because this might have been called
+ // from the fallback detector
return false;
}
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index 46ac2bb944..ef474d97c2 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -315,11 +315,6 @@ public:
void init();
/**
- * Similar to the function above, only called from the fallback detector
- */
- void initForDetection();
-
- /**
* Adds all of the resource files for a game
*/
int addAppropriateSources();