[Scummvm-cvs-logs] CVS: scummvm/common gameDetector.cpp,1.63,1.64 gameDetector.h,1.22,1.23 system.h,1.16,1.17

Jonathan Gray khalek at users.sourceforge.net
Wed Jan 29 00:07:15 CET 2003


Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1:/tmp/cvs-serv23503

Modified Files:
	gameDetector.cpp gameDetector.h system.h 
Log Message:
add ability to specify language for comi see scummvm -h for possible values

Index: gameDetector.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/gameDetector.cpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- gameDetector.cpp	15 Jan 2003 02:11:37 -0000	1.63
+++ gameDetector.cpp	29 Jan 2003 08:06:31 -0000	1.64
@@ -50,6 +50,7 @@
 	"\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 @@
 	{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 @@
 	_music_volume = kDefaultMusicVolume;
 	_sfx_volume = kDefaultSFXVolume;
 	_amiga = false;
+	_language = 0;
 
 	_talkSpeed = 60;
 	_debugMode = 0;
@@ -281,6 +296,13 @@
 			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 @@
 				_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.
@@ -513,6 +542,18 @@
 		if (!scumm_stricmp(gm->name, s))
 			return gm->id;
 		gm++;
+	}
+
+	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;

Index: gameDetector.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/gameDetector.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- gameDetector.h	14 Jan 2003 04:25:37 -0000	1.22
+++ gameDetector.h	29 Jan 2003 08:06:34 -0000	1.23
@@ -105,6 +105,12 @@
 	int id;
 };
 
+struct Languages {
+	const char *name;
+	const char *description;
+	int id;
+};
+
 extern const VersionSettings version_settings[];
 
 
@@ -132,6 +138,7 @@
 	int _sfx_volume;
 	int _master_volume;
 	bool _amiga;
+	int _language;
 
 	uint16 _talkSpeed;
 	uint16 _debugMode;
@@ -166,6 +173,7 @@
 protected:
 	bool detectGame(void);
 	bool parseMusicDriver(const char *s);
+	int parseLanguage(const char *s);
 	void list_games();
 };
 

Index: system.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/system.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- system.h	15 Jan 2003 02:11:37 -0000	1.16
+++ system.h	29 Jan 2003 08:06:35 -0000	1.17
@@ -237,6 +237,19 @@
 	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,





More information about the Scummvm-git-logs mailing list