aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/util.cpp38
-rw-r--r--common/util.h11
2 files changed, 37 insertions, 12 deletions
diff --git a/common/util.cpp b/common/util.cpp
index 4f16fe5a1d..d7d3c4dd01 100644
--- a/common/util.cpp
+++ b/common/util.cpp
@@ -127,14 +127,8 @@ void StackLock::unlock() {
#pragma mark -
-struct LanguageDescription {
- const char *name;
- const char *description;
- Common::Language id;
-};
-
-static const struct LanguageDescription languages[] = {
- {"en", "English", EN_USA},
+const LanguageDescription g_languages[] = {
+ {"en", "English (US)", EN_USA},
{"de", "German", DE_DEU},
{"fr", "French", FR_FRA},
{"it", "Italian", IT_ITA},
@@ -143,7 +137,7 @@ static const struct LanguageDescription languages[] = {
{"jp", "Japanese", JA_JPN},
{"zh", "Chinese (Taiwan)", ZH_TWN},
{"kr", "Korean", KO_KOR},
- {"gb", "English", EN_GRB},
+ {"gb", "English (GB)", EN_GRB},
{"se", "Swedish", SE_SWE},
{"hb", "Hebrew", HB_HEB},
{"ru", "Russian", RU_RUS},
@@ -155,17 +149,26 @@ Language parseLanguage(const String &str) {
return UNK_LANG;
const char *s = str.c_str();
- const LanguageDescription *l = languages;
- while (l->name) {
+ const LanguageDescription *l = g_languages;
+ for (; l->name; ++l) {
if (!scumm_stricmp(l->name, s))
return l->id;
- l++;
}
return UNK_LANG;
}
+const char *getLanguageString(Language id) {
+ const LanguageDescription *l = g_languages;
+ for (; l->name; ++l) {
+ if (l->id == id)
+ return l->name;
+ }
+ return 0;
+}
+
+
#pragma mark -
@@ -187,4 +190,15 @@ Platform parsePlatform(const String &str) {
}
+const char *getPlatformString(Platform id) {
+ switch (id) {
+ case Common::kPlatformPC: return "pc";
+ case Common::kPlatformAmiga: return "amiga";
+ case Common::kPlatformAtariST: return "atari";
+ case Common::kPlatformMacintosh: return "macintosh";
+ default: return 0;
+ }
+}
+
+
} // End of namespace Common
diff --git a/common/util.h b/common/util.h
index 56c9cff653..65919c6a30 100644
--- a/common/util.h
+++ b/common/util.h
@@ -111,8 +111,18 @@ enum Language {
RU_RUS = 21
};
+struct LanguageDescription {
+ const char *name;
+ const char *description;
+ Common::Language id;
+};
+
+extern const LanguageDescription g_languages[];
+
+
/** Convert a string containing a language name into a Language enum value. */
extern Language parseLanguage(const String &str);
+extern const char *getLanguageString(Language id);
/**
* List of game platforms. Specifying a platform for a target can be used to
@@ -136,6 +146,7 @@ enum Platform {
/** Convert a string containing a platform name into a Platform enum value. */
extern Platform parsePlatform(const String &str);
+extern const char *getPlatformString(Platform id);
} // End of namespace Common