aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorMax Horn2003-12-21 15:29:52 +0000
committerMax Horn2003-12-21 15:29:52 +0000
commitf19f73eb5069b4f092714535e77efc0d6881c612 (patch)
treeee5e418571bb6ebdb8bb6b8e72cb926ef31f2bd7 /base
parent7b498fe7db91fa3e52d2c69bc9980f4609acc288 (diff)
downloadscummvm-rg350-f19f73eb5069b4f092714535e77efc0d6881c612.tar.gz
scummvm-rg350-f19f73eb5069b4f092714535e77efc0d6881c612.tar.bz2
scummvm-rg350-f19f73eb5069b4f092714535e77efc0d6881c612.zip
Make it possible for game detection functions to detect language/platform (not yet done by any detector, but will come with the MD5 detection code)
svn-id: r11811
Diffstat (limited to 'base')
-rw-r--r--base/gameDetector.cpp2
-rw-r--r--base/gameDetector.h2
-rw-r--r--base/plugins.cpp19
-rw-r--r--base/plugins.h29
4 files changed, 44 insertions, 8 deletions
diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp
index 79e8ca9eee..7dabde7f39 100644
--- a/base/gameDetector.cpp
+++ b/base/gameDetector.cpp
@@ -158,7 +158,7 @@ GameDetector::GameDetector() {
ConfMan.registerDefault("platform", Common::kPlatformPC);
ConfMan.registerDefault("language", "en");
// ConfMan.registerDefault("nosubtitles", false);
- ConfMan.registerDefault("subtitles", false);
+ ConfMan.registerDefault("subtitles", true);
ConfMan.registerDefault("boot_param", 0);
ConfMan.registerDefault("save_slot", -1);
diff --git a/base/gameDetector.h b/base/gameDetector.h
index e6cf2b3ace..903aaed508 100644
--- a/base/gameDetector.h
+++ b/base/gameDetector.h
@@ -34,6 +34,8 @@ class Plugin;
/** Global (shared) game feature flags. */
enum {
+// GF_HAS_SPEECH = 1 << 29,
+// GF_HAS_SUBTITLES = 1 << 30,
GF_DEFAULT_TO_1X_SCALER = 1 << 31
};
diff --git a/base/plugins.cpp b/base/plugins.cpp
index 9769293a70..7968eb8e00 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -32,7 +32,7 @@ typedef Engine *(*EngineFactory)(GameDetector *detector, OSystem *syst);
typedef const char *(*NameFunc)();
typedef GameList (*TargetListFunc)();
-typedef GameList (*DetectFunc)(const FSList &fslist);
+typedef DetectedGameList (*DetectFunc)(const FSList &fslist);
#ifdef DYNAMIC_MODULES
@@ -81,7 +81,7 @@ public:
}
GameList getSupportedGames() const { return _games; }
- GameList detectGames(const FSList &fslist) const {
+ DetectedGameList detectGames(const FSList &fslist) const {
return (*_df)(fslist);
}
};
@@ -113,7 +113,7 @@ public:
}
GameList getSupportedGames() const { return _games; }
- GameList detectGames(const FSList &fslist) const {
+ DetectedGameList detectGames(const FSList &fslist) const {
assert(_df);
return (*_df)(fslist);
}
@@ -275,3 +275,16 @@ bool PluginManager::tryLoadPlugin(Plugin *plugin) {
return false;
}
}
+
+DetectedGameList PluginManager::detectGames(const FSList &fslist) const {
+ DetectedGameList candidates;
+
+ // Iterate over all known games and for each check if it might be
+ // the game in the presented directory.
+ PluginList::ConstIterator iter;
+ for (iter = _plugins.begin(); iter != _plugins.end(); ++iter) {
+ candidates.push_back((*iter)->detectGames(fslist));
+ }
+
+ return candidates;
+}
diff --git a/base/plugins.h b/base/plugins.h
index 3852934e49..7629cac8a0 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -25,6 +25,7 @@
#include "common/list.h"
#include "common/singleton.h"
+#include "common/util.h"
class Engine;
class FSList;
@@ -32,10 +33,28 @@ class GameDetector;
class OSystem;
struct GameSettings;
-/** List of GameSettings- */
+/** List of games. */
typedef Common::List<GameSettings> GameList;
/**
+ * A detected game. Carries the GameSettings, but also (optionally)
+ * information about the language and platform of the detected game.
+ */
+struct DetectedGame : GameSettings {
+ Common::Language language;
+ Common::Platform platform;
+ DetectedGame() : language(Common::UNK_LANG), platform(Common::kPlatformUnknown) {}
+ DetectedGame(const GameSettings &game,
+ Common::Language l = Common::UNK_LANG,
+ Common::Platform p = Common::kPlatformUnknown)
+ : GameSettings(game), language(l), platform(p) {}
+};
+
+/** List of detected games. */
+typedef Common::List<DetectedGame> DetectedGameList;
+
+
+/**
* Abstract base class for the plugin system.
* Subclasses for this can be used to wrap both static and dynamic
* plugins.
@@ -52,7 +71,7 @@ public:
virtual GameList getSupportedGames() const = 0;
virtual GameSettings findGame(const char *gameName) const;
- virtual GameList detectGames(const FSList &fslist) const = 0;
+ virtual DetectedGameList detectGames(const FSList &fslist) const = 0;
virtual Engine *createInstance(GameDetector *detector, OSystem *syst) const = 0;
};
@@ -75,7 +94,7 @@ public:
const char *PLUGIN_name() { return name; } \
GameList PLUGIN_getSupportedGames() { return gameListFactory(); } \
Engine *PLUGIN_createEngine(GameDetector *detector, OSystem *syst) { return engineFactory(detector, syst); } \
- GameList PLUGIN_detectGames(const FSList &fslist) { return detectGames(fslist); } \
+ DetectedGameList PLUGIN_detectGames(const FSList &fslist) { return detectGames(fslist); } \
}
#endif
@@ -106,6 +125,8 @@ public:
void unloadPlugins();
const PluginList &getPlugins() { return _plugins; }
+
+ DetectedGameList detectGames(const FSList &fslist) const;
};
@@ -114,7 +135,7 @@ public:
#define DECLARE_PLUGIN(name) \
extern GameList Engine_##name##_gameList(); \
extern Engine *Engine_##name##_create(GameDetector *detector, OSystem *syst); \
- extern GameList Engine_##name##_detectGames(const FSList &fslist);
+ extern DetectedGameList Engine_##name##_detectGames(const FSList &fslist);
// Factory functions => no need to include the specific classes
// in this header. This serves two purposes: