diff options
Diffstat (limited to 'engines/scumm/detection.cpp')
-rw-r--r-- | engines/scumm/detection.cpp | 73 |
1 files changed, 61 insertions, 12 deletions
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 18f2f4ddec..6da3578530 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -33,6 +33,8 @@ #include "common/savefile.h" #include "common/system.h" +#include "audio/mididrv.h" + #include "scumm/detection.h" #include "scumm/detection_tables.h" #include "scumm/he/intern_he.h" @@ -142,6 +144,14 @@ Common::String ScummEngine_v70he::generateFilename(const int room) const { Common::String result; char id = 0; + Common::String bPattern = _filenamePattern.pattern; + + // Special cases for Blue's games, which share common (b) files + if (_game.id == GID_BIRTHDAYYELLOW || _game.id == GID_BIRTHDAYRED) + bPattern = "Blue'sBirthday"; + else if (_game.id == GID_TREASUREHUNT) + bPattern = "Blue'sTreasureHunt"; + switch (_filenamePattern.genMethod) { case kGenHEMac: case kGenHEMacNoParens: @@ -154,13 +164,7 @@ Common::String ScummEngine_v70he::generateFilename(const int room) const { switch (disk) { case 2: id = 'b'; - // Special cases for Blue's games, which share common (b) files - if (_game.id == GID_BIRTHDAY && !(_game.features & GF_DEMO)) - result = "Blue'sBirthday.(b)"; - else if (_game.id == GID_TREASUREHUNT) - result = "Blue'sTreasureHunt.(b)"; - else - result = Common::String::format("%s.(b)", _filenamePattern.pattern); + result = bPattern + ".(b)"; break; case 1: id = 'a'; @@ -185,10 +189,11 @@ Common::String ScummEngine_v70he::generateFilename(const int room) const { // For mac they're stored in game binary result = _filenamePattern.pattern; } else { + Common::String pattern = id == 'b' ? bPattern : _filenamePattern.pattern; if (_filenamePattern.genMethod == kGenHEMac) - result = Common::String::format("%s (%c)", _filenamePattern.pattern, id); + result = Common::String::format("%s (%c)", pattern.c_str(), id); else - result = Common::String::format("%s %c", _filenamePattern.pattern, id); + result = Common::String::format("%s %c", pattern.c_str(), id); } } @@ -303,6 +308,46 @@ 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 *const basenames[] = { gs->gameid, "monster", 0 }; + static const char *const 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()) + continue; + + for (int i = 0; basenames[i]; ++i) { + Common::String basename = Common::String(basenames[i]) + "."; + + for (int j = 0; extensions[j]; ++j) { + if ((basename + extensions[j]).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 @@ -431,7 +476,7 @@ static void computeGameSettingsFromMD5(const Common::FSList &fslist, const GameF } } -static void composeFileHashMap(DescMap &fileMD5Map, const Common::FSList &fslist, int depth, const char **globs) { +static void composeFileHashMap(DescMap &fileMD5Map, const Common::FSList &fslist, int depth, const char *const *globs) { if (depth <= 0) return; @@ -449,7 +494,7 @@ static void composeFileHashMap(DescMap &fileMD5Map, const Common::FSList &fslist continue; bool matched = false; - for (const char **glob = globs; *glob; glob++) + for (const char *const *glob = globs; *glob; glob++) if (file->getName().matchString(*glob, true)) { matched = true; break; @@ -603,6 +648,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)) @@ -952,7 +1001,7 @@ GameList ScummMetaEngine::detectGames(const Common::FSList &fslist) const { } } - dg.setGUIOptions(x->game.guioptions | MidiDriver::musicType2GUIO(x->game.midi)); + dg.setGUIOptions(x->game.guioptions + MidiDriver::musicType2GUIO(x->game.midi)); dg.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(x->language)); detectedGames.push_back(dg); |