[Scummvm-cvs-logs] CVS: scummvm/base gameDetector.cpp,1.3,1.4 gameDetector.h,1.2,1.3 main.cpp,1.3,1.4 plugins.cpp,1.5,1.6

Max Horn fingolfin at users.sourceforge.net
Fri Sep 19 17:55:27 CEST 2003


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

Modified Files:
	gameDetector.cpp gameDetector.h main.cpp plugins.cpp 
Log Message:
fix invalid target crash for build using loadable modules

Index: gameDetector.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/gameDetector.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- gameDetector.cpp	18 Sep 2003 02:07:16 -0000	1.3
+++ gameDetector.cpp	20 Sep 2003 00:37:09 -0000	1.4
@@ -664,15 +664,15 @@
 	return _gameText;
 }
 
-int GameDetector::detectMain() {
+bool GameDetector::detectMain() {
 	if (_gameFileName.isEmpty()) {
 		warning("No game was specified...");
-		return (-1);
+		return false;
 	}
 
 	if (!detectGame()) {
-		warning("Game detection failed. Using default settings");
-		_gameText = "Please choose a game";
+		warning("%s is an invalid target. Use the -z parameter to list targets", _gameFileName.c_str());
+		return false;
 	}
 
 	/* Use the adlib sound driver if auto mode is selected,
@@ -713,7 +713,7 @@
 #endif
 	}
 
-	return (0);
+	return true;
 }
 
 OSystem *GameDetector::createSystem() {

Index: gameDetector.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/gameDetector.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- gameDetector.h	17 Sep 2003 23:05:07 -0000	1.2
+++ gameDetector.h	20 Sep 2003 00:37:09 -0000	1.3
@@ -113,7 +113,7 @@
 	GameDetector();
 
 	void parseCommandLine(int argc, char **argv);
-	int detectMain();
+	bool detectMain();
 	void setGame(const String &name);
 	const String& getGameName(void);
 

Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/main.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- main.cpp	18 Sep 2003 18:22:15 -0000	1.3
+++ main.cpp	20 Sep 2003 00:37:09 -0000	1.4
@@ -249,7 +249,7 @@
 		launcherDialog(detector, system);
 
 	// Verify the given game name
-	if (!detector.detectMain()) {
+	if (detector.detectMain()) {
 		// Set the window caption to the game name
 		prop.caption = g_config->get("description", detector._gameFileName);
 		if (prop.caption == NULL)	
@@ -265,11 +265,7 @@
 
 		// Create the game engine
 		Engine *engine = detector.createEngine(system);
-
-		// print a message if gameid is invalid
-		if (engine == NULL)
-			error("%s is an invalid target. Use the -z parameter to list targets", 
-					detector._gameFileName.c_str());
+		assert(engine);
 
 		// Run the game engine
 		engine->go();

Index: plugins.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/plugins.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- plugins.cpp	19 Sep 2003 21:36:27 -0000	1.5
+++ plugins.cpp	20 Sep 2003 00:37:09 -0000	1.6
@@ -243,6 +243,18 @@
 #else
 	// Load dynamic plugins
 	// TODO... this is right now just a nasty hack. 
+	// This should search one or multiple directories for all plugins it can
+	// find (to this end, we maybe should use a special prefix/suffix; e.g.
+	// instead of libscumm.so, use scumm.engine or scumm.plugin etc.).
+	//
+	// The list of directories to search could be e.g.:
+	// User specified (via config file), ".", "./plugins", "$(prefix)/lib".
+	//
+	// We also need to add code which ensures what we are looking at is
+	// a) a ScummVM engine and b) matches the version of the executable.
+	// Hence one more symbol should be exported by plugins which returns
+	// the "ABI" version the plugin was built for, and we can compare that
+	// to the ABI version of the executable.
 	#ifndef DISABLE_SCUMM
 		tryLoadPlugin(new DynamicPlugin("scumm/libscumm.so"));
 	#endif





More information about the Scummvm-git-logs mailing list