diff options
| author | Tarek Soliman | 2011-10-03 21:53:58 -0500 | 
|---|---|---|
| committer | Tarek Soliman | 2011-10-04 23:45:09 -0500 | 
| commit | fb180cba85ae5739f49d4ffe9b008b8df2f3ef99 (patch) | |
| tree | e0897bebf812eeb3d232d262d4779bc3eb3e204b | |
| parent | 71f3c543652677c9c1a9ad066b0eaeaa632ad383 (diff) | |
| download | scummvm-rg350-fb180cba85ae5739f49d4ffe9b008b8df2f3ef99.tar.gz scummvm-rg350-fb180cba85ae5739f49d4ffe9b008b8df2f3ef99.tar.bz2 scummvm-rg350-fb180cba85ae5739f49d4ffe9b008b8df2f3ef99.zip | |
SCUMM: enable speech gui option when speech file found in unknown game
This commit only affects monkey and monkey2 except FMTOWNS
because FMTOWNS has *.sou files that don't have speech
| -rw-r--r-- | engines/scumm/detection.cpp | 45 | 
1 files changed, 45 insertions, 0 deletions
| diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 3ed9218776..47b461f1bc 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -308,6 +308,47 @@ static void closeDiskImage(ScummDiskImage *img) {  	SearchMan.remove("tmpDiskImgDir");  } +/* + * This function tries to detect if a speech file exists. + * False doesn't necessarily mean there are no speech files. + */ +static bool detectSpeech(const Common::FSList &fslist, const GameSettings *gs) { +	if (gs->id == GID_MONKEY || gs->id == GID_MONKEY2) { + +		// FMTOWNS monkey and monkey2 games don't have speech but may have .sou files +		if (gs->platform == Common::kPlatformFMTowns) +			return false; + +		const char *basenames[] = { gs->gameid, "monster", 0 }; +		const char *extensions[] = { "sou", +#ifdef USE_FLAC +		 "sof", +#endif +#ifdef USE_VORBIS +		 "sog", +#endif +#ifdef USE_MAD +		 "so3", +#endif +		 0 }; + +		for (Common::FSList::const_iterator file = fslist.begin(); +		 file != fslist.end(); ++file) { +			if (!file->isDirectory()) { +				for (int i = 0; basenames[i]; ++i) { +					for (int j = 0; extensions[j]; ++j) { +						Common::String filename = Common::String(basenames[i]) +						 + "." + Common::String(extensions[j]); +						if (filename.equalsIgnoreCase(file->getName())) +							return true; +					} +				} +			} +		} +	} +	return false; +} +  // The following function tries to detect the language for COMI and DIG  static Common::Language detectLanguage(const Common::FSList &fslist, byte id) {  	// First try to detect Chinese translation @@ -608,6 +649,10 @@ static void detectGames(const Common::FSList &fslist, Common::List<DetectorResul  			// HACK: Perhaps it is some modified translation?  			dr.language = detectLanguage(fslist, g->id); +			// Detect if there are speech files in this unknown game +			if(detectSpeech(fslist, g)) +				dr.game.guioptions &= ~GUIO_NOSPEECH; +  			// Add the game/variant to the candidates list if it is consistent  			// with the file(s) we are seeing.  			if (testGame(g, fileMD5Map, file)) | 
