aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2006-03-09 02:52:51 +0000
committerMax Horn2006-03-09 02:52:51 +0000
commit86565fcca57454e91124410cfd6864ef1e202dc0 (patch)
tree83cc82217179d56f23836628520b7f63b4a0607d
parentd2f78184af00cd91f3f1f251199a436b53f4ae64 (diff)
downloadscummvm-rg350-86565fcca57454e91124410cfd6864ef1e202dc0.tar.gz
scummvm-rg350-86565fcca57454e91124410cfd6864ef1e202dc0.tar.bz2
scummvm-rg350-86565fcca57454e91124410cfd6864ef1e202dc0.zip
- Renamed GameSettings to PlainGameDescriptor
- Added new GameDescriptor struct (similar to PlainGameDescriptor but with Common::String members instead of const char * ones) - Changed DetectedGame to subclass GameDescriptor - Removed toGameSettings() in favor of new (template) constructors in DetectedGame and GameDescriptor - Fixed a bug in the obsolete gameid handling in the SCUMM & SIMON engines svn-id: r21150
-rw-r--r--base/gameDetector.cpp22
-rw-r--r--base/gameDetector.h39
-rw-r--r--base/main.cpp4
-rw-r--r--base/plugins.cpp6
-rw-r--r--base/plugins.h34
-rw-r--r--engines/cine/cine.cpp13
-rw-r--r--engines/gob/gob.cpp10
-rw-r--r--engines/kyra/kyra.cpp10
-rw-r--r--engines/lure/lure.cpp12
-rw-r--r--engines/queen/queen.cpp9
-rw-r--r--engines/saga/saga.cpp8
-rw-r--r--engines/scumm/plugin.cpp27
-rw-r--r--engines/simon/simon.cpp16
-rw-r--r--engines/sky/sky.cpp7
-rw-r--r--engines/sword1/sword1.cpp9
-rw-r--r--engines/sword2/sword2.cpp8
-rw-r--r--gui/launcher.cpp23
17 files changed, 126 insertions, 131 deletions
diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp
index d787f257e1..b5b2854d39 100644
--- a/base/gameDetector.cpp
+++ b/base/gameDetector.cpp
@@ -239,7 +239,7 @@ void listGames() {
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
GameList list = (*iter)->getSupportedGames();
for (GameList::iterator v = list.begin(); v != list.end(); ++v) {
- printf("%-20s %s\n", v->gameid, v->description);
+ printf("%-20s %s\n", v->gameid.c_str(), v->description.c_str());
}
}
}
@@ -262,8 +262,8 @@ void listTargets() {
// to find the proper desc. In fact, the platform probably should
// be taken into account, too.
String gameid(name);
- GameSettings g = GameDetector::findGame(gameid);
- if (g.description)
+ GameDescriptor g = GameDetector::findGame(gameid);
+ if (g.description.size() > 0)
description = g.description;
}
@@ -271,15 +271,15 @@ void listTargets() {
}
}
-GameSettings GameDetector::findGame(const String &gameName, const Plugin **plugin) {
- // Find the GameSettings for this target
+GameDescriptor GameDetector::findGame(const String &gameName, const Plugin **plugin) {
+ // Find the GameDescriptor for this target
const PluginList &plugins = PluginManager::instance().getPlugins();
- GameSettings result = {NULL, NULL};
+ GameDescriptor result;
PluginList::const_iterator iter = plugins.begin();
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
result = (*iter)->findGame(gameName.c_str());
- if (result.gameid) {
+ if (result.gameid.size() > 0) {
if (plugin)
*plugin = *iter;
break;
@@ -384,7 +384,7 @@ void GameDetector::parseCommandLine(int argc, char **argv) {
// To verify this, check if there is either a game domain (i.e.
// a configured target) matching this argument, or if we can
// find any target with that name.
- if (i == (argc - 1) && (ConfMan.hasGameDomain(s) || findGame(s).gameid)) {
+ if (i == (argc - 1) && (ConfMan.hasGameDomain(s) || findGame(s).gameid.size() > 0)) {
setTarget(s);
} else {
if (current_option == NULL)
@@ -641,15 +641,15 @@ bool GameDetector::detectMain() {
_gameid = _targetName;
printf("Looking for %s\n", _gameid.c_str());
- GameSettings game = findGame(_gameid, &_plugin);
+ GameDescriptor game = findGame(_gameid, &_plugin);
- if (!game.gameid) {
+ if (game.gameid.size() == 0) {
printf("Failed game detection\n");
warning("%s is an invalid target. Use the --list-targets option to list targets", _targetName.c_str());
return false;
}
- printf("Trying to start game '%s'\n", game.description);
+ printf("Trying to start game '%s'\n", game.description.c_str());
String gameDataPath(ConfMan.get("path"));
if (gameDataPath.isEmpty()) {
diff --git a/base/gameDetector.h b/base/gameDetector.h
index 0cada3e597..6eb9c5c231 100644
--- a/base/gameDetector.h
+++ b/base/gameDetector.h
@@ -34,25 +34,32 @@ namespace Audio {
class Mixer;
}
-struct GameSettings {
+struct PlainGameDescriptor {
const char *gameid;
const char *description; // TODO: Rename this to "title" or so
};
-/**
- * This template function allows to easily convert structs that mimic GameSettings
- * to a GameSettings instance.
- *
- * Normally, one would just subclass GameSettings to get this effect much easier.
- * However, subclassing a struct turns it into a non-POD type. One of the
- * consequences is that you can't have inline intialized arrays of that type.
- * But we heavily rely on those, hence we can't subclass GameSettings...
- */
-template <class T>
-GameSettings toGameSettings(const T &g) {
- GameSettings dummy = { g.gameid, g.description };
- return dummy;
-}
+struct GameDescriptor {
+ Common::String gameid;
+ Common::String description; // TODO: Rename this to "title" or so
+
+ GameDescriptor() {}
+ GameDescriptor(Common::String g, Common::String d) :
+ gameid(g), description(d) {}
+
+ /**
+ * This template constructor allows to easily convert structs that mimic GameDescriptor
+ * to a GameDescriptor instance.
+ *
+ * Normally, one would just subclass GameDescriptor to get this effect much easier.
+ * However, subclassing a struct turns it into a non-POD type. One of the
+ * consequences is that you can't have inline intialized arrays of that type.
+ * But we heavily rely on those, hence we can't subclass GameDescriptor...
+ */
+ template <class T>
+ GameDescriptor(const T &g) :
+ gameid(g.gameid), description(g.description) {}
+};
class GameDetector {
@@ -78,7 +85,7 @@ public:
static Audio::Mixer *createMixer();
- static GameSettings findGame(const String &gameName, const Plugin **plugin = NULL);
+ static GameDescriptor findGame(const String &gameName, const Plugin **plugin = NULL);
//protected:
void setTarget(const String &name); // TODO: This should be protected
diff --git a/base/main.cpp b/base/main.cpp
index 50a4c9f4e5..d32849dfb0 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -291,8 +291,8 @@ static int runGame(GameDetector &detector, OSystem &system, const Common::String
// Set the window caption to the game name
Common::String caption(ConfMan.get("description", detector._targetName));
- const char *desc = GameDetector::findGame(detector._gameid).description;
- if (caption.isEmpty() && desc)
+ Common::String desc = GameDetector::findGame(detector._gameid).description;
+ if (caption.isEmpty() && !desc.isEmpty())
caption = desc;
if (caption.isEmpty())
caption = detector._targetName;
diff --git a/base/plugins.cpp b/base/plugins.cpp
index 802b2f8d9d..0f1fc62b18 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 GameSettings (*GameIDQueryFunc)(const char *gameid);
+typedef GameDescriptor (*GameIDQueryFunc)(const char *gameid);
typedef GameList (*GameIDListFunc)();
typedef DetectedGameList (*DetectFunc)(const FSList &fslist);
@@ -93,7 +93,7 @@ public:
GameList getSupportedGames() const { return _plugin->_games; }
- GameSettings findGame(const char *gameid) const {
+ GameDescriptor findGame(const char *gameid) const {
assert(_plugin->_qf);
return (*_plugin->_qf)(gameid);
}
@@ -134,7 +134,7 @@ public:
GameList getSupportedGames() const { return _games; }
- GameSettings findGame(const char *gameid) const {
+ GameDescriptor findGame(const char *gameid) const {
assert(_qf);
return (*_qf)(gameid);
}
diff --git a/base/plugins.h b/base/plugins.h
index 4ac93baaf3..5cc362ca58 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -27,7 +27,7 @@
#include "common/array.h"
#include "common/singleton.h"
#include "common/util.h"
-#include "base/gameDetector.h" // For GameSettings
+#include "base/gameDetector.h" // For GameDescriptor
class Engine;
class FSList;
@@ -35,33 +35,27 @@ class GameDetector;
class OSystem;
/** List of games. */
-typedef Common::Array<GameSettings> GameList;
+typedef Common::Array<GameDescriptor> GameList;
/**
- * A detected game. Carries the GameSettings, but also (optionally)
+ * A detected game. Carries the GameDescriptor, but also (optionally)
* information about the language and platform of the detected game.
*/
-struct DetectedGame {
- const char *gameid;
- const char *description;
+struct DetectedGame : public GameDescriptor {
Common::Language language;
Common::Platform platform;
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) {}
- DetectedGame(const GameSettings &game,
+ : GameDescriptor(g, d), language(l), platform(p) {}
+
+ template <class T>
+ DetectedGame(const T &game,
Common::Language l = Common::UNK_LANG,
Common::Platform p = Common::kPlatformUnknown)
- : gameid(game.gameid), description(game.description), language(l), platform(p) {}
+ : GameDescriptor(game.gameid, 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;
@@ -83,7 +77,7 @@ public:
virtual int getVersion() const { return 0; } // TODO!
virtual GameList getSupportedGames() const = 0;
- virtual GameSettings findGame(const char *gameid) const = 0;
+ virtual GameDescriptor findGame(const char *gameid) const = 0;
virtual DetectedGameList detectGames(const FSList &fslist) const = 0;
virtual Engine *createInstance(GameDetector *detector, OSystem *syst) const = 0;
@@ -99,8 +93,8 @@ public:
* Each plugin has to define the following functions:
* - GameList Engine_##ID##_gameIDList()
* -> returns a list of gameid/desc pairs. Only used to implement '--list-games'.
- * - GameSettings Engine_##ID##_findGameID(const char *gameid)
- * -> asks the Engine for a GameSettings matching the gameid. If that is not
+ * - GameDescriptor Engine_##ID##_findGameID(const char *gameid)
+ * -> asks the Engine for a GameDescriptor matching the gameid. If that is not
* possible, the engine MUST set the gameid of the returned value to 0.
* Note: This MUST succeed for every gameID on the list returned by
* gameIDList(), but MAY also work for additional gameids (e.g. to support
@@ -130,7 +124,7 @@ public:
extern "C" { \
PLUGIN_EXPORT const char *PLUGIN_name() { return name; } \
PLUGIN_EXPORT GameList PLUGIN_gameIDList() { return Engine_##ID##_gameIDList(); } \
- PLUGIN_EXPORT GameSettings PLUGIN_findGameID(const char *gameid) { return Engine_##ID##_findGameID(gameid); } \
+ PLUGIN_EXPORT GameDescriptor PLUGIN_findGameID(const char *gameid) { return Engine_##ID##_findGameID(gameid); } \
PLUGIN_EXPORT Engine *PLUGIN_createEngine(GameDetector *detector, OSystem *syst) { return Engine_##ID##_create(detector, syst); } \
PLUGIN_EXPORT DetectedGameList PLUGIN_detectGames(const FSList &fslist) { return Engine_##ID##_detectGames(fslist); } \
}
@@ -144,7 +138,7 @@ public:
class PluginRegistrator {
friend class StaticPlugin;
public:
- typedef GameSettings (*GameIDQueryFunc)(const char *gameid);
+ typedef GameDescriptor (*GameIDQueryFunc)(const char *gameid);
typedef Engine *(*EngineFactory)(GameDetector *detector, OSystem *syst);
typedef DetectedGameList (*DetectFunc)(const FSList &fslist);
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp
index d6256debf9..8ec2a86c96 100644
--- a/engines/cine/cine.cpp
+++ b/engines/cine/cine.cpp
@@ -63,9 +63,8 @@ struct CINEGameSettings {
byte id;
uint32 features;
const char *detectname;
- GameSettings toGameSettings() const {
- GameSettings dummy = { name, description };
- return dummy;
+ GameDescriptor toGameDescriptor() const {
+ return GameDescriptor(name, description);
}
};
@@ -80,21 +79,21 @@ GameList Engine_CINE_gameIDList() {
const CINEGameSettings *g = cine_settings;
while (g->name) {
- games.push_back(g->toGameSettings());
+ games.push_back(g->toGameDescriptor());
g++;
}
return games;
}
-GameSettings Engine_CINE_findGameID(const char *gameid) {
+GameDescriptor Engine_CINE_findGameID(const char *gameid) {
const CINEGameSettings *g = cine_settings;
while (g->name) {
if (0 == scumm_stricmp(gameid, g->name))
break;
g++;
}
- return g->toGameSettings();
+ return g->toGameDescriptor();
}
DetectedGameList Engine_CINE_detectGames(const FSList &fslist) {
@@ -109,7 +108,7 @@ DetectedGameList Engine_CINE_detectGames(const FSList &fslist) {
if (0 == scumm_stricmp(g->detectname, gameName)) {
// Match found, add to list of candidates, then abort inner loop.
- detectedGames.push_back(g->toGameSettings());
+ detectedGames.push_back(g->toGameDescriptor());
break;
}
}
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index 8c1793ea94..b1d8ea0783 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -118,7 +118,7 @@ static const GobGameSettings gob_games[] = {
};
// Keep list of different supported games
-static const GameSettings gob_list[] = {
+static const PlainGameDescriptor gob_list[] = {
{"gob1", "Gobliiins"},
{"gob2", "Gobliins 2"},
{0, 0}
@@ -275,7 +275,7 @@ using namespace Gob;
GameList Engine_GOB_gameIDList() {
GameList games;
- const GameSettings *g = gob_list;
+ const PlainGameDescriptor *g = gob_list;
while (g->gameid) {
games.push_back(*g);
@@ -285,8 +285,8 @@ GameList Engine_GOB_gameIDList() {
return games;
}
-GameSettings Engine_GOB_findGameID(const char *gameid) {
- const GameSettings *g = gob_list;
+GameDescriptor Engine_GOB_findGameID(const char *gameid) {
+ const PlainGameDescriptor *g = gob_list;
while (g->gameid) {
if (0 == scumm_stricmp(gameid, g->gameid))
break;
@@ -328,7 +328,7 @@ DetectedGameList Engine_GOB_detectGames(const FSList &fslist) {
if (detectedGames.isEmpty()) {
printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str);
- const GameSettings *g1 = gob_list;
+ const PlainGameDescriptor *g1 = gob_list;
while (g1->gameid) {
detectedGames.push_back(*g1);
g1++;
diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp
index 90ad7b37f0..a7eb7f7d7d 100644
--- a/engines/kyra/kyra.cpp
+++ b/engines/kyra/kyra.cpp
@@ -96,7 +96,7 @@ static const KyraGameSettings kyra_games[] = {
};
// Keep list of different supported games
-static const GameSettings kyra_list[] = {
+static const PlainGameDescriptor kyra_list[] = {
{ "kyra1", "The Legend of Kyrandia" },
{ 0, 0 }
};
@@ -131,7 +131,7 @@ static Common::Language convertKyraLang(uint32 features) {
GameList Engine_KYRA_gameIDList() {
GameList games;
- const GameSettings *g = kyra_list;
+ const PlainGameDescriptor *g = kyra_list;
while (g->gameid) {
games.push_back(*g);
@@ -140,8 +140,8 @@ GameList Engine_KYRA_gameIDList() {
return games;
}
-GameSettings Engine_KYRA_findGameID(const char *gameid) {
- const GameSettings *g = kyra_list;
+GameDescriptor Engine_KYRA_findGameID(const char *gameid) {
+ const PlainGameDescriptor *g = kyra_list;
while (g->gameid) {
if (0 == scumm_stricmp(gameid, g->gameid))
break;
@@ -187,7 +187,7 @@ DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) {
if (detectedGames.isEmpty()) {
printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str);
- const GameSettings *g1 = kyra_list;
+ const PlainGameDescriptor *g1 = kyra_list;
while (g1->gameid) {
detectedGames.push_back(*g1);
g1++;
diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp
index 165a3bc15e..bb68befdab 100644
--- a/engines/lure/lure.cpp
+++ b/engines/lure/lure.cpp
@@ -68,14 +68,14 @@ static const LureGameSettings lure_games[] = {
// Keep list of different supported games
-static const GameSettings lure_list[] = {
+static const PlainGameDescriptor lure_list[] = {
{ "lure", "Lure of the Temptress" },
{ 0, 0 }
};
GameList Engine_LURE_gameIDList() {
GameList games;
- const GameSettings *g = lure_list;
+ const PlainGameDescriptor *g = lure_list;
while (g->gameid) {
games.push_back(*g);
@@ -84,8 +84,8 @@ GameList Engine_LURE_gameIDList() {
return games;
}
-GameSettings Engine_LURE_findGameID(const char *gameid) {
- const GameSettings *g = lure_list;
+GameDescriptor Engine_LURE_findGameID(const char *gameid) {
+ const PlainGameDescriptor *g = lure_list;
while (g->gameid) {
if (0 == scumm_stricmp(gameid, g->gameid))
break;
@@ -125,13 +125,13 @@ DetectedGameList Engine_LURE_detectGames(const FSList &fslist) {
}
for (g = lure_games; g->gameid; g++) {
if (strcmp(g->md5sum, (char *)md5str) == 0) {
- detectedGames.push_back(toDetectedGame(*g));
+ detectedGames.push_back(*g);
}
}
if (detectedGames.isEmpty()) {
debug("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str);
- const GameSettings *g1 = lure_list;
+ const PlainGameDescriptor *g1 = lure_list;
while (g1->gameid) {
detectedGames.push_back(*g1);
g1++;
diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp
index ce90c09426..76aab5b3f4 100644
--- a/engines/queen/queen.cpp
+++ b/engines/queen/queen.cpp
@@ -55,7 +55,7 @@ bool isSmartphone();
#endif
/* Flight of the Amazon Queen */
-static const GameSettings queen_setting[] = {
+static const PlainGameDescriptor queen_setting[] = {
{ "queen", "Flight of the Amazon Queen" },
{ "queen", "Flight of the Amazon Queen (Demo)" },
{ "queen", "Flight of the Amazon Queen (Interview)" },
@@ -68,15 +68,14 @@ GameList Engine_QUEEN_gameIDList() {
return games;
}
-GameSettings Engine_QUEEN_findGameID(const char *gameid) {
+GameDescriptor Engine_QUEEN_findGameID(const char *gameid) {
if (0 == scumm_stricmp(gameid, queen_setting[0].gameid))
return queen_setting[0];
- GameSettings dummy = { 0, 0 };
- return dummy;
+ return GameDescriptor();
}
-GameSettings determineTarget(uint32 size) {
+GameDescriptor determineTarget(uint32 size) {
switch (size) {
case 3724538: //regular demo
case 3732177:
diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp
index 38b0a91250..9ed9c0f854 100644
--- a/engines/saga/saga.cpp
+++ b/engines/saga/saga.cpp
@@ -56,7 +56,7 @@
#include "saga/objectmap.h"
#include "saga/resnames.h"
-static const GameSettings saga_games[] = {
+static const PlainGameDescriptor saga_games[] = {
{"ite", "Inherit the Earth"},
{"ihnm", "I Have No Mouth and I Must Scream"},
{0, 0}
@@ -64,7 +64,7 @@ static const GameSettings saga_games[] = {
GameList Engine_SAGA_gameIDList() {
GameList games;
- const GameSettings *g = saga_games;
+ const PlainGameDescriptor *g = saga_games;
while (g->gameid) {
games.push_back(*g);
@@ -74,8 +74,8 @@ GameList Engine_SAGA_gameIDList() {
return games;
}
-GameSettings Engine_SAGA_findGameID(const char *gameid) {
- const GameSettings *g = saga_games;
+GameDescriptor Engine_SAGA_findGameID(const char *gameid) {
+ const PlainGameDescriptor *g = saga_games;
while (g->gameid) {
if (0 == scumm_stricmp(gameid, g->gameid))
break;
diff --git a/engines/scumm/plugin.cpp b/engines/scumm/plugin.cpp
index ceadc3d39c..ed9dc54a6e 100644
--- a/engines/scumm/plugin.cpp
+++ b/engines/scumm/plugin.cpp
@@ -55,7 +55,6 @@ enum {
kMD5FileSizeLimit = 1024 * 1024
};
-
struct ObsoleteGameID {
const char *from;
const char *to;
@@ -75,7 +74,7 @@ static const Common::Platform UNK = Common::kPlatformUnknown;
* This table contains all game IDs supported by the SCUMM engine, and maps
* them to the full humand readable game name.
*/
-static const GameSettings gameDescriptions[] = {
+static const PlainGameDescriptor gameDescriptions[] = {
{ "atlantis", "Indiana Jones and the Fate of Atlantis" },
{ "indy3", "Indiana Jones and the Last Crusade" },
{ "loom", "Loom" },
@@ -851,7 +850,7 @@ static const ScummGameSettings multiple_versions_md5_settings[] = {
static const char *findDescriptionFromGameID(const char *gameid) {
- const GameSettings *g = gameDescriptions;
+ const PlainGameDescriptor *g = gameDescriptions;
while (g->gameid) {
if (!scumm_stricmp(g->gameid, gameid)) {
return g->description;
@@ -874,32 +873,32 @@ static int compareMD5Table(const void *a, const void *b) {
GameList Engine_SCUMM_gameIDList() {
- const GameSettings *g = gameDescriptions;
+ const PlainGameDescriptor *g = gameDescriptions;
GameList games;
while (g->gameid) {
- games.push_back(*g);
+ games.push_back(GameDescriptor(g->gameid, g->description));
g++;
}
return games;
}
-GameSettings Engine_SCUMM_findGameID(const char *gameid) {
+GameDescriptor Engine_SCUMM_findGameID(const char *gameid) {
// First search the list of supported game IDs.
- const GameSettings *g = gameDescriptions;
+ const PlainGameDescriptor *g = gameDescriptions;
while (g->gameid) {
if (0 == scumm_stricmp(gameid, g->gameid))
- return *g;
+ return GameDescriptor(g->gameid, g->description);
g++;
}
// If we didn't find the gameid in the main list, check if it
// is an obsolete game id.
- GameSettings gs = { 0, 0 };
+ GameDescriptor gs;
const ObsoleteGameID *o = obsoleteGameIDsTable;
while (o->from) {
if (0 == scumm_stricmp(gameid, o->from)) {
gs.gameid = gameid;
- gs.gameid = "Obsolete game ID";
+ gs.description = "Obsolete game ID";
return gs;
}
o++;
@@ -1072,7 +1071,7 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) {
if we find something which has an unknown MD5, assume
that it is an (so far unknown) version of Indy3.
- We can combin this with a look at the resource headers:
+ We can combine this with a look at the resource headers:
Indy3:
_numGlobalObjects 1000
@@ -1189,7 +1188,7 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) {
const char *gameid = elem->gameid;
- // Find the GameSettings for that gameid
+ // Find the GameDescriptor for that gameid
for (g = scumm_settings; g->gameid; ++g) {
if (0 == scumm_stricmp(g->gameid, gameid))
break;
@@ -1318,7 +1317,7 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) {
}
// Now search our 'database' for the MD5; if a match is found, we use
- // the information in the 'database' to correct the GameSettings.
+ // the information in the 'database' to correct the GameDescriptor.
g = multiple_versions_md5_settings;
while (g->gameid) {
if (!scumm_stricmp(md5, g->gameid)) {
@@ -1366,7 +1365,7 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) {
if (!elem)
printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5);
- // Finally, we have massaged the GameSettings to our satisfaction, and can
+ // Finally, we have massaged the GameDescriptor to our satisfaction, and can
// instantiate the appropriate game engine. Hooray!
switch (game.version) {
case 1:
diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp
index fb20351072..04ffdc0a2d 100644
--- a/engines/simon/simon.cpp
+++ b/engines/simon/simon.cpp
@@ -76,7 +76,7 @@ static const ObsoleteGameID obsoleteGameIDsTable[] = {
{NULL, NULL, Common::kPlatformUnknown}
};
-static const GameSettings simonGames[] = {
+static const PlainGameDescriptor simonGames[] = {
// Simon the Sorcerer 1 & 2
{"feeble", "The Feeble Files"},
{"simon1", "Simon the Sorcerer 1"},
@@ -87,32 +87,32 @@ static const GameSettings simonGames[] = {
GameList Engine_SIMON_gameIDList() {
GameList games;
- const GameSettings *g = simonGames;
+ const PlainGameDescriptor *g = simonGames;
while (g->gameid) {
- games.push_back(*g);
+ games.push_back(GameDescriptor(g->gameid, g->description));
g++;
}
return games;
}
-GameSettings Engine_SIMON_findGameID(const char *gameid) {
+GameDescriptor Engine_SIMON_findGameID(const char *gameid) {
// First search the list of supported game IDs.
- const GameSettings *g = simonGames;
+ const PlainGameDescriptor *g = simonGames;
while (g->gameid) {
if (0 == scumm_stricmp(gameid, g->gameid))
- return *g;
+ return GameDescriptor(g->gameid, g->description);
g++;
}
// If we didn't find the gameid in the main list, check if it
// is an obsolete game id.
- GameSettings gs = { 0, 0 };
+ GameDescriptor gs;
const ObsoleteGameID *o = obsoleteGameIDsTable;
while (o->from) {
if (0 == scumm_stricmp(gameid, o->from)) {
gs.gameid = gameid;
- gs.gameid = "Obsolete game ID";
+ gs.description = "Obsolete game ID";
return gs;
}
o++;
diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp
index 8b944c580f..e99d23275b 100644
--- a/engines/sky/sky.cpp
+++ b/engines/sky/sky.cpp
@@ -77,7 +77,7 @@ extern bool isSmartphone(void);
With apologies to the CD32 SteelSky file.
*/
-static const GameSettings skySetting =
+static const PlainGameDescriptor skySetting =
{"sky", "Beneath a Steel Sky" };
GameList Engine_SKY_gameIDList() {
@@ -86,11 +86,10 @@ GameList Engine_SKY_gameIDList() {
return games;
}
-GameSettings Engine_SKY_findGameID(const char *gameid) {
+GameDescriptor Engine_SKY_findGameID(const char *gameid) {
if (0 == scumm_stricmp(gameid, skySetting.gameid))
return skySetting;
- GameSettings dummy = { 0, 0 };
- return dummy;
+ return GameDescriptor();
}
DetectedGameList Engine_SKY_detectGames(const FSList &fslist) {
diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp
index 426b85dea3..6fd0254af4 100644
--- a/engines/sword1/sword1.cpp
+++ b/engines/sword1/sword1.cpp
@@ -48,9 +48,9 @@
using namespace Sword1;
/* Broken Sword 1 */
-static const GameSettings sword1FullSettings =
+static const PlainGameDescriptor sword1FullSettings =
{"sword1", "Broken Sword 1: The Shadow of the Templars"};
-static const GameSettings sword1DemoSettings =
+static const PlainGameDescriptor sword1DemoSettings =
{"sword1demo", "Broken Sword 1: The Shadow of the Templars (Demo)"};
// check these subdirectories (if present)
@@ -73,13 +73,12 @@ GameList Engine_SWORD1_gameIDList() {
return games;
}
-GameSettings Engine_SWORD1_findGameID(const char *gameid) {
+GameDescriptor Engine_SWORD1_findGameID(const char *gameid) {
if (0 == scumm_stricmp(gameid, sword1FullSettings.gameid))
return sword1FullSettings;
if (0 == scumm_stricmp(gameid, sword1DemoSettings.gameid))
return sword1DemoSettings;
- GameSettings dummy = { 0, 0 };
- return dummy;
+ return GameDescriptor();
}
void Sword1CheckDirectory(const FSList &fslist, bool *filesFound) {
diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp
index a8c9c635e5..8d74e94e45 100644
--- a/engines/sword2/sword2.cpp
+++ b/engines/sword2/sword2.cpp
@@ -67,20 +67,20 @@ GameList Engine_SWORD2_gameIDList() {
const Sword2GameSettings *g = sword2_settings;
GameList games;
while (g->gameid) {
- games.push_back(toGameSettings(*g));
+ games.push_back(*g);
g++;
}
return games;
}
-GameSettings Engine_SWORD2_findGameID(const char *gameid) {
+GameDescriptor Engine_SWORD2_findGameID(const char *gameid) {
const Sword2GameSettings *g = sword2_settings;
while (g->gameid) {
if (0 == scumm_stricmp(gameid, g->gameid))
break;
g++;
}
- return toGameSettings(*g);
+ return *g;
}
DetectedGameList Engine_SWORD2_detectGames(const FSList &fslist) {
@@ -99,7 +99,7 @@ DetectedGameList Engine_SWORD2_detectGames(const FSList &fslist) {
if (0 == scumm_stricmp(g->detectname, gameName)) {
// Match found, add to list of candidates, then abort inner loop.
- detectedGames.push_back(toDetectedGame(*g));
+ detectedGames.push_back(*g);
break;
}
}
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 24723ce3d1..ceb202dee0 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -114,7 +114,7 @@ class EditGameDialog : public OptionsDialog {
typedef Common::String String;
typedef Common::StringList StringList;
public:
- EditGameDialog(const String &domain, const char *desc);
+ EditGameDialog(const String &domain, const String &desc);
void open();
void close();
@@ -137,7 +137,7 @@ protected:
CheckboxWidget *_globalVolumeOverride;
};
-EditGameDialog::EditGameDialog(const String &domain, const char *desc)
+EditGameDialog::EditGameDialog(const String &domain, const String &desc)
: OptionsDialog(domain, 10, 40, 320 - 2 * 10, 140) {
const int screenW = g_system->getOverlayWidth();
@@ -176,7 +176,7 @@ EditGameDialog::EditGameDialog(const String &domain, const char *desc)
// GAME: Determine the description string
String description(ConfMan.get("description", domain));
- if (description.isEmpty() && desc) {
+ if (description.isEmpty() && !desc.isEmpty()) {
description = desc;
}
@@ -570,8 +570,8 @@ void LauncherDialog::updateListing() {
if (gameid.isEmpty())
gameid = iter->_key;
if (description.isEmpty()) {
- GameSettings g = GameDetector::findGame(gameid);
- if (g.description)
+ GameDescriptor g = GameDetector::findGame(gameid);
+ if (!g.description.isEmpty())
description = g.description;
}
@@ -667,17 +667,16 @@ void LauncherDialog::addGame() {
// Adapt the description string if custom platform/language is set
if (customLanguage || customPlatform) {
- String desc = result.description;
- desc += " (";
+ result.description += " (";
if (customLanguage)
- desc += Common::getLanguageDescription(result.language);
+ result.description += Common::getLanguageDescription(result.language);
if (customLanguage && customPlatform)
- desc += "/";
+ result.description += "/";
if (customPlatform)
- desc += Common::getPlatformDescription(result.platform);
- desc += ")";
+ result.description += Common::getPlatformDescription(result.platform);
+ result.description += ")";
- ConfMan.set("description", desc, domain);
+ ConfMan.set("description", result.description, domain);
}
// Display edit dialog for the new entry