[Scummvm-cvs-logs] CVS: scummvm/base plugins.cpp,1.9,1.10 gameDetector.h,1.5,1.6 gameDetector.cpp,1.9,1.10

Max Horn fingolfin at users.sourceforge.net
Thu Oct 2 15:54:02 CEST 2003


Update of /cvsroot/scummvm/scummvm/base
In directory sc8-pr-cvs1:/tmp/cvs-serv18865/base

Modified Files:
	plugins.cpp gameDetector.h gameDetector.cpp 
Log Message:
cleanup & restructuring; in particular move the midi driver list to its own source file

Index: plugins.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/plugins.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- plugins.cpp	2 Oct 2003 17:43:00 -0000	1.9
+++ plugins.cpp	2 Oct 2003 22:52:57 -0000	1.10
@@ -26,6 +26,9 @@
 #include "common/util.h"
 
 
+typedef Engine *(*EngineFactory)(GameDetector *detector, OSystem *syst);
+
+
 #ifdef DYNAMIC_MODULES
 
 #ifdef UNIX

Index: gameDetector.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/gameDetector.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- gameDetector.h	2 Oct 2003 17:43:00 -0000	1.5
+++ gameDetector.h	2 Oct 2003 22:52:57 -0000	1.6
@@ -46,9 +46,10 @@
 	GF_DEFAULT_TO_1X_SCALER = 1 << 31
 };
 
-/* Languages
- * note: values 0->8 are are _needed_ for scripts in comi please don't
- * remove/change fixed numbers from this enum
+/**
+ * List of language ids.
+ * @note The order and mappings of the values 0..8 are *required* to stay the
+ * way they are now, as scripts in COMI rely on them. So don't touch them.
  */
 enum {
 	EN_USA = 0,
@@ -82,32 +83,8 @@
 	const char *detectname;
 };
 
-struct MusicDriver {
-	const char *name;
-	const char *description;
-	int id;
-};
-
-struct GraphicsMode {
-	const char *name;
-	const char *description;
-	int id;
-};
-
-struct Language {
-	const char *name;
-	const char *description;
-	int id;
-};
-
-typedef Engine *(*EngineFactory)(GameDetector *detector, OSystem *syst);
-
 class GameDetector {
 	typedef Common::String String;
-
-public:
-	static const MusicDriver *getMusicDrivers();
-	static bool isMusicDriverAvailable(int drv);
 
 public:
 	GameDetector();

Index: gameDetector.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/gameDetector.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- gameDetector.cpp	2 Oct 2003 17:42:59 -0000	1.9
+++ gameDetector.cpp	2 Oct 2003 22:52:57 -0000	1.10
@@ -21,12 +21,15 @@
  */
 
 #include "stdafx.h"
+
 #include "backends/intern.h"
+#include "base/engine.h"
 #include "base/gameDetector.h"
 #include "base/plugins.h"
+
 #include "common/config-file.h"
-#include "base/engine.h"
 #include "common/scaler.h"	// Only for gfx_modes
+
 #include "sound/mididrv.h"
 #include "sound/mixer.h"
 
@@ -51,52 +54,50 @@
 static const char USAGE_STRING[] = 
 	"ScummVM - Graphical Adventure Game Interpreter\n"
 	"Syntax:\n"
-	"\tscummvm [OPTIONS] [game]\n"
+	"  scummvm [OPTIONS] [game]\n"
 	"Options:\n"
-	"\t-p<path>       - Look for game in <path>\n"
-	"\t-x[num]        - Load this savegame (default: 0 - autosave)\n"
-	"\t-f             - Full-screen mode (-F forces window mode.)\n"
-	"\t-g<mode>       - Graphics mode (normal,2x,3x,2xsai,super2xsai,\n"
-	"\t                 supereagle,advmame2x,advmame3x,hq2x,hq3x,\n"
-	"\t                 tv2x,dotmatrix)\n"
-	"\t-e<mode>       - Set music engine (see README for details)\n"
-	"\t-q<lang>       - Specify language (en,de,fr,it,pt,es,jp,zh,kr,se,\n"
-	"\t                 gb,hb)\n"
+	"  -p<path>       - Look for game in <path>\n"
+	"  -x[num]        - Load this savegame (default: 0 - autosave)\n"
+	"  -f             - Full-screen mode (-F forces window mode.)\n"
+	"  -g<mode>       - Graphics mode (normal,2x,3x,2xsai,super2xsai,supereagle,\n"
+	"                   advmame2x,advmame3x,hq2x,hq3x,tv2x,dotmatrix)\n"
+	"  -e<mode>       - Set music engine (see README for details)\n"
+	"  -q<lang>       - Specify language (en,de,fr,it,pt,es,jp,zh,kr,se,gb,hb)\n"
 	"\n"
-	"\t-c<num>        - Use cdrom <num> for cd audio\n"
-	"\t-j[num]        - Enable input with joystick (default: 0 - 1st joystick)\n"
-	"\t-m<num>        - Set music volume to <num> (0-255)\n"
-	"\t-o<num>        - Set master volume to <num> (0-255)\n"
-	"\t-s<num>        - Set sfx volume to <num> (0-255)\n"
-	"\t-t<num>        - Set music tempo (50-200, default 100%%)\n"
+	"  -c<num>        - Use cdrom <num> for cd audio\n"
+	"  -j[num]        - Enable input with joystick (default: 0 - first joystick)\n"
+	"  -m<num>        - Set music volume to <num> (0-255)\n"
+	"  -o<num>        - Set master volume to <num> (0-255)\n"
+	"  -s<num>        - Set sfx volume to <num> (0-255)\n"
+	"  -t<num>        - Set music tempo (50-200, default 100%%)\n"
 	"\n"
-	"\t-n             - No subtitles for speech\n"
-	"\t-y             - Set text speed (default: 60)\n"
+	"  -n             - No subtitles for speech\n"
+	"  -y             - Set text speed (default: 60)\n"
 	"\n"
-	"\t-l<file>       - Load config file instead of default\n"
+	"  -l<file>       - Load config file instead of default\n"
 #if defined(UNIX)
-	"\t-w[file]       - Write to config file [~/.scummvmrc]\n"
+	"  -w[file]       - Write to config file [~/.scummvmrc]\n"
 #else
-	"\t-w[file]       - Write to config file [scummvm.ini]\n"
+	"  -w[file]       - Write to config file [scummvm.ini]\n"
 #endif
-	"\t-v             - Show version info and exit\n"
-	"\t-h             - Display this text and exit\n"
-	"\t-z             - Display list of games\n"
+	"  -v             - Show version info and exit\n"
+	"  -h             - Display this text and exit\n"
+	"  -z             - Display list of games\n"
 	"\n"
-	"\t-b<num>        - Pass number to the boot script (boot param)\n"
-	"\t-d[num]        - Enable debug output (debug level [0])\n"
-	"\t-u             - Dump scripts\n"
+	"  -b<num>        - Pass number to the boot script (boot param)\n"
+	"  -d[num]        - Enable debug output (debug level [0])\n"
+	"  -u             - Dump scripts\n"
 	"\n"
-	"\t--platform=    - Specify version of game (amiga,atari-st,macintosh)\n"
-	"\t--multi-midi   - Enable combination Adlib and native MIDI\n"
-	"\t--native-mt32  - True Roland MT-32 (disable GM emulation)\n"
-	"\t--fullscreen   - Full-screen mode (same as -f)\n"
-	"\t--aspect-ratio - Enable aspect ratio correction\n"
+	"  --platform=    - Specify version of game (amiga,atari-st,macintosh)\n"
+	"  --multi-midi   - Enable combination Adlib and native MIDI\n"
+	"  --native-mt32  - True Roland MT-32 (disable GM emulation)\n"
+	"  --fullscreen   - Full-screen mode (same as -f)\n"
+	"  --aspect-ratio - Enable aspect ratio correction\n"
 #ifndef DISABLE_SCUMM
-	"\t--demo-mode    - Start demo mode of Maniac Mansion (Classic version)\n"
+	"  --demo-mode    - Start demo mode of Maniac Mansion (Classic version)\n"
 #endif
 #ifndef DISABLE_SKY
-	"\t--floppy-intro - Use floppy version intro for Beneath a Steel Sky CD\n"
+	"  --floppy-intro - Use floppy version intro for Beneath a Steel Sky CD\n"
 #endif
 	"\n"
 	"The meaning of long options can be inverted by prefixing them with \"no-\",\n"
@@ -104,6 +105,20 @@
 ;
 #endif
 
+
+struct GraphicsMode {
+	const char *name;
+	const char *description;
+	int id;
+};
+
+/**
+ * List of graphic 'modes' we potentially support. Potentially because not all
+ * backends actually support all the filters listed here. At this point only
+ * the SDL backend supports all (except for the PalmOS ones of course).
+ * @todo Remove this explicit list of graphic modes and rather extend the 
+ * OSystem API to allow querying a backend for the modes it supports.
+ */
 static const struct GraphicsMode gfx_modes[] = {
 	{"normal", "Normal (no scaling)", GFX_NORMAL},
 	{"1x", "Normal (no scaling)", GFX_NORMAL},
@@ -128,6 +143,12 @@
 	{0, 0, 0}
 };
 
+struct Language {
+	const char *name;
+	const char *description;
+	int id;
+};
+
 static const struct Language languages[] = {
 	{"en", "English", EN_USA},
 	{"de", "German", DE_DEU},
@@ -144,25 +165,6 @@
 	{0, 0, 0}
 };
 
-static const struct MusicDriver music_drivers[] = {
-	{"auto", "Default", MD_AUTO},
-	{"null", "No music", MD_NULL},
-#ifndef __PALM_OS__	// reduce contant data size
-	{"windows", "Windows MIDI", MD_WINDOWS},
-	{"seq", "SEQ", MD_SEQ},
-	{"qt", "QuickTime", MD_QTMUSIC},
-	{"core", "CoreAudio", MD_COREAUDIO},
-	{"etude", "Etude", MD_ETUDE},
-	{"alsa", "ALSA", MD_ALSA},
-	{"adlib", "Adlib", MD_ADLIB},
-	{"pcspk", "PC Speaker", MD_PCSPK},
-	{"pcjr", "IBM PCjr", MD_PCJR},
-#else
-	{"ypa1", "Yamaha Pa1", MD_YPA1},
-#endif
-	{0, 0, 0}
-};
-
 
 GameDetector::GameDetector() {
 	_fullScreen = false;
@@ -363,6 +365,10 @@
 				break;
 			case 'e':
 				HANDLE_OPTION();
+				// TODO: Instead of just showing the generic help text,
+				// maybe print a message like:
+				// "'option' is not a supported music driver on this machine.
+				//  Available driver: ..."
 				if (!parseMusicDriver(option))
 					goto ShowHelpAndExit;
 				g_config->set("music_driver", option);
@@ -376,6 +382,10 @@
 			case 'g':
 				HANDLE_OPTION();
 				_gfx_mode = parseGraphicsMode(option);
+				// TODO: Instead of just showing the generic help text,
+				// maybe print a message like:
+				// "'option' is not a supported graphic mode on this machine.
+				//  Available graphic modes: ..."
 				if (_gfx_mode == -1)
 					goto ShowHelpAndExit;
 				g_config->set("gfx_mode", option);
@@ -593,46 +603,8 @@
 	return -1;
 }
 
-bool GameDetector::isMusicDriverAvailable(int drv) {
-	switch(drv) {
-	case MD_AUTO:
-	case MD_NULL: return true;
-#ifndef __PALM_OS__	// don't show it on palmos
-	case MD_ADLIB:
-	case MD_PCSPK:
-	case MD_PCJR:  return true;
-#else
-	case MD_YPA1: return true;
-#endif
-#if defined(WIN32) && !defined(_WIN32_WCE)
-	case MD_WINDOWS: return true;
-#endif
-#if defined(__MORPHOS__)
-	case MD_ETUDE: return true;
-#endif
-#if defined(UNIX) && !defined(__BEOS__) && !defined(MACOSX)
-	case MD_SEQ: return true;
-#endif
-#if defined(MACOSX) || defined(macintosh)
-	case MD_QTMUSIC: return true;
-#endif
-#if defined(MACOSX)
-	case MD_COREAUDIO: return true;
-#endif
-#if defined(UNIX) && defined(USE_ALSA)
-	case MD_ALSA: return true;
-#endif
-	}
-	return false;
-}
-
-const MusicDriver *GameDetector::getMusicDrivers() {
-	return music_drivers;
-}
-
-
 bool GameDetector::parseMusicDriver(const char *s) {
-	const MusicDriver *md = music_drivers;
+	const MidiDriverDescription *md = getAvailableMidiDrivers();
 
 	while (md->name) {
 		if (!scumm_stricmp(md->name, s)) {





More information about the Scummvm-git-logs mailing list