aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-09-20 00:37:09 +0000
committerMax Horn2003-09-20 00:37:09 +0000
commit3afbb22ad7ceac7a35256d34c6f1746230098d52 (patch)
treeec226cc448a7fbab056bb96160d983496f6c079e
parent7840039156b1ec23e92cfb64f4abd857761b5f97 (diff)
downloadscummvm-rg350-3afbb22ad7ceac7a35256d34c6f1746230098d52.tar.gz
scummvm-rg350-3afbb22ad7ceac7a35256d34c6f1746230098d52.tar.bz2
scummvm-rg350-3afbb22ad7ceac7a35256d34c6f1746230098d52.zip
fix invalid target crash for build using loadable modules
svn-id: r10325
-rw-r--r--base/gameDetector.cpp10
-rw-r--r--base/gameDetector.h2
-rw-r--r--base/main.cpp8
-rw-r--r--base/plugins.cpp12
4 files changed, 20 insertions, 12 deletions
diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp
index e05b747624..1b88b0a37d 100644
--- a/base/gameDetector.cpp
+++ b/base/gameDetector.cpp
@@ -664,15 +664,15 @@ const ScummVM::String& GameDetector::getGameName() {
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 @@ int GameDetector::detectMain() {
#endif
}
- return (0);
+ return true;
}
OSystem *GameDetector::createSystem() {
diff --git a/base/gameDetector.h b/base/gameDetector.h
index f5c2afe6ba..606f4d24a0 100644
--- a/base/gameDetector.h
+++ b/base/gameDetector.h
@@ -113,7 +113,7 @@ public:
GameDetector();
void parseCommandLine(int argc, char **argv);
- int detectMain();
+ bool detectMain();
void setGame(const String &name);
const String& getGameName(void);
diff --git a/base/main.cpp b/base/main.cpp
index 247fcb9f9d..6df2ae44a1 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -249,7 +249,7 @@ int main(int argc, char *argv[]) {
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 @@ int main(int argc, char *argv[]) {
// 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();
diff --git a/base/plugins.cpp b/base/plugins.cpp
index e963913a5a..6b70b77393 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -243,6 +243,18 @@ void PluginManager::loadPlugins() {
#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