diff options
-rw-r--r-- | common/gameDetector.cpp | 41 | ||||
-rw-r--r-- | common/gameDetector.h | 8 | ||||
-rw-r--r-- | common/system.h | 13 | ||||
-rw-r--r-- | scumm/scumm.h | 14 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 2 |
5 files changed, 65 insertions, 13 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, diff --git a/scumm/scumm.h b/scumm/scumm.h index d1bbfe6408..9c943e5b74 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -160,19 +160,6 @@ enum { MBS_MAX_KEY = 0x0200 }; -// possible languages for comi -enum Languages { - 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 -}; - #define _maxRooms res.num[rtRoom] #define _maxScripts res.num[rtScript] #define _maxCostumes res.num[rtCostume] @@ -393,6 +380,7 @@ public: uint16 _debugMode, _soundCardType; /* Not sure where this stuff goes */ + uint16 _language; byte isMaskActiveAt(int l, int t, int r, int b, byte *mem); void startScene(int room, Actor *a, int b); virtual void setupScummVars(); diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index eb15759aec..fbdb7b0e3e 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -94,6 +94,7 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst) _noSubtitles = detector->_noSubtitles; _defaultTalkDelay = detector->_talkSpeed; _use_adlib = detector->_use_adlib; + _language = detector->_language; memset(&res, 0, sizeof(res)); _allocatedSize = 0; _roomResource = 0; @@ -367,6 +368,7 @@ void Scumm::initScummVars() if (_features & GF_AFTER_V8) { // Fixme: How do we deal with non-cd installs? _vars[VAR_CURRENTDISK] = 1; + _vars[VAR_LANGUAGE] = _language; } } |