diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/gameDetector.cpp | 41 | ||||
-rw-r--r-- | common/gameDetector.h | 8 | ||||
-rw-r--r-- | common/system.h | 13 |
3 files changed, 62 insertions, 0 deletions
diff --git a/common/gameDetector.cpp b/common/gameDetector.cpp index 554f181634..194f85ff53 100644 --- a/common/gameDetector.cpp +++ b/common/gameDetector.cpp @@ -50,6 +50,7 @@ static const char USAGE_STRING[] = "\t-g<mode> - graphics mode (normal,2x,3x,2xsai,super2xsai,supereagle,advmame2x,tv2x)\n" "\t-e<mode> - set music engine (see README for details)\n" "\t-a - specify game is amiga version\n" + "\t-q<lang> - specify language for comi (en,de,fr,it,pt,es,ja,zh,ko)\n" "\n" "\t-c<num> - use cdrom <num> for cd audio\n" "\t-m<num> - set music volume to <num> (0-255)\n" @@ -186,6 +187,19 @@ static const struct GraphicsModes gfx_modes[] = { {0, 0} }; +static const struct Languages languages[] = { + {"en", "English", EN_USA}, + {"de", "German", DE_DEU}, + {"fr", "French", FR_FRA}, + {"it", "Italian", IT_ITA}, + {"pt", "Portuguese", PT_BRA}, + {"es", "Spanish", ES_ESP}, + {"jp", "Japanese", JA_JPN}, + {"zh", "Chinese (Taiwan)", ZH_TWN}, + {"ko", "Korean", KO_KOR}, + {0, 0, 0} +}; + static const struct MusicDrivers music_drivers[] = { {"auto", "Default", MD_AUTO}, {"null", "No music", MD_NULL}, @@ -211,6 +225,7 @@ GameDetector::GameDetector() _music_volume = kDefaultMusicVolume; _sfx_volume = kDefaultSFXVolume; _amiga = false; + _language = 0; _talkSpeed = 60; _debugMode = 0; @@ -281,6 +296,13 @@ void GameDetector::updateconfig() exit(-1); } + if ((val = g_config->get("language"))) + if ((_language = parseLanguage(val)) == -1) { + printf("Error in the config file: invalid language.\n"); + printf(USAGE_STRING); + exit(-1); + } + _master_volume = g_config->getInt("master_volume", _master_volume); _music_volume = g_config->getInt("music_volume", _music_volume); @@ -422,6 +444,13 @@ void GameDetector::parseCommandLine(int argc, char **argv) _gameDataPath = option; g_config->set("path", _gameDataPath); break; + case 'q': + HANDLE_OPTION(); + _language = parseLanguage(option); + if (_language == -1) + goto ShowHelpAndExit; + g_config->set("language", option); + break; case 'r': HANDLE_OPTION(); // Ignore -r for now, to ensure backward compatibility. @@ -518,6 +547,18 @@ int GameDetector::parseGraphicsMode(const char *s) return -1; } +int GameDetector::parseLanguage(const char *s) +{ + const Languages *l = languages; + while(l->name) { + if (!scumm_stricmp(l->name, s)) + return l->id; + l++; + } + + return -1; +} + bool GameDetector::isMusicDriverAvailable(int drv) { switch(drv) { diff --git a/common/gameDetector.h b/common/gameDetector.h index 26e488708f..49598bfd84 100644 --- a/common/gameDetector.h +++ b/common/gameDetector.h @@ -105,6 +105,12 @@ struct GraphicsModes { int id; }; +struct Languages { + const char *name; + const char *description; + int id; +}; + extern const VersionSettings version_settings[]; @@ -132,6 +138,7 @@ public: int _sfx_volume; int _master_volume; bool _amiga; + int _language; uint16 _talkSpeed; uint16 _debugMode; @@ -166,6 +173,7 @@ public: protected: bool detectGame(void); bool parseMusicDriver(const char *s); + int parseLanguage(const char *s); void list_games(); }; diff --git a/common/system.h b/common/system.h index 77d50e2e84..eb6ba47654 100644 --- a/common/system.h +++ b/common/system.h @@ -237,6 +237,19 @@ enum { GD_GP32 //ph0x }; +/* Languages */ +enum { + EN_USA = 0, + DE_DEU = 1, + FR_FRA = 2, + IT_ITA = 3, + PT_BRA = 4, + ES_ESP = 5, + JA_JPN = 6, + ZH_TWN = 7, + KO_KOR = 8 +}; + enum { #ifdef _WIN32_WCE SAMPLES_PER_SEC_OLD = 11025, |