aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorEugene Sandulenko2007-01-20 21:27:57 +0000
committerEugene Sandulenko2007-01-20 21:27:57 +0000
commitcd8a5f3a98287fe7366db100c2fb45ff986e2d1b (patch)
treec3acca9454ff39fc71da8444eb98494683a6261f /common
parent47b1321d1520eabcfa4d971bd945f4461eeada49 (diff)
downloadscummvm-rg350-cd8a5f3a98287fe7366db100c2fb45ff986e2d1b.tar.gz
scummvm-rg350-cd8a5f3a98287fe7366db100c2fb45ff986e2d1b.tar.bz2
scummvm-rg350-cd8a5f3a98287fe7366db100c2fb45ff986e2d1b.zip
First phase of detection-related plugins interface improvements. Now plugins
return StringMap instead of fixed list of parameters. This adds great flexibility. Current patch should not alter any functionality, i.e. if there are regressions, submit a report. Phase 2 will benefit from these changes and will come later. svn-id: r25134
Diffstat (limited to 'common')
-rw-r--r--common/advancedDetector.cpp30
-rw-r--r--common/advancedDetector.h6
2 files changed, 18 insertions, 18 deletions
diff --git a/common/advancedDetector.cpp b/common/advancedDetector.cpp
index 81994f1378..ff46517e61 100644
--- a/common/advancedDetector.cpp
+++ b/common/advancedDetector.cpp
@@ -34,7 +34,7 @@
namespace Common {
PluginError ADVANCED_DETECTOR_ENGINE_CREATE(
- DetectedGameList (*detectFunc)(const FSList &fslist),
+ GameList (*detectFunc)(const FSList &fslist),
const Common::ADObsoleteGameID *obsoleteList
) {
const char *gameid = ConfMan.get("gameid").c_str();
@@ -61,10 +61,10 @@ PluginError ADVANCED_DETECTOR_ENGINE_CREATE(
return kInvalidPathError;
}
- DetectedGameList detectedGames = detectFunc(fslist);
+ GameList detectedGames = detectFunc(fslist);
for (uint i = 0; i < detectedGames.size(); i++) {
- if (detectedGames[i].gameid == gameid) {
+ if (detectedGames[i].gameid() == gameid) {
return kNoError;
}
}
@@ -89,18 +89,18 @@ GameDescriptor ADVANCED_DETECTOR_FIND_GAMEID(
const Common::ADObsoleteGameID *o = obsoleteList;
while (o->from) {
if (0 == scumm_stricmp(gameid, o->from)) {
- gs.gameid = gameid;
- gs.description = "Obsolete game ID";
+ gs["gameid"] = gameid;
+ gs["description"] = "Obsolete game ID";
return gs;
}
o++;
}
} else
- return *g;
+ return GameDescriptor(g->gameid, g->description);
return gs;
}
-static DetectedGame toDetectedGame(const ADGameDescription &g, const PlainGameDescriptor *sg) {
+static GameDescriptor toGameDescriptor(const ADGameDescription &g, const PlainGameDescriptor *sg) {
const char *title = 0;
while (sg->gameid) {
@@ -109,19 +109,19 @@ static DetectedGame toDetectedGame(const ADGameDescription &g, const PlainGameDe
sg++;
}
- DetectedGame dg(g.gameid, title, g.language, g.platform);
- dg.updateDesc(g.extra);
- return dg;
+ GameDescriptor gd(g.gameid, title, g.language, g.platform);
+ gd.updateDesc(g.extra);
+ return gd;
}
-DetectedGameList ADVANCED_DETECTOR_DETECT_GAMES_FUNCTION(
+GameList ADVANCED_DETECTOR_DETECT_GAMES_FUNCTION(
const FSList &fslist,
const byte *descs,
const int descItemSize,
const int md5Bytes,
const PlainGameDescriptor *list
) {
- DetectedGameList detectedGames;
+ GameList detectedGames;
Common::AdvancedDetector ad;
Common::ADList matches;
Common::ADGameDescList descList;
@@ -137,7 +137,7 @@ DetectedGameList ADVANCED_DETECTOR_DETECT_GAMES_FUNCTION(
matches = ad.detectGame(&fslist, md5Bytes, Common::UNK_LANG, Common::kPlatformUnknown);
for (uint i = 0; i < matches.size(); i++)
- detectedGames.push_back(toDetectedGame(*(const ADGameDescription *)(descs + matches[i] * descItemSize), list));
+ detectedGames.push_back(toGameDescriptor(*(const ADGameDescription *)(descs + matches[i] * descItemSize), list));
return detectedGames;
}
@@ -150,7 +150,7 @@ int ADVANCED_DETECTOR_DETECT_INIT_GAME(
) {
int gameNumber = -1;
- DetectedGameList detectedGames;
+ GameList detectedGames;
Common::AdvancedDetector ad;
Common::ADList matches;
Common::ADGameDescList descList;
@@ -184,7 +184,7 @@ int ADVANCED_DETECTOR_DETECT_INIT_GAME(
error("TODO invalid gameNumber %d (max. expected value: %d)", gameNumber, descList.size());
}
- debug(2, "Running %s", toDetectedGame(*(const ADGameDescription *)(descs + gameNumber * descItemSize), list).description.c_str());
+ debug(2, "Running %s", toGameDescriptor(*(const ADGameDescription *)(descs + gameNumber * descItemSize), list).description().c_str());
return gameNumber;
}
diff --git a/common/advancedDetector.h b/common/advancedDetector.h
index 1b9403c322..8bf347884c 100644
--- a/common/advancedDetector.h
+++ b/common/advancedDetector.h
@@ -102,7 +102,7 @@ GameDescriptor ADVANCED_DETECTOR_FIND_GAMEID(
// FIXME/TODO: Rename this function to something more sensible.
// Possibly move it inside class AdvancedDetector ?
-DetectedGameList ADVANCED_DETECTOR_DETECT_GAMES_FUNCTION(
+GameList ADVANCED_DETECTOR_DETECT_GAMES_FUNCTION(
const FSList &fslist,
const byte *descs,
const int descItemSize,
@@ -123,7 +123,7 @@ int ADVANCED_DETECTOR_DETECT_INIT_GAME(
// FIXME/TODO: Rename this function to something more sensible.
// Possibly move it inside class AdvancedDetector ?
PluginError ADVANCED_DETECTOR_ENGINE_CREATE(
- DetectedGameList (*detectFunc)(const FSList &fslist),
+ GameList (*detectFunc)(const FSList &fslist),
const Common::ADObsoleteGameID *obsoleteList
);
@@ -135,7 +135,7 @@ PluginError ADVANCED_DETECTOR_ENGINE_CREATE(
GameDescriptor Engine_##engine##_findGameID(const char *gameid) { \
return Common::ADVANCED_DETECTOR_FIND_GAMEID(gameid,list,obsoleteList); \
} \
- DetectedGameList Engine_##engine##_detectGames(const FSList &fslist) { \
+ GameList Engine_##engine##_detectGames(const FSList &fslist) { \
return detectFunc(fslist); \
} \
PluginError Engine_##engine##_create(OSystem *syst, Engine **engine) { \