[Scummvm-cvs-logs] SF.net SVN: scummvm: [30779] scummvm/trunk/common
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sun Feb 3 19:37:41 CET 2008
Revision: 30779
http://scummvm.svn.sourceforge.net/scummvm/?rev=30779&view=rev
Author: fingolfin
Date: 2008-02-03 10:37:41 -0800 (Sun, 03 Feb 2008)
Log Message:
-----------
Made some advanced detector stuff internal (for now), as it is only used by AdvancedMetaEngine. Also removed obsolete ADVANCED_DETECTOR_DEFINE_PLUGIN macro
Modified Paths:
--------------
scummvm/trunk/common/advancedDetector.cpp
scummvm/trunk/common/advancedDetector.h
Modified: scummvm/trunk/common/advancedDetector.cpp
===================================================================
--- scummvm/trunk/common/advancedDetector.cpp 2008-02-03 18:24:54 UTC (rev 30778)
+++ scummvm/trunk/common/advancedDetector.cpp 2008-02-03 18:37:41 UTC (rev 30779)
@@ -36,6 +36,12 @@
namespace AdvancedDetector {
+// FIXME/TODO: Rename this function to something more sensible.
+// Helper function to announce an unknown version of the game (useful for
+// fallback detection functions).
+void reportUnknown(StringList &files, int md5Bytes);
+
+
/**
* Detect games in specified directory.
* Parameters language and platform are used to pass on values
@@ -51,6 +57,10 @@
static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams ¶ms, Language language, Platform platform, const Common::String extra);
+/**
+ * Returns list of targets supported by the engine.
+ * Distinguishes engines with single ID
+ */
GameList gameIDList(const Common::ADParams ¶ms) {
if (params.singleid != NULL) {
GameList gl;
@@ -555,4 +565,27 @@
} // End of namespace AdvancedDetector
+GameList AdvancedMetaEngine::getSupportedGames() const {
+ return Common::AdvancedDetector::gameIDList(params);
+}
+GameDescriptor AdvancedMetaEngine::findGame(const char *gameid) const {
+ return Common::AdvancedDetector::findGameID(gameid, params.list, params.obsoleteList);
+}
+GameList AdvancedMetaEngine::detectGames(const FSList &fslist) const {
+ return Common::AdvancedDetector::detectAllGames(fslist, params);
+}
+
+PluginError AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) const {
+ assert(engine);
+ Common::AdvancedDetector::upgradeTargetIfNecessary(params);
+ Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(params);
+ if (encapsulatedDesc.realDesc == 0) {
+ return kNoGameDataFoundError;
+ }
+ if (!createInstance(syst,engine,encapsulatedDesc)) {
+ return kNoGameDataFoundError;
+ }
+ return kNoError;
+}
+
} // End of namespace Common
Modified: scummvm/trunk/common/advancedDetector.h
===================================================================
--- scummvm/trunk/common/advancedDetector.h 2008-02-03 18:24:54 UTC (rev 30778)
+++ scummvm/trunk/common/advancedDetector.h 2008-02-03 18:37:41 UTC (rev 30779)
@@ -134,7 +134,8 @@
/**
* A structure containing all parameters for the AdvancedDetector.
* Typically, an engine will have a single instance of this which is
- * then passed to the various AdvancedDetector functions.
+ * used by its AdvancedMetaEngine subclass as a parameter to the
+ * primary AdvancedMetaEngine constructor.
*/
struct ADParams {
/**
@@ -200,7 +201,8 @@
* @note The fslist parameter may be 0 -- in that case, it is assumed
* that the callback searchs the current directory.
*
- * @todo
+ * @todo Change this to a member method of AdvancedMetaEngine which can
+ * be overriden via subclassing.
*/
EncapsulatedADGameDesc (*fallbackDetectFunc)(const FSList *fslist);
@@ -216,14 +218,8 @@
namespace AdvancedDetector {
/**
- * Returns list of targets supported by the engine.
- * Distinguishes engines with single ID
- */
-GameList gameIDList(const Common::ADParams ¶ms);
-
-/**
* Scan through the game descriptors specified in params and search for
- * 'gameid' in there. If a match is found, returns a GameDescriptor
+ * 'gameid' in there. If a match is found, returns a GameDescriptor
* with gameid and description set.
*/
GameDescriptor findGameID(
@@ -232,46 +228,8 @@
const Common::ADObsoleteGameID *obsoleteList = 0
);
-// FIXME/TODO: Rename this function to something more sensible.
-GameList detectAllGames(const FSList &fslist, const Common::ADParams ¶ms);
-
-// FIXME/TODO: Rename this function to something more sensible.
-EncapsulatedADGameDesc detectBestMatchingGame(const Common::ADParams ¶ms);
-
-void upgradeTargetIfNecessary(const Common::ADParams ¶ms);
-
-// FIXME/TODO: Rename this function to something more sensible.
-// Helper function to announce an unknown version of the game (useful for
-// fallback detection functions).
-void reportUnknown(StringList &files, int md5Bytes);
-
} // End of namespace AdvancedDetector
-
-#define ADVANCED_DETECTOR_DEFINE_PLUGIN(engine,factoryFunc,params) \
- GameList Engine_##engine##_gameIDList() { \
- return Common::AdvancedDetector::gameIDList(params); \
- } \
- GameDescriptor Engine_##engine##_findGameID(const char *gameid) { \
- return Common::AdvancedDetector::findGameID(gameid, params.list, params.obsoleteList); \
- } \
- GameList Engine_##engine##_detectGames(const FSList &fslist) { \
- return Common::AdvancedDetector::detectAllGames(fslist, params); \
- } \
- PluginError Engine_##engine##_create(OSystem *syst, Engine **engine) { \
- assert(engine); \
- Common::AdvancedDetector::upgradeTargetIfNecessary(params); \
- Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(params); \
- if (encapsulatedDesc.realDesc == 0) { \
- return kNoGameDataFoundError; \
- } \
- if (!factoryFunc(syst,engine,encapsulatedDesc)) { \
- return kNoGameDataFoundError; \
- } \
- return kNoError; \
- } \
- void dummyFuncToAllowTrailingSemicolon()
-
/**
* A MetaEngine implementation based around the advanced detector code.
*/
@@ -280,33 +238,13 @@
public:
AdvancedMetaEngine(const Common::ADParams &dp) : params(dp) {}
+ virtual GameList getSupportedGames() const;
+ virtual GameDescriptor findGame(const char *gameid) const;
+ virtual GameList detectGames(const FSList &fslist) const;
+ virtual PluginError createInstance(OSystem *syst, Engine **engine) const;
+
// To be provided by subclasses
virtual bool createInstance(OSystem *syst, Engine **engine, const Common::EncapsulatedADGameDesc &encapsulatedDesc) const = 0;
-
-
-protected:
- virtual GameList getSupportedGames() const {
- return Common::AdvancedDetector::gameIDList(params);
- }
- virtual GameDescriptor findGame(const char *gameid) const {
- return Common::AdvancedDetector::findGameID(gameid, params.list, params.obsoleteList);
- }
- virtual GameList detectGames(const FSList &fslist) const {
- return Common::AdvancedDetector::detectAllGames(fslist, params);
- }
-
- virtual PluginError createInstance(OSystem *syst, Engine **engine) const {
- assert(engine);
- Common::AdvancedDetector::upgradeTargetIfNecessary(params);
- Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(params);
- if (encapsulatedDesc.realDesc == 0) {
- return kNoGameDataFoundError;
- }
- if (!createInstance(syst,engine,encapsulatedDesc)) {
- return kNoGameDataFoundError;
- }
- return kNoError;
- }
};
} // End of namespace Common
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list