aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorMax Horn2006-07-31 13:41:21 +0000
committerMax Horn2006-07-31 13:41:21 +0000
commit4a80db4c7b75ca58b7a2c02a740e0ed7e19c52f4 (patch)
tree25b4b111b4a9bbc712a5f53335b0e9ce5b5c9abd /base
parenta1bb64e24b3fdcd8983a479fe9b6c0d88f650e30 (diff)
downloadscummvm-rg350-4a80db4c7b75ca58b7a2c02a740e0ed7e19c52f4.tar.gz
scummvm-rg350-4a80db4c7b75ca58b7a2c02a740e0ed7e19c52f4.tar.bz2
scummvm-rg350-4a80db4c7b75ca58b7a2c02a740e0ed7e19c52f4.zip
* Added copyright string to all engine plugins
* Modified about dialog to list all available plugins with their resp. copyright * Modified about dialog credits to show the GPL last (like movie end credits do with their legal text, too) svn-id: r23645
Diffstat (limited to 'base')
-rw-r--r--base/commandLine.cpp8
-rw-r--r--base/plugins.cpp17
-rw-r--r--base/plugins.h11
3 files changed, 24 insertions, 12 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 8372b976fb..bfa3424822 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -519,11 +519,10 @@ unknownOption:
/** List all supported game IDs, i.e. all games which any loaded plugin supports. */
static void listGames() {
- const PluginList &plugins = PluginManager::instance().getPlugins();
-
printf("Game ID Full Title \n"
"-------------------- ------------------------------------------------------\n");
+ const PluginList &plugins = PluginManager::instance().getPlugins();
PluginList::const_iterator iter = plugins.begin();
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
GameList list = (*iter)->getSupportedGames();
@@ -535,12 +534,11 @@ static void listGames() {
/** List all targets which are configured in the config file. */
static void listTargets() {
- using namespace Common;
- const ConfigManager::DomainMap &domains = ConfMan.getGameDomains();
-
printf("Target Description \n"
"-------------------- ------------------------------------------------------\n");
+ using namespace Common;
+ const ConfigManager::DomainMap &domains = ConfMan.getGameDomains();
ConfigManager::DomainMap::const_iterator iter = domains.begin();
for (iter = domains.begin(); iter != domains.end(); ++iter) {
Common::String name(iter->_key);
diff --git a/base/plugins.cpp b/base/plugins.cpp
index d16ad791c8..25b8a7a5f8 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -60,8 +60,8 @@ typedef DetectedGameList (*DetectFunc)(const FSList &fslist);
#else
-PluginRegistrator::PluginRegistrator(const char *name, GameList games, GameIDQueryFunc qf, EngineFactory ef, DetectFunc df)
- : _name(name), _qf(qf), _ef(ef), _df(df), _games(games) {
+PluginRegistrator::PluginRegistrator(const char *name, const char *copyright, GameList games, GameIDQueryFunc qf, EngineFactory ef, DetectFunc df)
+ : _name(name), _copyright(copyright), _qf(qf), _ef(ef), _df(df), _games(games) {
//printf("Automatically registered plugin '%s'\n", name);
}
@@ -115,6 +115,7 @@ public:
}
const char *getName() const { return _plugin->_name; }
+ const char *getCopyright() const { return _plugin->_copyright; }
PluginError createInstance(OSystem *syst, Engine **engine) const {
assert(_plugin->_ef);
@@ -144,6 +145,7 @@ class DynamicPlugin : public Plugin {
Common::String _filename;
Common::String _name;
+ Common::String _copyright;
GameIDQueryFunc _qf;
EngineFactory _ef;
DetectFunc _df;
@@ -156,6 +158,7 @@ public:
: _dlHandle(0), _filename(filename), _qf(0), _ef(0), _df(0), _games() {}
const char *getName() const { return _name.c_str(); }
+ const char *getCopyright() const { return _copyright.c_str(); }
PluginError createInstance(OSystem *syst, Engine **engine) const {
assert(_ef);
@@ -226,6 +229,14 @@ bool DynamicPlugin::loadPlugin() {
}
_name = nameFunc();
+ // Query the plugin's copyright
+ nameFunc = (NameFunc)findSymbol("PLUGIN_copyright");
+ if (!nameFunc) {
+ unloadPlugin();
+ return false;
+ }
+ _copyright = nameFunc();
+
// Query the plugin for the game ids it supports
GameIDListFunc gameListFunc = (GameIDListFunc)findSymbol("PLUGIN_gameIDList");
if (!gameListFunc) {
@@ -316,7 +327,7 @@ void PluginManager::loadPlugins() {
}
for (FSList::const_iterator i = files.begin(); i != files.end(); ++i) {
- Common::String name(i->displayName());
+ Common::String name(i->name());
if (name.hasPrefix(PLUGIN_PREFIX) && name.hasSuffix(PLUGIN_SUFFIX)) {
tryLoadPlugin(new DynamicPlugin(i->path()));
}
diff --git a/base/plugins.h b/base/plugins.h
index b0178f3e89..944f4b0aa8 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -92,6 +92,7 @@ public:
virtual void unloadPlugin() {}
virtual const char *getName() const = 0;
+ virtual const char *getCopyright() const = 0;
virtual int getVersion() const { return 0; } // TODO!
virtual GameList getSupportedGames() const = 0;
@@ -127,10 +128,10 @@ public:
*/
#ifndef DYNAMIC_MODULES
-#define REGISTER_PLUGIN(ID,name) \
+#define REGISTER_PLUGIN(ID,name,copyright) \
PluginRegistrator *g_##ID##_PluginReg; \
void g_##ID##_PluginReg_alloc() { \
- g_##ID##_PluginReg = new PluginRegistrator(name, \
+ g_##ID##_PluginReg = new PluginRegistrator(name, copyright, \
Engine_##ID##_gameIDList(), \
Engine_##ID##_findGameID, \
Engine_##ID##_create, \
@@ -139,9 +140,10 @@ public:
} \
void dummyFuncToAllowTrailingSemicolon()
#else
-#define REGISTER_PLUGIN(ID,name) \
+#define REGISTER_PLUGIN(ID,name,copyright) \
extern "C" { \
PLUGIN_EXPORT const char *PLUGIN_name() { return name; } \
+ PLUGIN_EXPORT const char *PLUGIN_copyright() { return copyright; } \
PLUGIN_EXPORT GameList PLUGIN_gameIDList() { return Engine_##ID##_gameIDList(); } \
PLUGIN_EXPORT GameDescriptor PLUGIN_findGameID(const char *gameid) { return Engine_##ID##_findGameID(gameid); } \
PLUGIN_EXPORT PluginError PLUGIN_createEngine(OSystem *syst, Engine **engine) { return Engine_##ID##_create(syst, engine); } \
@@ -164,13 +166,14 @@ public:
protected:
const char *_name;
+ const char *_copyright;
GameIDQueryFunc _qf;
EngineFactory _ef;
DetectFunc _df;
GameList _games;
public:
- PluginRegistrator(const char *name, GameList games, GameIDQueryFunc qf, EngineFactory ef, DetectFunc df);
+ PluginRegistrator(const char *name, const char *copyright, GameList games, GameIDQueryFunc qf, EngineFactory ef, DetectFunc df);
};
#endif