diff options
author | Jonathan Gray | 2003-01-29 08:07:10 +0000 |
---|---|---|
committer | Jonathan Gray | 2003-01-29 08:07:10 +0000 |
commit | 80bd1491563bcf974dd87506e43e225f0b3adf61 (patch) | |
tree | 9bcc9c6cef21e5eaa11b36979145db17f9e9806a /common/gameDetector.cpp | |
parent | 988db178e65bef7cf6d4fe9bda28d5eb16ea1e29 (diff) | |
download | scummvm-rg350-80bd1491563bcf974dd87506e43e225f0b3adf61.tar.gz scummvm-rg350-80bd1491563bcf974dd87506e43e225f0b3adf61.tar.bz2 scummvm-rg350-80bd1491563bcf974dd87506e43e225f0b3adf61.zip |
add ability to specify language for comi see scummvm -h for possible values
svn-id: r6567
Diffstat (limited to 'common/gameDetector.cpp')
-rw-r--r-- | common/gameDetector.cpp | 41 |
1 files changed, 41 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) { |