[Scummvm-cvs-logs] SF.net SVN: scummvm: [21149] scummvm/trunk/base
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Wed Mar 8 17:44:00 CET 2006
Revision: 21149
Author: fingolfin
Date: 2006-03-08 17:42:56 -0800 (Wed, 08 Mar 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=21149&view=rev
Log Message:
-----------
- added new toDetectedGame() template function (analog to toGameSettings)
- made use of the new DetectedGame constructor from my last commit
- some related cleanup
Modified Paths:
--------------
scummvm/trunk/base/plugins.h
scummvm/trunk/engines/cine/cine.cpp
scummvm/trunk/engines/gob/gob.cpp
scummvm/trunk/engines/kyra/kyra.cpp
scummvm/trunk/engines/lure/lure.cpp
scummvm/trunk/engines/saga/game.cpp
scummvm/trunk/engines/saga/saga.h
scummvm/trunk/engines/scumm/plugin.cpp
scummvm/trunk/engines/simon/game.cpp
scummvm/trunk/engines/simon/simon.h
scummvm/trunk/engines/sword2/sword2.cpp
Modified: scummvm/trunk/base/plugins.h
===================================================================
--- scummvm/trunk/base/plugins.h 2006-03-09 01:34:33 UTC (rev 21148)
+++ scummvm/trunk/base/plugins.h 2006-03-09 01:42:56 UTC (rev 21149)
@@ -46,8 +46,7 @@
const char *description;
Common::Language language;
Common::Platform platform;
- DetectedGame() : language(Common::UNK_LANG), platform(Common::kPlatformUnknown) {}
- DetectedGame(const char *g, const char *d,
+ DetectedGame(const char *g = 0, const char *d = 0,
Common::Language l = Common::UNK_LANG,
Common::Platform p = Common::kPlatformUnknown)
: gameid(g), description(d), language(l), platform(p) {}
@@ -57,6 +56,13 @@
: gameid(game.gameid), description(game.description), language(l), platform(p) {}
};
+template <class T>
+DetectedGame toDetectedGame(const T &g) {
+ DetectedGame dummy(g.gameid, g.description);
+ return dummy;
+}
+
+
/** List of detected games. */
typedef Common::Array<DetectedGame> DetectedGameList;
Modified: scummvm/trunk/engines/cine/cine.cpp
===================================================================
--- scummvm/trunk/engines/cine/cine.cpp 2006-03-09 01:34:33 UTC (rev 21148)
+++ scummvm/trunk/engines/cine/cine.cpp 2006-03-09 01:42:56 UTC (rev 21149)
@@ -75,19 +75,12 @@
{NULL, NULL, 0, 0, NULL}
};
-// Keep list of different supported games
-static const GameSettings cine_list[] = {
- {"fw", "Future Wars"},
- {"os", "Operation Stealth"},
- {0, 0}
-};
-
GameList Engine_CINE_gameIDList() {
GameList games;
- const GameSettings *g = cine_list;
+ const CINEGameSettings *g = cine_settings;
- while (g->gameid) {
- games.push_back(*g);
+ while (g->name) {
+ games.push_back(g->toGameSettings());
g++;
}
@@ -95,13 +88,13 @@
}
GameSettings Engine_CINE_findGameID(const char *gameid) {
- const GameSettings *g = cine_list;
- while (g->gameid) {
- if (0 == scumm_stricmp(gameid, g->gameid))
+ const CINEGameSettings *g = cine_settings;
+ while (g->name) {
+ if (0 == scumm_stricmp(gameid, g->name))
break;
g++;
}
- return *g;
+ return g->toGameSettings();
}
DetectedGameList Engine_CINE_detectGames(const FSList &fslist) {
Modified: scummvm/trunk/engines/gob/gob.cpp
===================================================================
--- scummvm/trunk/engines/gob/gob.cpp 2006-03-09 01:34:33 UTC (rev 21148)
+++ scummvm/trunk/engines/gob/gob.cpp 2006-03-09 01:42:56 UTC (rev 21149)
@@ -60,10 +60,6 @@
const char *description;
uint32 features;
const char *md5sum;
- GameSettings toGameSettings() const {
- GameSettings dummy = { gameid, description };
- return dummy;
- }
};
static const GobGameSettings gob_games[] = {
@@ -326,7 +322,7 @@
}
for (g = gob_games; g->gameid; g++) {
if (strcmp(g->md5sum, (char *)md5str) == 0) {
- detectedGames.push_back(g->toGameSettings());
+ detectedGames.push_back(DetectedGame(g->gameid, g->description));
}
}
if (detectedGames.isEmpty()) {
Modified: scummvm/trunk/engines/kyra/kyra.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra.cpp 2006-03-09 01:34:33 UTC (rev 21148)
+++ scummvm/trunk/engines/kyra/kyra.cpp 2006-03-09 01:42:56 UTC (rev 21149)
@@ -181,7 +181,7 @@
}
for (g = kyra_games; g->gameid; g++) {
if (strcmp(g->md5sum, (char *)md5str) == 0) {
- detectedGames.push_back(DetectedGame(toGameSettings(*g), convertKyraLang(g->features), Common::kPlatformUnknown));
+ detectedGames.push_back(DetectedGame(g->gameid, g->description, convertKyraLang(g->features), Common::kPlatformUnknown));
}
}
if (detectedGames.isEmpty()) {
Modified: scummvm/trunk/engines/lure/lure.cpp
===================================================================
--- scummvm/trunk/engines/lure/lure.cpp 2006-03-09 01:34:33 UTC (rev 21148)
+++ scummvm/trunk/engines/lure/lure.cpp 2006-03-09 01:42:56 UTC (rev 21149)
@@ -125,7 +125,7 @@
}
for (g = lure_games; g->gameid; g++) {
if (strcmp(g->md5sum, (char *)md5str) == 0) {
- detectedGames.push_back(toGameSettings(*g));
+ detectedGames.push_back(toDetectedGame(*g));
}
}
if (detectedGames.isEmpty()) {
Modified: scummvm/trunk/engines/saga/game.cpp
===================================================================
--- scummvm/trunk/engines/saga/game.cpp 2006-03-09 01:34:33 UTC (rev 21148)
+++ scummvm/trunk/engines/saga/game.cpp 2006-03-09 01:42:56 UTC (rev 21149)
@@ -1654,10 +1654,12 @@
// and now push them into list of detected games
for (i = 0; i < index; i++)
- if (matches[i] != -1)
- detectedGames.push_back(DetectedGame(gameDescriptions[matches[i]].toGameSettings(),
- gameDescriptions[matches[i]].language,
- gameDescriptions[matches[i]].platform));
+ if (matches[i] != -1) {
+ GameDescription &g = gameDescriptions[matches[i]];
+ detectedGames.push_back(DetectedGame(g.name, g.title,
+ g.language,
+ g.platform));
+ }
if (retmatches) {
*retmatches = (int *)calloc(ARRAYSIZE(gameDescriptions), sizeof(int));
Modified: scummvm/trunk/engines/saga/saga.h
===================================================================
--- scummvm/trunk/engines/saga/saga.h 2006-03-09 01:34:33 UTC (rev 21148)
+++ scummvm/trunk/engines/saga/saga.h 2006-03-09 01:42:56 UTC (rev 21149)
@@ -516,11 +516,6 @@
uint32 features;
Common::Language language;
Common::Platform platform;
-
- GameSettings toGameSettings() const {
- GameSettings dummy = { name, title };
- return dummy;
- }
};
struct SaveFileData {
Modified: scummvm/trunk/engines/scumm/plugin.cpp
===================================================================
--- scummvm/trunk/engines/scumm/plugin.cpp 2006-03-09 01:34:33 UTC (rev 21148)
+++ scummvm/trunk/engines/scumm/plugin.cpp 2006-03-09 01:42:56 UTC (rev 21149)
@@ -861,11 +861,6 @@
error("Unknown gameid encountered in findDescriptionFromGameID");
}
-static GameSettings toGameSettings(const ScummGameSettings &g) {
- GameSettings dummy = { g.gameid, findDescriptionFromGameID(g.gameid) };
- return dummy;
-}
-
static int compareMD5Table(const void *a, const void *b) {
const char *key = (const char *)a;
const MD5Table *elem = (const MD5Table *)b;
@@ -1139,26 +1134,27 @@
}
// Match found, add to list of candidates, then abort inner loop.
+ const char *desc = findDescriptionFromGameID(g->gameid);
if (substLastIndex > 0 && // HE Mac versions.
(subst.genMethod == kGenMac ||
subst.genMethod == kGenMacNoParens)) {
- detectedGames.push_back(DetectedGame(toGameSettings(*g),
+ detectedGames.push_back(DetectedGame(g->gameid, desc,
Common::UNK_LANG,
Common::kPlatformMacintosh));
fileSet[file->path()] = true;
} else if (substLastIndex == 0 && g->id == GID_MANIAC &&
(buf[0] == 0xbc || buf[0] == 0xa0)) {
- detectedGames.push_back(DetectedGame(toGameSettings(*g),
+ detectedGames.push_back(DetectedGame(g->gameid, desc,
Common::UNK_LANG,
Common::kPlatformNES));
} else if ((g->id == GID_MANIAC || g->id == GID_ZAK) &&
((buf[0] == 0x31 && buf[1] == 0x0a) ||
(buf[0] == 0xcd && buf[1] == 0xfe))) {
- detectedGames.push_back(DetectedGame(toGameSettings(*g),
+ detectedGames.push_back(DetectedGame(g->gameid, desc,
Common::UNK_LANG,
Common::kPlatformC64));
} else {
- detectedGames.push_back(toGameSettings(*g));
+ detectedGames.push_back(DetectedGame(g->gameid, desc));
fileSet[file->path()] = false;
}
break;
@@ -1200,10 +1196,11 @@
}
assert(g->gameid);
// Insert the 'enhanced' game data into the candidate list
+ const char *desc = findDescriptionFromGameID(g->gameid);
if (iter->_value == true) // This was HE Mac game
- detectedGames.push_back(DetectedGame(toGameSettings(*g), elem->language, Common::kPlatformMacintosh));
+ detectedGames.push_back(DetectedGame(g->gameid, desc, elem->language, Common::kPlatformMacintosh));
else
- detectedGames.push_back(DetectedGame(toGameSettings(*g), elem->language, elem->platform));
+ detectedGames.push_back(DetectedGame(g->gameid, desc, elem->language, elem->platform));
exactMatch = true;
}
}
Modified: scummvm/trunk/engines/simon/game.cpp
===================================================================
--- scummvm/trunk/engines/simon/game.cpp 2006-03-09 01:34:33 UTC (rev 21148)
+++ scummvm/trunk/engines/simon/game.cpp 2006-03-09 01:42:56 UTC (rev 21149)
@@ -1069,10 +1069,12 @@
// and now push them into list of detected games
for (i = 0; i < index; i++)
- if (matches[i] != -1)
- detectedGames.push_back(DetectedGame(gameDescriptions[matches[i]].toGameSettings(),
- gameDescriptions[matches[i]].language,
- gameDescriptions[matches[i]].platform));
+ if (matches[i] != -1) {
+ GameDescription &g = gameDescriptions[matches[i]];
+ detectedGames.push_back(DetectedGame(g.name, g.title,
+ g.language,
+ g.platform));
+ }
if (retmatches) {
*retmatches = (int *)calloc(ARRAYSIZE(gameDescriptions), sizeof(int));
Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h 2006-03-09 01:34:33 UTC (rev 21148)
+++ scummvm/trunk/engines/simon/simon.h 2006-03-09 01:42:56 UTC (rev 21149)
@@ -126,11 +126,6 @@
uint32 features;
Common::Language language;
Common::Platform platform;
-
- GameSettings toGameSettings() const {
- GameSettings dummy = { name, title };
- return dummy;
- }
};
DetectedGameList GAME_ProbeGame(const FSList &fslist, int **matches = NULL);
Modified: scummvm/trunk/engines/sword2/sword2.cpp
===================================================================
--- scummvm/trunk/engines/sword2/sword2.cpp 2006-03-09 01:34:33 UTC (rev 21148)
+++ scummvm/trunk/engines/sword2/sword2.cpp 2006-03-09 01:42:56 UTC (rev 21149)
@@ -99,7 +99,7 @@
if (0 == scumm_stricmp(g->detectname, gameName)) {
// Match found, add to list of candidates, then abort inner loop.
- detectedGames.push_back(toGameSettings(*g));
+ detectedGames.push_back(toDetectedGame(*g));
break;
}
}
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