aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorMax Horn2007-06-15 17:40:59 +0000
committerMax Horn2007-06-15 17:40:59 +0000
commita0983ff7bbd90bc3f712d5e9da53b4fe3a09fd41 (patch)
tree4d07d09de24470505e9255693059d3b266cd798e /engines/scumm
parent0a7bb215d9d4888c7106b41f6ca2ee46e09bca70 (diff)
downloadscummvm-rg350-a0983ff7bbd90bc3f712d5e9da53b4fe3a09fd41.tar.gz
scummvm-rg350-a0983ff7bbd90bc3f712d5e9da53b4fe3a09fd41.tar.bz2
scummvm-rg350-a0983ff7bbd90bc3f712d5e9da53b4fe3a09fd41.zip
Changed SCUMM engine to use findDescriptionFromGameID, Common::ADObsoleteGameID and Common::AdvancedDetector::findGameID
svn-id: r27426
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/detection.cpp40
-rw-r--r--engines/scumm/detection_tables.h9
2 files changed, 7 insertions, 42 deletions
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index da5419c904..d8cf4556d7 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -49,17 +49,6 @@ enum {
#pragma mark --- Miscellaneous ---
#pragma mark -
-static const char *findDescriptionFromGameID(const char *gameid) {
- const PlainGameDescriptor *g = gameDescriptions;
- while (g->gameid) {
- if (!scumm_stricmp(g->gameid, gameid)) {
- return g->description;
- }
- g++;
- }
- error("Unknown gameid '%s' encountered in findDescriptionFromGameID", gameid);
-}
-
static int compareMD5Table(const void *a, const void *b) {
const char *key = (const char *)a;
const MD5Table *elem = (const MD5Table *)b;
@@ -683,27 +672,7 @@ GameList Engine_SCUMM_gameIDList() {
}
GameDescriptor Engine_SCUMM_findGameID(const char *gameid) {
- // First search the list of supported game IDs.
- const PlainGameDescriptor *g = gameDescriptions;
- while (g->gameid) {
- if (0 == scumm_stricmp(gameid, g->gameid))
- 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.
- GameDescriptor gs;
- const ObsoleteGameID *o = obsoleteGameIDsTable;
- while (o->from) {
- if (0 == scumm_stricmp(gameid, o->from)) {
- gs["gameid"] = gameid;
- gs["description"] = "Obsolete game ID";
- return gs;
- }
- o++;
- }
- return gs;
+ return Common::AdvancedDetector::findGameID(gameid, gameDescriptions, obsoleteGameIDsTable);
}
@@ -717,8 +686,9 @@ GameList Engine_SCUMM_detectGames(const FSList &fslist) {
// In particular, they are detected as ZakTowns, which is bad.
for (Common::List<DetectorResult>::iterator x = results.begin(); x != results.end(); ++x) {
- GameDescriptor dg(x->game.gameid, findDescriptionFromGameID(x->game.gameid),
- x->language, x->game.platform);
+ const PlainGameDescriptor *g = findPlainGameDescriptor(x->game.gameid, gameDescriptions);
+ assert(g);
+ GameDescriptor dg(x->game.gameid, g->description, x->language, x->game.platform);
dg.updateDesc(x->extra); // Append additional information, if set, to the description.
// Compute and set the preferred target name for this game.
@@ -766,7 +736,7 @@ PluginError Engine_SCUMM_create(OSystem *syst, Engine **engine) {
// We start by checking whether the specified game ID is obsolete.
// If that is the case, we automatically upgrade the target to use
// the correct new game ID (and platform, if specified).
- for (const ObsoleteGameID *o = obsoleteGameIDsTable; o->from; ++o) {
+ for (const Common::ADObsoleteGameID *o = obsoleteGameIDsTable; o->from; ++o) {
if (!scumm_stricmp(gameid, o->from)) {
// Match found, perform upgrade
gameid = o->to;
diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h
index 90e5ed80a7..0c72951fb2 100644
--- a/engines/scumm/detection_tables.h
+++ b/engines/scumm/detection_tables.h
@@ -28,6 +28,7 @@
#include "common/stdafx.h"
+#include "common/advancedDetector.h"
#include "common/rect.h"
#include "common/util.h"
@@ -49,12 +50,6 @@ namespace Scumm {
#pragma mark --- Data types & constants ---
#pragma mark -
-struct ObsoleteGameID {
- const char *from;
- const char *to;
- Common::Platform platform;
-};
-
#define UNK Common::kPlatformUnknown
#pragma mark -
@@ -146,7 +141,7 @@ static const PlainGameDescriptor gameDescriptions[] = {
* Conversion table mapping old obsolete game IDs to the
* corresponding new game ID and platform combination.
*/
-static const ObsoleteGameID obsoleteGameIDsTable[] = {
+static const Common::ADObsoleteGameID obsoleteGameIDsTable[] = {
{"bluesabctimedemo", "bluesabctime", UNK},
{"BluesBirthdayDemo", "BluesBirthday", UNK},
{"comidemo", "comi", UNK},