aboutsummaryrefslogtreecommitdiff
path: root/common/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/util.cpp')
-rw-r--r--common/util.cpp96
1 files changed, 59 insertions, 37 deletions
diff --git a/common/util.cpp b/common/util.cpp
index 2fffdca8a6..cba921a142 100644
--- a/common/util.cpp
+++ b/common/util.cpp
@@ -38,20 +38,20 @@ void hexdump(const byte *data, int len, int bytesPerLine, int startOffset) {
byte c;
int offset = startOffset;
while (len >= bytesPerLine) {
- printf("%06x: ", offset);
+ debugN("%06x: ", offset);
for (i = 0; i < bytesPerLine; i++) {
- printf("%02x ", data[i]);
+ debugN("%02x ", data[i]);
if (i % 4 == 3)
- printf(" ");
+ debugN(" ");
}
- printf(" |");
+ debugN(" |");
for (i = 0; i < bytesPerLine; i++) {
c = data[i];
if (c < 32 || c >= 127)
c = '.';
- printf("%c", c);
+ debugN("%c", c);
}
- printf("|\n");
+ debugN("|\n");
data += bytesPerLine;
len -= bytesPerLine;
offset += bytesPerLine;
@@ -60,25 +60,25 @@ void hexdump(const byte *data, int len, int bytesPerLine, int startOffset) {
if (len <= 0)
return;
- printf("%06x: ", offset);
+ debugN("%06x: ", offset);
for (i = 0; i < bytesPerLine; i++) {
if (i < len)
- printf("%02x ", data[i]);
+ debugN("%02x ", data[i]);
else
- printf(" ");
+ debugN(" ");
if (i % 4 == 3)
- printf(" ");
+ debugN(" ");
}
- printf(" |");
+ debugN(" |");
for (i = 0; i < len; i++) {
c = data[i];
if (c < 32 || c >= 127)
c = '.';
- printf("%c", c);
+ debugN("%c", c);
}
for (; i < bytesPerLine; i++)
- printf(" ");
- printf("|\n");
+ debugN(" ");
+ debugN("|\n");
}
@@ -107,29 +107,29 @@ bool parseBool(const Common::String &val, bool &valAsBool) {
const LanguageDescription g_languages[] = {
- { "zh-cn", "Chinese (China)", ZH_CNA },
- { "zh", "Chinese (Taiwan)", ZH_TWN },
- { "cz", "Czech", CZ_CZE },
- { "nl", "Dutch", NL_NLD },
- { "en", "English", EN_ANY }, // Generic English (when only one game version exist)
- { "gb", "English (GB)", EN_GRB },
- { "us", "English (US)", EN_USA },
- { "fr", "French", FR_FRA },
- { "de", "German", DE_DEU },
- { "gr", "Greek", GR_GRE },
- { "he", "Hebrew", HE_ISR },
- { "hb", "Hebrew", HE_ISR }, // Deprecated
- { "hu", "Hungarian", HU_HUN },
- { "it", "Italian", IT_ITA },
- { "jp", "Japanese", JA_JPN },
- { "kr", "Korean", KO_KOR },
- { "nb", "Norwegian Bokm\xE5l", NB_NOR },
- { "pl", "Polish", PL_POL },
- { "br", "Portuguese", PT_BRA },
- { "ru", "Russian", RU_RUS },
- { "es", "Spanish", ES_ESP },
- { "se", "Swedish", SE_SWE },
- { 0, 0, UNK_LANG }
+ { "zh-cn"/*, "zh_CN"*/, "Chinese (China)", ZH_CNA },
+ { "zh"/*, "zh_TW"*/, "Chinese (Taiwan)", ZH_TWN },
+ { "cz"/*, "cs_CZ"*/, "Czech", CZ_CZE },
+ { "nl"/*, "nl_NL"*/, "Dutch", NL_NLD },
+ { "en"/*, "en"*/, "English", EN_ANY }, // Generic English (when only one game version exist)
+ { "gb"/*, "en_GB"*/, "English (GB)", EN_GRB },
+ { "us"/*, "en_US"*/, "English (US)", EN_USA },
+ { "fr"/*, "fr_FR"*/, "French", FR_FRA },
+ { "de"/*, "de_DE"*/, "German", DE_DEU },
+ { "gr"/*, "el_GR"*/, "Greek", GR_GRE },
+ { "he"/*, "he_IL"*/, "Hebrew", HE_ISR },
+ { "hb"/*, "he_IL"*/, "Hebrew", HE_ISR }, // Deprecated
+ { "hu"/*, "hu_HU"*/, "Hungarian", HU_HUN },
+ { "it"/*, "it_IT"*/, "Italian", IT_ITA },
+ { "jp"/*, "ja_JP"*/, "Japanese", JA_JPN },
+ { "kr"/*, "ko_KR"*/, "Korean", KO_KOR },
+ { "nb"/*, "nb_NO"*/, "Norwegian Bokm\xE5l", NB_NOR }, // TODO Someone should verify the unix locale
+ { "pl"/*, "pl_PL"*/, "Polish", PL_POL },
+ { "br"/*, "pt_BR"*/, "Portuguese", PT_BRA },
+ { "ru"/*, "ru_RU"*/, "Russian", RU_RUS },
+ { "es"/*, "es_ES"*/, "Spanish", ES_ESP },
+ { "se"/*, "sv_SE"*/, "Swedish", SE_SWE },
+ { 0/*, 0*/, 0, UNK_LANG }
};
Language parseLanguage(const String &str) {
@@ -145,6 +145,19 @@ Language parseLanguage(const String &str) {
return UNK_LANG;
}
+/*Language parseLanguageFromLocale(const char *locale) {
+ if (!locale || !*locale)
+ return UNK_LANG;
+
+ const LanguageDescription *l = g_languages;
+ for (; l->code; ++l) {
+ if (!strcmp(l->unixLocale, locale))
+ return l->id;
+ }
+
+ return UNK_LANG;
+}*/
+
const char *getLanguageCode(Language id) {
const LanguageDescription *l = g_languages;
for (; l->code; ++l) {
@@ -154,6 +167,15 @@ const char *getLanguageCode(Language id) {
return 0;
}
+/*const char *getLanguageLocale(Language id) {
+ const LanguageDescription *l = g_languages;
+ for (; l->code; ++l) {
+ if (l->id == id)
+ return l->unixLocale;
+ }
+ return 0;
+}*/
+
const char *getLanguageDescription(Language id) {
const LanguageDescription *l = g_languages;
for (; l->code; ++l) {