diff options
| author | Filippos Karapetis | 2009-08-24 13:47:38 +0000 | 
|---|---|---|
| committer | Filippos Karapetis | 2009-08-24 13:47:38 +0000 | 
| commit | 56189652821ee3248cf931b3e2500766082caab9 (patch) | |
| tree | cb994d882d5e0cd5883742560d7dbf63b5a72c4a | |
| parent | 54ef7a892ba9460c21fdb7bb5cc72fedc9d4b8cd (diff) | |
| download | scummvm-rg350-56189652821ee3248cf931b3e2500766082caab9.tar.gz scummvm-rg350-56189652821ee3248cf931b3e2500766082caab9.tar.bz2 scummvm-rg350-56189652821ee3248cf931b3e2500766082caab9.zip | |
More work on the fallback detector: added detection of CD games and prevented a crash when detecting a SCI32 game if SCI32 isn't compiled in
svn-id: r43698
| -rw-r--r-- | engines/sci/detection.cpp | 55 | 
1 files changed, 46 insertions, 9 deletions
| diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index 55ea8ee00a..7f2a3ff705 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -261,6 +261,13 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl  	bool foundRes000 = false;  	Common::Platform exePlatform = Common::kPlatformUnknown; +	// Set some defaults +	s_fallbackDesc.desc.extra = ""; +	s_fallbackDesc.desc.language = Common::UNK_LANG; +	s_fallbackDesc.desc.flags = ADGF_NO_FLAGS; +	s_fallbackDesc.desc.platform = Common::kPlatformUnknown; +	s_fallbackDesc.desc.gameid = "sci"; +  	// First grab all filenames  	for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {  		if (file->isDirectory()) @@ -286,6 +293,28 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl  			foundResMap = true;  		} +		// Determine if we got a CD version and set the CD flag accordingly, by checking for +		// resource.aud. We assume that the file should be over 10MB, as it contains all the +		// game speech and is usually around 450MB+. The size check is for some floppy game +		// versions like KQ6 floppy, which also have a small resource.aud file +		if (filename.contains("resource.aud")) { +			Common::SeekableReadStream *tmpStream = file->createReadStream(); +			if (tmpStream->size() > 10 * 1024 * 1024) { +				// We got a CD version, so set the CD flag accordingly +				s_fallbackDesc.desc.flags |= ADGF_CD; +				s_fallbackDesc.desc.extra = "CD"; +			} +			delete tmpStream; +		} + +		// Check if we got a map file for older SCI1 CD versions (like KQ5CD) +		// It's named like "audioXXX.map" +		if (filename.contains("audio") && filename.contains(".map")) { +			// We got a CD version, so set the CD flag accordingly +			s_fallbackDesc.desc.flags |= ADGF_CD; +			s_fallbackDesc.desc.extra = "CD"; +		} +  		if (filename.contains("resource.000") || filename.contains("resource.001")  			|| filename.contains("ressci.000") || filename.contains("ressci.001"))  			foundRes000 = true; @@ -313,14 +342,27 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl  	ResourceManager *resMgr = new ResourceManager(fslist);  	SciVersion version = resMgr->sciVersion(); +	ViewType gameViews = resMgr->getViewType(); + +	// Have we identified the game views? If not, stop here +	if (gameViews == kViewUnknown) { +		SearchMan.remove("SCI_detection"); +		return (const ADGameDescription *)&s_fallbackDesc; +	} + +#ifndef ENABLE_SCI32 +	// Is SCI32 compiled in? If not, and this is a SCI32 game, +	// stop here +	if (resMgr->sciVersion() == SCI_VERSION_32) { +		SearchMan.remove("SCI_detection"); +		return (const ADGameDescription *)&s_fallbackDesc; +	} +#endif +  	SegManager *segManager = new SegManager(resMgr, version); -	// Set some defaults -	s_fallbackDesc.desc.extra = ""; -	s_fallbackDesc.desc.language = Common::UNK_LANG;  	if (exePlatform == Common::kPlatformUnknown) {  		// Try to determine the platform from game resources -		ViewType gameViews = resMgr->getViewType();  		if (gameViews == kViewEga || gameViews == kViewVga ||  			gameViews == kViewVga11) {  			// Must be PC or Mac, set to PC for now @@ -337,7 +379,6 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl  	}  	s_fallbackDesc.desc.platform = exePlatform; -	s_fallbackDesc.desc.flags = ADGF_NO_FLAGS;  	// Determine the game id  	if (!script_instantiate(resMgr, segManager, version, 0)) { @@ -355,10 +396,6 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl  	delete segManager;  	delete resMgr; -	printf("If this is *NOT* a fan-modified version (in particular, not a fan-made\n"); -	printf("translation), please, report the data above, including the following\n"); -	printf("version number, from the game's executable:\n"); -  	SearchMan.remove("SCI_detection");  	return (const ADGameDescription *)&s_fallbackDesc; | 
