mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
Added new method DetectedGame::updateDesc, to ease generation of uniform description strings
svn-id: r21166
This commit is contained in:
parent
cd732d680b
commit
46ee5c8f26
@ -69,6 +69,37 @@ PluginRegistrator::PluginRegistrator(const char *name, GameList games, GameIDQue
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
void DetectedGame::updateDesc(const char *extra) {
|
||||||
|
// TODO: The format used here (LANG/PLATFORM/EXTRA) is not set in stone.
|
||||||
|
// We may want to change the order (PLATFORM/EXTRA/LANG, anybody?), or
|
||||||
|
// the seperator (instead of '/' use ', ' or ' ').
|
||||||
|
const bool hasCustomLanguage = (language != Common::UNK_LANG);
|
||||||
|
const bool hasCustomPlatform = (platform != Common::kPlatformUnknown);
|
||||||
|
const bool hasExtraDesc = (extra && extra[0]);
|
||||||
|
|
||||||
|
// Adapt the description string if custom platform/language is set.
|
||||||
|
if (hasCustomLanguage || hasCustomPlatform || hasExtraDesc) {
|
||||||
|
description += " (";
|
||||||
|
if (hasCustomLanguage)
|
||||||
|
description += Common::getLanguageDescription(language);
|
||||||
|
if (hasCustomPlatform) {
|
||||||
|
if (hasCustomLanguage)
|
||||||
|
description += "/";
|
||||||
|
description += Common::getPlatformDescription(platform);
|
||||||
|
}
|
||||||
|
if (hasExtraDesc) {
|
||||||
|
if (hasCustomPlatform || hasCustomLanguage)
|
||||||
|
description += "/";
|
||||||
|
description += extra;
|
||||||
|
}
|
||||||
|
description += ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
#ifndef DYNAMIC_MODULES
|
#ifndef DYNAMIC_MODULES
|
||||||
|
@ -54,6 +54,11 @@ struct DetectedGame : public GameDescriptor {
|
|||||||
Common::Language l = Common::UNK_LANG,
|
Common::Language l = Common::UNK_LANG,
|
||||||
Common::Platform p = Common::kPlatformUnknown)
|
Common::Platform p = Common::kPlatformUnknown)
|
||||||
: GameDescriptor(game.gameid, game.description), language(l), platform(p) {}
|
: GameDescriptor(game.gameid, game.description), language(l), platform(p) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the description string by appending (LANG/PLATFORM/EXTRA) to it.
|
||||||
|
*/
|
||||||
|
void updateDesc(const char *extra = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1150,12 +1150,8 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) {
|
|||||||
fileSet[file->path()] = false;
|
fileSet[file->path()] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If known, add the platform to the description string
|
dg.updateDesc(); // Append the platform, if set, to the description.
|
||||||
if (dg.platform != Common::kPlatformUnknown) {
|
|
||||||
dg.description += "(";
|
|
||||||
dg.description += Common::getPlatformDescription(dg.platform);
|
|
||||||
dg.description += ")";
|
|
||||||
}
|
|
||||||
detectedGames.push_back(dg);
|
detectedGames.push_back(dg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1200,28 +1196,7 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) {
|
|||||||
dg.platform = Common::kPlatformMacintosh;
|
dg.platform = Common::kPlatformMacintosh;
|
||||||
else
|
else
|
||||||
dg.platform = elem->platform;
|
dg.platform = elem->platform;
|
||||||
|
dg.updateDesc(elem->extra); // Append extra information to the description.
|
||||||
const bool hasCustomLanguage = (dg.language != Common::UNK_LANG);
|
|
||||||
const bool hasCustomPlatform = (dg.platform != Common::kPlatformUnknown);
|
|
||||||
const bool hasExtraDesc = (elem->extra && elem->extra[0]);
|
|
||||||
|
|
||||||
// Adapt the description string if custom platform/language is set.
|
|
||||||
if (hasCustomLanguage || hasCustomPlatform || hasExtraDesc) {
|
|
||||||
dg.description += " (";
|
|
||||||
if (hasCustomLanguage)
|
|
||||||
dg.description += Common::getLanguageDescription(dg.language);
|
|
||||||
if (hasCustomPlatform) {
|
|
||||||
if (hasCustomLanguage)
|
|
||||||
dg.description += "/";
|
|
||||||
dg.description += Common::getPlatformDescription(dg.platform);
|
|
||||||
}
|
|
||||||
if (hasExtraDesc) {
|
|
||||||
if (hasCustomPlatform || hasCustomLanguage)
|
|
||||||
dg.description += "/";
|
|
||||||
dg.description += elem->extra;
|
|
||||||
}
|
|
||||||
dg.description += ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert the 'enhanced' game data into the candidate list
|
// Insert the 'enhanced' game data into the candidate list
|
||||||
detectedGames.push_back(dg);
|
detectedGames.push_back(dg);
|
||||||
|
Loading…
Reference in New Issue
Block a user