diff options
-rw-r--r-- | gui/launcher.cpp | 54 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 48 |
2 files changed, 82 insertions, 20 deletions
diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 2a53406536..0d4603816c 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -158,10 +158,10 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target) yoffset += 16; _platformPopUp->appendEntry("<default>"); _platformPopUp->appendEntry(""); - _platformPopUp->appendEntry("Amiga", Common::kPlatformAmiga); - _platformPopUp->appendEntry("Atari ST", Common::kPlatformAtariST); - _platformPopUp->appendEntry("Macintosh", Common::kPlatformMacintosh); - _platformPopUp->appendEntry("PC", Common::kPlatformPC); + const Common::PlatformDescription *p = Common::g_platforms; + for (; p->code; ++p) { + _platformPopUp->appendEntry(p->description, p->id); + } // // 2) The graphics tab @@ -208,9 +208,11 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target) void EditGameDialog::open() { OptionsDialog::open(); - // En-/disable dialog items depending on whether overrides are active or not. + int sel, i; bool e; + // En-/disable dialog items depending on whether overrides are active or not. + e = ConfMan.hasKey("fullscreen", _domain) || ConfMan.hasKey("aspect_ratio", _domain); _globalGraphicsOverride->setState(e); @@ -225,25 +227,25 @@ void EditGameDialog::open() { ConfMan.hasKey("sfx_volume", _domain); _globalVolumeOverride->setState(e); - int sel = 0; - // TODO: game path + const Common::LanguageDescription *l = Common::g_languages; - int lang = Common::parseLanguage(ConfMan.get("language", _domain)); - for (int i = 0; l->code; ++l, ++i) { + const Common::Language lang = Common::parseLanguage(ConfMan.get("language", _domain)); + sel = 0; + for (i = 0; l->code; ++l, ++i) { if (lang == l->id) sel = i + 2; } _langPopUp->setSelected(sel); - switch (Common::parsePlatform(ConfMan.get("platform", _domain))) { - case Common::kPlatformPC: sel = 5; break; - case Common::kPlatformAmiga: sel = 2; break; - case Common::kPlatformAtariST: sel = 3; break; - case Common::kPlatformMacintosh: sel = 4; break; - default: sel = 0; break; + const Common::PlatformDescription *p = Common::g_platforms; + const Common::Platform platform = Common::parsePlatform(ConfMan.get("platform", _domain)); + sel = 0; + for (i = 0; p->code; ++p, ++i) { + if (platform == p->id) + sel = i + 2; } _platformPopUp->setSelected(sel); } @@ -444,15 +446,33 @@ void LauncherDialog::addGame() { ConfMan.set("description", result.description, domain); } ConfMan.set("path", dir->path(), domain); + + const bool customLanguage = (result.language != Common::UNK_LANG); + const bool customPlatform = (result.platform != Common::kPlatformUnknown); // Set language if specified - if (result.language != Common::UNK_LANG) + if (customLanguage) ConfMan.set("language", Common::getLanguageCode(result.language), domain); // Set platform if specified - if (result.platform != Common::kPlatformUnknown) + if (customPlatform) ConfMan.set("platform", Common::getPlatformCode(result.platform), domain); + // Adapt the description string if custom platform/language is set + if (customLanguage || customPlatform) { + String desc = result.description; + desc += " ("; + if (customLanguage) + desc += getLanguageDescription(result.language); + if (customLanguage && customPlatform) + desc += "/"; + if (customPlatform) + desc += getPlatformDescription(result.platform); + desc += ")"; + + ConfMan.set("description", desc, domain); + } + // Display edit dialog for the new entry EditGameDialog editDialog(domain, result); if (editDialog.runModal()) { diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index d4005a3e6b..98c78eb94e 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -711,7 +711,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS _hexdumpScripts = false; _showStack = false; - if (_features & GF_FMTOWNS) { // FmTowns is 320x240 + if (_features & GF_FMTOWNS) { // FMTowns V3 games use 320x240 _screenWidth = 320; _screenHeight = 240; } else if (_gameId == GID_CMI) { @@ -774,11 +774,11 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS _imuse->property(IMuse::PROP_MULTI_MIDI, ConfMan.getBool("multi_midi") && _midiDriver != MD_NULL && (gs.midi & MDT_ADLIB)); _imuse->property(IMuse::PROP_NATIVE_MT32, _native_mt32); - if (_features & GF_HUMONGOUS || _features & GF_FMTOWNS) { + if (_features & GF_HUMONGOUS || gs.midi == MDT_TOWNS) { _imuse->property(IMuse::PROP_LIMIT_PLAYERS, 1); _imuse->property(IMuse::PROP_RECYCLE_PLAYERS, 1); } - if (_features & GF_FMTOWNS) + if (gs.midi == MDT_TOWNS) _imuse->property(IMuse::PROP_DIRECT_PASSTHROUGH, 1); _imuse->set_music_volume(ConfMan.getInt("music_volume")); } @@ -2893,6 +2893,9 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) { const ScummGameSettings *g; char detectName[128]; char detectName2[128]; + + typedef Common::Map<Common::String, bool> StringSet; + StringSet fileSet; for (g = scumm_settings; g->name; ++g) { // Determine the 'detectname' for this game, that is, the name of a @@ -2925,10 +2928,42 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) { (0 == scumm_stricmp(detectName2, name))) { // Match found, add to list of candidates, then abort inner loop. detectedGames.push_back(g->toGameSettings()); + fileSet.addKey(file->path()); break; } } } + + // Now, we check the MD5 sums of the 'candidate' files. If we have an exact match, + // only return that. + bool exactMatch = false; + for (StringSet::const_iterator iter = fileSet.begin(); iter != fileSet.end(); ++iter) { + uint8 md5sum[16]; + const char *name = iter->_key.c_str(); + if (md5_file(name, md5sum)) { + char md5str[32+1]; + for (int j = 0; j < 16; j++) { + sprintf(md5str + j*2, "%02x", (int)md5sum[j]); + } + + const MD5Table *elem; + elem = (const MD5Table *)bsearch(md5str, md5table, ARRAYSIZE(md5table)-1, sizeof(MD5Table), compareMD5Table); + if (elem) { + if (!exactMatch) + detectedGames.clear(); // Clear all the non-exact candidates + // Find the GameSettings for that target + for (g = scumm_settings; g->name; ++g) { + if (0 == scumm_stricmp(g->name, elem->target)) + break; + } + assert(g->name); + // Insert the 'enhanced' game data into the candidate list + detectedGames.push_back(DetectedGame(g->toGameSettings(), elem->language, elem->platform)); + exactMatch = true; + } + } + } + return detectedGames; } @@ -2963,6 +2998,13 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) { case Common::kPlatformMacintosh: game.features |= GF_MACINTOSH; break; + case Common::kPlatformFMTowns: + if (game.version == 3) { + // The V5 FM-TOWNS games are mostly identical to the PC versions, it seems? + game.features |= GF_FMTOWNS; + game.midi = MDT_TOWNS; + } + break; default: if (!(game.features & GF_FMTOWNS)) game.features |= GF_PC; |