diff options
-rw-r--r-- | base/gameDetector.cpp | 22 | ||||
-rw-r--r-- | base/gameDetector.h | 2 | ||||
-rw-r--r-- | base/plugins.cpp | 8 | ||||
-rw-r--r-- | gob/gob.cpp | 12 | ||||
-rw-r--r-- | gob/gob.h | 4 | ||||
-rw-r--r-- | gui/launcher.cpp | 14 | ||||
-rw-r--r-- | kyra/kyra.cpp | 18 | ||||
-rw-r--r-- | queen/queen.cpp | 2 | ||||
-rw-r--r-- | saga/saga.cpp | 2 | ||||
-rw-r--r-- | scumm/debugger.cpp | 2 | ||||
-rw-r--r-- | scumm/resource.cpp | 18 | ||||
-rw-r--r-- | scumm/resource_v7he.cpp | 4 | ||||
-rw-r--r-- | scumm/scumm-md5.h | 4 | ||||
-rw-r--r-- | scumm/scumm.cpp | 82 | ||||
-rw-r--r-- | scumm/scumm.h | 4 | ||||
-rw-r--r-- | scumm/smush/smush_player.cpp | 2 | ||||
-rw-r--r-- | scumm/sound.cpp | 8 | ||||
-rw-r--r-- | scumm/sound_he.cpp | 4 | ||||
-rw-r--r-- | simon/simon.cpp | 6 | ||||
-rw-r--r-- | sword2/sword2.cpp | 8 | ||||
-rw-r--r-- | tools/md5table.c | 10 |
21 files changed, 125 insertions, 111 deletions
diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp index 256fdcc12b..567baca03e 100644 --- a/base/gameDetector.cpp +++ b/base/gameDetector.cpp @@ -212,7 +212,7 @@ GameDetector::GameDetector() { _plugin = 0; } -/** List all supported games, i.e. all games which any loaded plugin supports. */ +/** List all supported game IDs, i.e. all games which any loaded plugin supports. */ void listGames() { const PluginList &plugins = PluginManager::instance().getPlugins(); @@ -223,7 +223,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->name, v->description); + printf("%-20s %s\n", v->gameid, v->description); } } } @@ -242,7 +242,11 @@ void listTargets() { String description(iter->_value.get("description")); if (description.isEmpty()) { - GameSettings g = GameDetector::findGame(name); + // FIXME: At this point, we should check for a "gameid" override + // to find the proper desc. In fact, the platform probably should + // be take into consideration, too. + String gameid(name); + GameSettings g = GameDetector::findGame(gameid); if (g.description) description = g.description; } @@ -259,7 +263,7 @@ GameSettings GameDetector::findGame(const String &gameName, const Plugin **plugi PluginList::const_iterator iter = plugins.begin(); for (iter = plugins.begin(); iter != plugins.end(); ++iter) { result = (*iter)->findGame(gameName.c_str()); - if (result.name) { + if (result.gameid) { if (plugin) *plugin = *iter; break; @@ -364,7 +368,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).name)) { + if (i == (argc - 1) && (ConfMan.hasGameDomain(s) || findGame(s).gameid)) { setTarget(s); } else { if (current_option == NULL) @@ -596,9 +600,9 @@ ShowHelpAndExit: } -void GameDetector::setTarget(const String &name) { - _targetName = name; - ConfMan.setActiveDomain(name); +void GameDetector::setTarget(const String &target) { + _targetName = target; + ConfMan.setActiveDomain(target); } bool GameDetector::detectGame() { @@ -612,7 +616,7 @@ bool GameDetector::detectGame() { printf("Looking for %s\n", realGame.c_str()); _game = findGame(realGame, &_plugin); - if (_game.name) { + if (_game.gameid) { printf("Trying to start game '%s'\n", _game.description); return true; } else { diff --git a/base/gameDetector.h b/base/gameDetector.h index d60b25b017..fefaf4139c 100644 --- a/base/gameDetector.h +++ b/base/gameDetector.h @@ -41,7 +41,7 @@ enum { }; struct GameSettings { - const char *name; + const char *gameid; const char *description; uint32 features; }; diff --git a/base/plugins.cpp b/base/plugins.cpp index 427529851f..0589ac6b7f 100644 --- a/base/plugins.cpp +++ b/base/plugins.cpp @@ -31,7 +31,7 @@ typedef Engine *(*EngineFactory)(GameDetector *detector, OSystem *syst); typedef const char *(*NameFunc)(); -typedef GameList (*TargetListFunc)(); +typedef GameList (*GameIDListFunc)(); typedef DetectedGameList (*DetectFunc)(const FSList &fslist); @@ -75,7 +75,7 @@ GameSettings Plugin::findGame(const char *gameName) const { GameList games = getSupportedGames(); GameSettings result = {NULL, NULL, 0}; for (GameList::iterator g = games.begin(); g != games.end(); ++g) { - if (!scumm_stricmp(g->name, gameName)) { + if (!scumm_stricmp(g->gameid, gameName)) { result = *g; break; } @@ -194,8 +194,8 @@ bool DynamicPlugin::loadPlugin() { } _name = nameFunc(); - // Query the plugin for the targets it supports - TargetListFunc gameListFunc = (TargetListFunc)findSymbol("PLUGIN_getSupportedGames"); + // Query the plugin for the game ids it supports + GameIDListFunc gameListFunc = (GameIDListFunc)findSymbol("PLUGIN_getSupportedGames"); if (!gameListFunc) { unloadPlugin(); return false; diff --git a/gob/gob.cpp b/gob/gob.cpp index 26d862a03e..7ce0d6372b 100644 --- a/gob/gob.cpp +++ b/gob/gob.cpp @@ -107,11 +107,11 @@ static const Gob::GobGameSettings gob_games[] = { // Keep list of different supported games static const struct GobGameList { - const char *name; + const char *gameid; const char *description; uint32 features; GameSettings toGameSettings() const { - GameSettings dummy = { name, description, features }; + GameSettings dummy = { gameid, description, features }; return dummy; } } gob_list[] = { @@ -125,7 +125,7 @@ GameList Engine_GOB_gameList() { GameList games; const GobGameList *g = gob_list; - while (g->name) { + while (g->gameid) { games.push_back(g->toGameSettings()); g++; } @@ -158,7 +158,7 @@ DetectedGameList Engine_GOB_detectGames(const FSList &fslist) { for (int i = 0; i < 16; i++) { sprintf(md5str + i * 2, "%02x", (int)md5sum[i]); } - for (g = gob_games; g->name; g++) { + for (g = gob_games; g->gameid; g++) { if (strcmp(g->md5sum, (char *)md5str) == 0) { detectedGames.push_back(g->toGameSettings()); } @@ -167,7 +167,7 @@ DetectedGameList Engine_GOB_detectGames(const FSList &fslist) { printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str); const GobGameList *g1 = gob_list; - while (g1->name) { + while (g1->gameid) { detectedGames.push_back(g1->toGameSettings()); g1++; } @@ -206,7 +206,7 @@ Engine *Engine_GOB_create(GameDetector * detector, OSystem *syst) { else features = Gob::GF_GOB1; - for (g = gob_games; g->name; g++) { + for (g = gob_games; g->gameid; g++) { if (strcmp(g->md5sum, (char *)md5str) == 0) { features = g->features; @@ -74,12 +74,12 @@ enum { }; typedef struct GobGameSettings { - const char *name; + const char *gameid; const char *description; uint32 features; const char *md5sum; GameSettings toGameSettings() const { - GameSettings dummy = { name, description, features }; + GameSettings dummy = { gameid, description, features }; return dummy; } } GobGameSettings; diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 6d516aa9d9..7d9cc18dea 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -594,18 +594,18 @@ void LauncherDialog::updateListing() { const ConfigManager::DomainMap &domains = ConfMan.getGameDomains(); ConfigManager::DomainMap::const_iterator iter = domains.begin(); for (iter = domains.begin(); iter != domains.end(); ++iter) { - String name(iter->_value.get("gameid")); + String gameid(iter->_value.get("gameid")); String description(iter->_value.get("description")); - if (name.isEmpty()) - name = iter->_key; + if (gameid.isEmpty()) + gameid = iter->_key; if (description.isEmpty()) { - GameSettings g = GameDetector::findGame(name); + GameSettings g = GameDetector::findGame(gameid); if (g.description) description = g.description; } - if (!name.isEmpty() && !description.isEmpty()) { + if (!gameid.isEmpty() && !description.isEmpty()) { // Insert the game into the launcher list int pos = 0, size = l.size(); @@ -669,7 +669,7 @@ void LauncherDialog::addGame() { // The auto detector or the user made a choice. // Pick a domain name which does not yet exist (after all, we // are *adding* a game to the config, not replacing). - String domain(result.name); + String domain(result.gameid); if (ConfMan.hasGameDomain(domain)) { char suffix = 'a'; domain += suffix; @@ -679,7 +679,7 @@ void LauncherDialog::addGame() { suffix++; domain += suffix; } - ConfMan.set("gameid", result.name, domain); + ConfMan.set("gameid", result.gameid, domain); ConfMan.set("description", result.description, domain); } ConfMan.set("path", dir.path(), domain); diff --git a/kyra/kyra.cpp b/kyra/kyra.cpp index 80231c58ef..637e8978b6 100644 --- a/kyra/kyra.cpp +++ b/kyra/kyra.cpp @@ -58,14 +58,14 @@ enum { // Kyra MD5 detection brutally ripped from the Gobliins engine. struct KyraGameSettings { - const char *name; + const char *gameid; const char *description; byte id; uint32 features; const char *md5sum; const char *checkFile; GameSettings toGameSettings() const { - GameSettings dummy = { name, description, features }; + GameSettings dummy = { gameid, description, features }; return dummy; } }; @@ -96,11 +96,11 @@ static const KyraGameSettings kyra_games[] = { // Keep list of different supported games struct KyraGameList { - const char *name; + const char *gameid; const char *description; uint32 features; GameSettings toGameSettings() const { - GameSettings dummy = { name, description, features }; + GameSettings dummy = { gameid, description, features }; return dummy; } }; @@ -114,7 +114,7 @@ GameList Engine_KYRA_gameList() { GameList games; const KyraGameList *g = kyra_list; - while (g->name) { + while (g->gameid) { games.push_back(g->toGameSettings()); g++; } @@ -132,7 +132,7 @@ DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) { if (file->isDirectory()) continue; - for (g = kyra_games; g->name; g++) { + for (g = kyra_games; g->gameid; g++) { if (scumm_stricmp(file->displayName().c_str(), g->checkFile) == 0) isFound = true; } @@ -150,7 +150,7 @@ DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) { for (int i = 0; i < 16; i++) { sprintf(md5str + i * 2, "%02x", (int)md5sum[i]); } - for (g = kyra_games; g->name; g++) { + for (g = kyra_games; g->gameid; g++) { if (strcmp(g->md5sum, (char *)md5str) == 0) { detectedGames.push_back(g->toGameSettings()); } @@ -159,7 +159,7 @@ DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) { debug("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str); const KyraGameList *g1 = kyra_list; - while (g1->name) { + while (g1->gameid) { detectedGames.push_back(g1->toGameSettings()); g1++; } @@ -225,7 +225,7 @@ KyraEngine::KyraEngine(GameDetector *detector, OSystem *system) // data contents _features = 0; - for (g = kyra_games; g->name; g++) { + for (g = kyra_games; g->gameid; g++) { if (!Common::File::exists(g->checkFile)) continue; diff --git a/queen/queen.cpp b/queen/queen.cpp index ad1d17dcfa..394c3a39c3 100644 --- a/queen/queen.cpp +++ b/queen/queen.cpp @@ -65,7 +65,7 @@ GameList Engine_QUEEN_gameList() { GameList games; const GameSettings *g = queen_setting; - while (g->name) { + while (g->gameid) { games.push_back(*g); g++; } diff --git a/saga/saga.cpp b/saga/saga.cpp index 45d8bf29ab..577787a4ce 100644 --- a/saga/saga.cpp +++ b/saga/saga.cpp @@ -65,7 +65,7 @@ GameList Engine_SAGA_gameList() { GameList games; const GameSettings *g = saga_games; - while (g->name) { + while (g->gameid) { games.push_back(*g); g++; } diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp index e86ab9065d..c4a8da0920 100644 --- a/scumm/debugger.cpp +++ b/scumm/debugger.cpp @@ -82,7 +82,7 @@ ScummDebugger::ScummDebugger(ScummEngine *s) DVar_Register("scumm_vars", &_vm->_scummVars, DVAR_INTARRAY, _vm->_numVariables); DVar_Register("scumm_gamename", &_vm->_targetName, DVAR_STRING, 0); - DVar_Register("scumm_exename", &_vm->_gameName, DVAR_STRING, 0); + DVar_Register("scumm_exename", &_vm->_baseName, DVAR_STRING, 0); DVar_Register("scumm_gameid", &_vm->_gameId, DVAR_BYTE, 0); // Register commands diff --git a/scumm/resource.cpp b/scumm/resource.cpp index 4c02945aca..b5c505ec5a 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -118,28 +118,28 @@ void ScummEngine::openRoom(const int room) { switch(disk) { case 2: - sprintf(buf, "%s.%s", _gameName.c_str(), "(b)"); + sprintf(buf, "%s.%s", _baseName.c_str(), "(b)"); break; case 1: - sprintf(buf, "%s.%s", _gameName.c_str(), "(a)"); + sprintf(buf, "%s.%s", _baseName.c_str(), "(a)"); break; default: - sprintf(buf, "%s.%s", _gameName.c_str(), "he0"); + sprintf(buf, "%s.%s", _baseName.c_str(), "he0"); } } else - sprintf(buf, "%s.he%.1d", _gameName.c_str(), room == 0 ? 0 : 1); + sprintf(buf, "%s.he%.1d", _baseName.c_str(), room == 0 ? 0 : 1); } else if (_version >= 7) { if (room > 0 && (_version == 8)) VAR(VAR_CURRENTDISK) = diskNumber; - sprintf(buf, "%s.la%d", _gameName.c_str(), diskNumber); + sprintf(buf, "%s.la%d", _baseName.c_str(), diskNumber); - sprintf(buf2, "%s.%.3d", _gameName.c_str(), diskNumber); + sprintf(buf2, "%s.%.3d", _baseName.c_str(), diskNumber); } else if (_heversion >= 60) { - sprintf(buf, "%s.he%.1d", _gameName.c_str(), diskNumber); + sprintf(buf, "%s.he%.1d", _baseName.c_str(), diskNumber); } else { - sprintf(buf, "%s.%.3d", _gameName.c_str(), diskNumber); + sprintf(buf, "%s.%.3d", _baseName.c_str(), diskNumber); if (_gameId == GID_SAMNMAX) - sprintf(buf2, "%s.sm%.1d", _gameName.c_str(), diskNumber); + sprintf(buf2, "%s.sm%.1d", _baseName.c_str(), diskNumber); } encByte = (_features & GF_USE_KEY) ? 0x69 : 0; diff --git a/scumm/resource_v7he.cpp b/scumm/resource_v7he.cpp index e2e2d396a2..3977140693 100644 --- a/scumm/resource_v7he.cpp +++ b/scumm/resource_v7he.cpp @@ -158,7 +158,7 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte fi.file = new Common::File; if (!_fileName[0]) { // We are running for the first time - snprintf(_fileName, 256, "%s.he3", _vm->getGameName()); + snprintf(_fileName, 256, "%s.he3", _vm->getBaseName()); if (_vm->_substResFileNameIndex > 0) { char buf1[128]; @@ -1292,7 +1292,7 @@ int MacResExtractor::extractResource(int id, byte **buf) { if (_vm->_substResFileNameIndex > 0) { char buf1[128]; - snprintf(buf1, 128, "%s.he3", _vm->getGameName()); + snprintf(buf1, 128, "%s.he3", _vm->getBaseName()); _vm->generateSubstResFileName(buf1, _fileName, sizeof(buf1)); // Some programs write it as .bin. Try that too diff --git a/scumm/scumm-md5.h b/scumm/scumm-md5.h index 50e8f76d49..9948a2ab27 100644 --- a/scumm/scumm-md5.h +++ b/scumm/scumm-md5.h @@ -1,11 +1,11 @@ /* - This file was generated by the md5table tool on Thu Jan 19 22:55:50 2006 + This file was generated by the md5table tool on Sat Jan 21 12:36:17 2006 DO NOT EDIT MANUALLY! */ struct MD5Table { const char *md5; - const char *target; + const char *gameid; Common::Language language; Common::Platform platform; }; diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 0aa920ec5f..d9b9eef61e 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -89,7 +89,7 @@ namespace Scumm { ScummEngine *g_scumm = 0; struct ScummGameSettings { - const char *name; + const char *gameid; const char *description; byte id, version, heversion; int midi; // MidiDriverFlags values @@ -97,7 +97,7 @@ struct ScummGameSettings { Common::Platform platform; GameSettings toGameSettings() const { - GameSettings dummy = { name, description, features }; + GameSettings dummy = { gameid, description, features }; return dummy; } }; @@ -109,13 +109,13 @@ enum { }; -struct ObsoleteTargets { +struct ObsoleteGameIDs { const char *from; const char *to; Common::Platform platform; GameSettings toGameSettings() const { - GameSettings dummy = { from, "Obsolete Target", 0 }; + GameSettings dummy = { from, "Obsolete game ID", 0 }; return dummy; } }; @@ -123,12 +123,12 @@ struct ObsoleteTargets { static const Common::Platform UNK = Common::kPlatformUnknown; /** - * Conversion table mapping old obsolete target names to the - * corresponding new target and platform combination. + * Conversion table mapping old obsolete game IDs to the + * corresponding new game ID and platform combination. * * We use an ugly macro 'UNK' here to make the following table more readable. */ -static ObsoleteTargets obsoleteTargetsTable[] = { +static ObsoleteGameIDs obsoleteGameIDsTable[] = { {"comidemo", "comi", UNK}, {"digdemo", "dig", UNK}, {"digdemoMac", "dig", Common::kPlatformMacintosh}, @@ -1389,7 +1389,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS // Allow the user to override the game name with a custom string. // This allows some game versions to work which use filenames // differing from the regular version(s) of that game. - _gameName = ConfMan.hasKey("basename") ? ConfMan.get("basename") : gs.name; + _baseName = ConfMan.hasKey("basename") ? ConfMan.get("basename") : gs.gameid; _copyProtection = ConfMan.getBool("copy_protection"); _demoMode = ConfMan.getBool("demo_mode"); @@ -2132,9 +2132,9 @@ void ScummEngine_v99he::scummInit() { memset(_hePalettes, 0, (_numPalettes + 1) * 1024); // Array 129 is set to base name - int len = resStrLen((const byte *)_gameName.c_str()) + 1; + int len = resStrLen((const byte *)_baseName.c_str()) + 1; ArrayHeader *ah = defineArray(129, kStringArray, 0, 0, 0, len); - memcpy(ah->data, _gameName.c_str(), len); + memcpy(ah->data, _baseName.c_str(), len); } #endif @@ -2838,9 +2838,9 @@ using namespace Scumm; GameList Engine_SCUMM_gameList() { const ScummGameSettings *g = scumm_settings; - const ObsoleteTargets *o = obsoleteTargetsTable; + const ObsoleteGameIDs *o = obsoleteGameIDsTable; GameList games; - while (g->name) { + while (g->gameid) { games.push_back(g->toGameSettings()); g++; } @@ -2862,11 +2862,11 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) { typedef Common::Map<Common::String, bool> StringSet; StringSet fileSet; - for (g = scumm_settings; g->name; ++g) { + for (g = scumm_settings; g->gameid; ++g) { // Determine the 'detectname' for this game, that is, the name of a // file that *must* be presented if the directory contains the data // for this game. For example, FOA requires atlantis.000 - const char *base = g->name; + const char *base = g->gameid; detectName[0] = '\0'; // TODO: we need to add cache here @@ -3099,14 +3099,14 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) { if (!exactMatch) detectedGames.clear(); // Clear all the non-exact candidates - const char *target = elem->target; + const char *gameid = elem->gameid; - // Find the GameSettings for that target - for (g = scumm_settings; g->name; ++g) { - if (0 == scumm_stricmp(g->name, target)) + // Find the GameSettings for that gameid + for (g = scumm_settings; g->gameid; ++g) { + if (0 == scumm_stricmp(g->gameid, gameid)) break; } - assert(g->name); + assert(g->gameid); // Insert the 'enhanced' game data into the candidate list if (iter->_value == true) // This was HE Mac game detectedGames.push_back(DetectedGame(g->toGameSettings(), elem->language, Common::kPlatformMacintosh)); @@ -3173,39 +3173,49 @@ static int generateSubstResFileName_(const char *filename, char *buf, int bufsiz return -1; } +/** + * Create a ScummEngine instance, based on the given detector data. + * + * This is heavily based on our MD5 detection scheme. + */ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) { Engine *engine; - const ObsoleteTargets *o = obsoleteTargetsTable; + // We start by checking whether the specified game ID is obsolete. + // If that is the case, we automaticlaly upgrade the target to use + // the correct new game ID (and platform, if specified). + const ObsoleteGameIDs *o = obsoleteGameIDsTable; while (o->from) { - if (!scumm_stricmp(detector->_game.name, o->from)) { - detector->_game.name = o->to; - + if (!scumm_stricmp(detector->_game.gameid, o->from)) { + // Match found, perform upgrade + detector->_game.gameid = o->to; ConfMan.set("gameid", o->to); if (o->platform != Common::kPlatformUnknown) ConfMan.set("platform", Common::getPlatformCode(o->platform)); - warning("Target upgraded from %s to %s", o->from, o->to); + warning("Target upgraded from game ID %s to %s", o->from, o->to); ConfMan.flushToDisk(); break; } o++; } + // Lookup the game ID in our database. If this lookup fails, then + // the game ID is unknown, and we have to abort. const ScummGameSettings *g = scumm_settings; - while (g->name) { - if (!scumm_stricmp(detector->_game.name, g->name)) + while (g->gameid) { + if (!scumm_stricmp(detector->_game.gameid, g->gameid)) break; g++; } - if (!g->name) { - error("Invalid game '%s'\n", detector->_game.name); + if (!g->gameid) { + error("Invalid game ID '%s'\n", detector->_game.gameid); return 0; } // Calculate MD5 of the games detection file, for savegames etc. - const char *name = g->name; + const char *gameid = g->gameid; char detectName[256], tempName[256], gameMD5[32+1]; uint8 md5sum[16]; int substLastIndex = 0; @@ -3222,19 +3232,19 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) { strcpy(detectName, "000.LFL"); break; case 2: - strcpy(detectName, name); + strcpy(detectName, gameid); strcat(detectName, ".la0"); break; case 3: - strcpy(detectName, name); + strcpy(detectName, gameid); strcat(detectName, ".he0"); break; case 4: - strcpy(detectName, name); + strcpy(detectName, gameid); strcat(detectName, ".000"); break; case 5: - strcpy(detectName, name); + strcpy(detectName, gameid); strcat(detectName, ".sm0"); break; case 6: @@ -3288,11 +3298,11 @@ 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. g = multiple_versions_md5_settings; - while (g->name) { - if (!scumm_stricmp(md5, g->name)) { + while (g->gameid) { + if (!scumm_stricmp(md5, g->gameid)) { // Match found game = *g; - game.name = name; + game.gameid = gameid; // FIXME: Fingolfin wonders what this line is good for? if (game.description) g_system->setWindowCaption(game.description); break; diff --git a/scumm/scumm.h b/scumm/scumm.h index c86fd15bfb..7e0b7f0ee9 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -434,7 +434,7 @@ public: // Misc utility functions uint32 _debugFlags; - const char *getGameName() const { return _gameName.c_str(); } + const char *getBaseName() const { return _baseName.c_str(); } // Cursor/palette void updateCursor(); @@ -696,7 +696,7 @@ public: protected: int _resourceHeaderSize; - Common::String _gameName; // This is the name we use for opening resource files + Common::String _baseName; // This is the name we use for opening resource files Common::String _targetName; // This is the game the user calls it, so use for saving byte _resourceMapper[128]; byte *_heV7DiskOffsets; diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index 34f5a01e5c..06e1af0cd8 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -1170,7 +1170,7 @@ void SmushPlayer::updateScreen() { #ifdef DUMP_SMUSH_FRAMES char fileName[100]; // change path below for dump png files - sprintf(fileName, "/path/to/somethere/%s%04d.png", _vm->getGameName(), _frame); + sprintf(fileName, "/path/to/somethere/%s%04d.png", _vm->getBaseName(), _frame); FILE *file = fopen(fileName, "wb"); if (file == NULL) error("can't open file for writing png"); diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 681ff0ebd8..067cb0dc93 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -1008,12 +1008,12 @@ ScummFile *Sound::openSfxFile() { ScummFile *file = new ScummFile(); _offsetTable = NULL; - /* Try opening the file <_gameName>.sou first, e.g. tentacle.sou. + /* Try opening the file <baseName>.sou first, e.g. tentacle.sou. * That way, you can keep .sou files for multiple games in the * same directory */ const char *basename[4] = { 0, 0, 0, 0 }; - basename[0] = _vm->getGameName(); + basename[0] = _vm->getBaseName(); basename[1] = "monster"; if (_vm->_substResFileNameIndex > 0) { @@ -1036,9 +1036,9 @@ ScummFile *Sound::openSfxFile() { if (!file->isOpen()) { if ((_vm->_heversion <= 61 && _vm->_platform == Common::kPlatformMacintosh) || (_vm->_heversion >= 70)) { - sprintf(buf, "%s.he2", _vm->getGameName()); + sprintf(buf, "%s.he2", _vm->getBaseName()); } else { - sprintf(buf, "%s.tlk", _vm->getGameName()); + sprintf(buf, "%s.tlk", _vm->getBaseName()); } if (_vm->_substResFileNameIndex > 0) { diff --git a/scumm/sound_he.cpp b/scumm/sound_he.cpp index 6defced989..9d29d42b5e 100644 --- a/scumm/sound_he.cpp +++ b/scumm/sound_he.cpp @@ -138,7 +138,7 @@ void Sound::setupHEMusicFile() { char buf[32], buf1[128]; Common::File musicFile; - sprintf(buf, "%s.he4", _vm->getGameName()); + sprintf(buf, "%s.he4", _vm->getBaseName()); if (_vm->_substResFileNameIndex > 0) { _vm->generateSubstResFileName(buf, buf1, sizeof(buf1)); @@ -334,7 +334,7 @@ void Sound::playHESound(int soundID, int heOffset, int heChannel, int heFlags) { char buf[32], buf1[128]; Common::File musicFile; - sprintf(buf, "%s.he4", _vm->getGameName()); + sprintf(buf, "%s.he4", _vm->getBaseName()); if (_vm->_substResFileNameIndex > 0) { _vm->generateSubstResFileName(buf, buf1, sizeof(buf1)); diff --git a/simon/simon.cpp b/simon/simon.cpp index 4041e29cf7..4e003b60b1 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -104,7 +104,7 @@ static const GameSettings simonGames[] = { GameList Engine_SIMON_gameList() { GameList games; const GameSettings *g = simonGames; - while (g->name) { + while (g->gameid) { games.push_back(*g); g++; } @@ -119,8 +119,8 @@ DetectedGameList Engine_SIMON_detectGames(const FSList &fslist) { Engine *Engine_SIMON_create(GameDetector *detector, OSystem *syst) { const ObsoleteTargets *o = obsoleteTargetsTable; while (o->from) { - if (!scumm_stricmp(detector->_game.name, o->from)) { - detector->_game.name = o->to; + if (!scumm_stricmp(detector->_game.gameid, o->from)) { + detector->_game.gameid = o->to; ConfMan.set("gameid", o->to); diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp index faf0915664..926a90e91e 100644 --- a/sword2/sword2.cpp +++ b/sword2/sword2.cpp @@ -46,12 +46,12 @@ extern bool isSmartphone(); #endif struct Sword2GameSettings { - const char *name; + const char *gameid; const char *description; uint32 features; const char *detectname; GameSettings toGameSettings() const { - GameSettings dummy = { name, description, features }; + GameSettings dummy = { gameid, description, features }; return dummy; } }; @@ -67,7 +67,7 @@ static const Sword2GameSettings sword2_settings[] = { GameList Engine_SWORD2_gameList() { const Sword2GameSettings *g = sword2_settings; GameList games; - while (g->name) { + while (g->gameid) { games.push_back(g->toGameSettings()); g++; } @@ -82,7 +82,7 @@ DetectedGameList Engine_SWORD2_detectGames(const FSList &fslist) { // between the 'sword2' and 'sword2demo' targets. The current code // can't do that since they use the same detectname. - for (g = sword2_settings; g->name; ++g) { + for (g = sword2_settings; g->gameid; ++g) { // Iterate over all files in the given directory for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { if (!file->isDirectory()) { diff --git a/tools/md5table.c b/tools/md5table.c index 9efc6e21eb..7fbb355eaa 100644 --- a/tools/md5table.c +++ b/tools/md5table.c @@ -60,7 +60,7 @@ typedef struct { const char *platform; const char *language; const char *md5; - const char *target; + const char *gameid; const char *infoSource; } Entry; @@ -127,7 +127,7 @@ static const char *c_header = "\n" "struct MD5Table {\n" " const char *md5;\n" - " const char *target;\n" + " const char *gameid;\n" " Common::Language language;\n" " Common::Platform platform;\n" "};\n" @@ -147,7 +147,7 @@ static void parseEntry(Entry *entry, char *line) { entry->platform = strtok(NULL, "\t\n\r"); entry->language = strtok(NULL, "\t\n\r"); entry->md5 = strtok(NULL, "\t\n\r"); - entry->target = strtok(NULL, "\t\n\r"); + entry->gameid = strtok(NULL, "\t\n\r"); entry->infoSource = strtok(NULL, "\t\n\r"); } @@ -236,7 +236,7 @@ int main(int argc, char *argv[]) fprintf(outFile, "\"%s\", ", entry.platform); fprintf(outFile, "\"%s\", ", entry.language); fprintf(outFile, "\"%s\", ", entry.md5); - fprintf(outFile, "\"%s\"", entry.target); + fprintf(outFile, "\"%s\"", entry.gameid); if (entry.infoSource) fprintf(outFile, ", \"%s\"", entry.infoSource); fprintf(outFile, "); ?>\n"); @@ -246,7 +246,7 @@ int main(int argc, char *argv[]) entriesBuffer = realloc(entriesBuffer, maxEntries * entrySize); } snprintf(entriesBuffer + numEntries * entrySize, entrySize, "\t{ \"%s\", \"%s\", Common::%s, Common::%s },\n", - entry.md5, entry.target, mapStr(entry.language, langMap), mapStr(entry.platform, platformMap)); + entry.md5, entry.gameid, mapStr(entry.language, langMap), mapStr(entry.platform, platformMap)); numEntries++; } } else { |