aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
Diffstat (limited to 'base')
-rw-r--r--base/plugins.cpp31
-rw-r--r--base/plugins.h5
2 files changed, 36 insertions, 0 deletions
diff --git a/base/plugins.cpp b/base/plugins.cpp
index 0f1fc62b18..80f19bd775 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -71,6 +71,37 @@ PluginRegistrator::PluginRegistrator(const char *name, GameList games, GameIDQue
#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 -
+
#ifndef DYNAMIC_MODULES
class StaticPlugin : public Plugin {
PluginRegistrator *_plugin;
diff --git a/base/plugins.h b/base/plugins.h
index 5cc362ca58..678d2f5f6d 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -54,6 +54,11 @@ struct DetectedGame : public GameDescriptor {
Common::Language l = Common::UNK_LANG,
Common::Platform p = Common::kPlatformUnknown)
: 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);
};