ENGINES: Change targets to have an 'engine ID'
The engine ID identifies which engine should be used to launch the target. Also remove the 'single ID' system. Different games from engines that used that system now have different game IDs. Also-By: Matthew Hoops <clone2727@gmail.com>
This commit is contained in:
parent
9c8bd056d6
commit
bb813719b5
30 changed files with 247 additions and 231 deletions
|
@ -705,9 +705,8 @@ static void listTargets() {
|
||||||
printf("Target Description \n"
|
printf("Target Description \n"
|
||||||
"-------------------- ------------------------------------------------------\n");
|
"-------------------- ------------------------------------------------------\n");
|
||||||
|
|
||||||
using namespace Common;
|
const Common::ConfigManager::DomainMap &domains = ConfMan.getGameDomains();
|
||||||
const ConfigManager::DomainMap &domains = ConfMan.getGameDomains();
|
Common::ConfigManager::DomainMap::const_iterator iter;
|
||||||
ConfigManager::DomainMap::const_iterator iter;
|
|
||||||
|
|
||||||
Common::Array<Common::String> targets;
|
Common::Array<Common::String> targets;
|
||||||
targets.reserve(domains.size());
|
targets.reserve(domains.size());
|
||||||
|
@ -716,15 +715,15 @@ static void listTargets() {
|
||||||
Common::String name(iter->_key);
|
Common::String name(iter->_key);
|
||||||
Common::String description(iter->_value.getVal("description"));
|
Common::String description(iter->_value.getVal("description"));
|
||||||
|
|
||||||
|
// If there's no description, fallback on the default description.
|
||||||
if (description.empty()) {
|
if (description.empty()) {
|
||||||
// FIXME: At this point, we should check for a "gameid" override
|
PlainGameDescriptor g = EngineMan.findTarget(name);
|
||||||
// to find the proper desc. In fact, the platform probably should
|
|
||||||
// be taken into account, too.
|
|
||||||
const Common::String &gameid = name;
|
|
||||||
PlainGameDescriptor g = EngineMan.findGame(gameid);
|
|
||||||
if (g.description)
|
if (g.description)
|
||||||
description = g.description;
|
description = g.description;
|
||||||
}
|
}
|
||||||
|
// If there's still no description, we cannot come up with one. Insert some dummy text.
|
||||||
|
if (description.empty())
|
||||||
|
description = "<Unknown game>";
|
||||||
|
|
||||||
targets.push_back(Common::String::format("%-20s %s", name.c_str(), description.c_str()));
|
targets.push_back(Common::String::format("%-20s %s", name.c_str(), description.c_str()));
|
||||||
}
|
}
|
||||||
|
@ -766,24 +765,21 @@ static Common::Error listSaves(const Common::String &target) {
|
||||||
// target specific savepath will be checked
|
// target specific savepath will be checked
|
||||||
ConfMan.setActiveDomain(*i);
|
ConfMan.setActiveDomain(*i);
|
||||||
|
|
||||||
// Grab the gameid from the domain resp. use the target as gameid
|
// Look for a game matching the target
|
||||||
Common::String gameid;
|
|
||||||
if (domain)
|
|
||||||
gameid = domain->getVal("gameid");
|
|
||||||
if (gameid.empty())
|
|
||||||
gameid = *i;
|
|
||||||
gameid.toLowercase(); // Normalize it to lower case
|
|
||||||
|
|
||||||
// Find the plugin that will handle the specified gameid
|
|
||||||
const Plugin *plugin = nullptr;
|
const Plugin *plugin = nullptr;
|
||||||
EngineMan.findGame(gameid, &plugin);
|
PlainGameDescriptor game;
|
||||||
|
if (domain) {
|
||||||
|
game = EngineMan.findTarget(target, &plugin);
|
||||||
|
} else {
|
||||||
|
game = EngineMan.findGame(target, &plugin);
|
||||||
|
}
|
||||||
|
|
||||||
if (!plugin) {
|
if (!plugin) {
|
||||||
// If the target was specified, treat this as an error, and otherwise skip it.
|
// If the target was specified, treat this as an error, and otherwise skip it.
|
||||||
if (!target.empty())
|
if (!target.empty())
|
||||||
return Common::Error(Common::kEnginePluginNotFound,
|
return Common::Error(Common::kEnginePluginNotFound,
|
||||||
Common::String::format("target '%s', gameid '%s", i->c_str(), gameid.c_str()));
|
Common::String::format("target '%s', gameid '%s", i->c_str(), game.gameId));
|
||||||
printf("Plugin could not be loaded for target '%s', gameid '%s", i->c_str(), gameid.c_str());
|
printf("Plugin could not be loaded for target '%s', gameid '%s", i->c_str(), game.gameId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -794,7 +790,7 @@ static Common::Error listSaves(const Common::String &target) {
|
||||||
if (!target.empty())
|
if (!target.empty())
|
||||||
// TODO: Include more info about the target (desc, engine name, ...) ???
|
// TODO: Include more info about the target (desc, engine name, ...) ???
|
||||||
return Common::Error(Common::kEnginePluginNotSupportSaves,
|
return Common::Error(Common::kEnginePluginNotSupportSaves,
|
||||||
Common::String::format("target '%s', gameid '%s", i->c_str(), gameid.c_str()));
|
Common::String::format("target '%s', gameid '%s", i->c_str(), game.gameId));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -805,7 +801,7 @@ static Common::Error listSaves(const Common::String &target) {
|
||||||
// TODO: Include more info about the target (desc, engine name, ...) ???
|
// TODO: Include more info about the target (desc, engine name, ...) ???
|
||||||
if (atLeastOneFound)
|
if (atLeastOneFound)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Save states for target '%s' (gameid '%s'):\n", i->c_str(), gameid.c_str());
|
printf("Save states for target '%s' (gameid '%s'):\n", i->c_str(), game.gameId);
|
||||||
printf(" Slot Description \n"
|
printf(" Slot Description \n"
|
||||||
" ---- ------------------------------------------------------\n");
|
" ---- ------------------------------------------------------\n");
|
||||||
|
|
||||||
|
@ -817,7 +813,7 @@ static Common::Error listSaves(const Common::String &target) {
|
||||||
} else {
|
} else {
|
||||||
// If the target was specified, indicate no save games were found for it. Otherwise just skip it.
|
// If the target was specified, indicate no save games were found for it. Otherwise just skip it.
|
||||||
if (!target.empty())
|
if (!target.empty())
|
||||||
printf("There are no save states for target '%s' (gameid '%s'):\n", i->c_str(), gameid.c_str());
|
printf("There are no save states for target '%s' (gameid '%s'):\n", i->c_str(), game.gameId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -916,10 +912,14 @@ static Common::String detectGames(const Common::String &path, const Common::Stri
|
||||||
return Common::String();
|
return Common::String();
|
||||||
}
|
}
|
||||||
// TODO this is not especially pretty
|
// TODO this is not especially pretty
|
||||||
printf("ID Description Full Path\n");
|
printf("EngineID GameID Description Full Path\n");
|
||||||
printf("-------------- ---------------------------------------------------------- ---------------------------------------------------------\n");
|
printf("-------------- -------------- ---------------------------------------------------------- ---------------------------------------------------------\n");
|
||||||
for (DetectedGames::const_iterator v = candidates.begin(); v != candidates.end(); ++v) {
|
for (DetectedGames::const_iterator v = candidates.begin(); v != candidates.end(); ++v) {
|
||||||
printf("%-14s %-58s %s\n", v->gameId.c_str(), v->description.c_str(), v->path.c_str());
|
printf("%-14s %-14s %-58s %s\n",
|
||||||
|
v->engineId.c_str(),
|
||||||
|
v->gameId.c_str(),
|
||||||
|
v->description.c_str(),
|
||||||
|
v->path.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return candidates[0].gameId;
|
return candidates[0].gameId;
|
||||||
|
@ -1010,7 +1010,7 @@ static void runDetectorTest() {
|
||||||
bool gameidDiffers = false;
|
bool gameidDiffers = false;
|
||||||
DetectedGames::const_iterator x;
|
DetectedGames::const_iterator x;
|
||||||
for (x = candidates.begin(); x != candidates.end(); ++x) {
|
for (x = candidates.begin(); x != candidates.end(); ++x) {
|
||||||
gameidDiffers |= (scumm_stricmp(gameid.c_str(), x->gameId.c_str()) != 0);
|
gameidDiffers |= !gameid.equalsIgnoreCase(x->gameId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (candidates.empty()) {
|
if (candidates.empty()) {
|
||||||
|
@ -1120,7 +1120,8 @@ void upgradeTargets() {
|
||||||
// At this point, g points to a GameDescriptor which we can use to update
|
// At this point, g points to a GameDescriptor which we can use to update
|
||||||
// the target referred to by dom. We update several things
|
// the target referred to by dom. We update several things
|
||||||
|
|
||||||
// Always set the gameid explicitly (in case of legacy targets)
|
// Always set the engine ID and game ID explicitly (in case of legacy targets)
|
||||||
|
dom["engineid"] = g->engineId;
|
||||||
dom["gameid"] = g->gameId;
|
dom["gameid"] = g->gameId;
|
||||||
|
|
||||||
// Always set the GUI options. The user should not modify them, and engines might
|
// Always set the GUI options. The user should not modify them, and engines might
|
||||||
|
@ -1149,7 +1150,7 @@ void upgradeTargets() {
|
||||||
// ScummVM still generates an incorrect description string. So, the description
|
// ScummVM still generates an incorrect description string. So, the description
|
||||||
// should only be updated if the user explicitly requests this.
|
// should only be updated if the user explicitly requests this.
|
||||||
#if 0
|
#if 0
|
||||||
if (desc != g->description()) {
|
if (desc != g->description) {
|
||||||
printf(" -> update desc from '%s' to\n '%s' ?\n", desc.c_str(), g->description.c_str());
|
printf(" -> update desc from '%s' to\n '%s' ?\n", desc.c_str(), g->description.c_str());
|
||||||
dom["description"] = g->description;
|
dom["description"] = g->description;
|
||||||
}
|
}
|
||||||
|
@ -1248,9 +1249,17 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
|
||||||
// domain (i.e. a target) matching this argument, or alternatively
|
// domain (i.e. a target) matching this argument, or alternatively
|
||||||
// whether there is a gameid matching that name.
|
// whether there is a gameid matching that name.
|
||||||
if (!command.empty()) {
|
if (!command.empty()) {
|
||||||
PlainGameDescriptor gd = EngineMan.findGame(command);
|
PlainGameDescriptor gd;
|
||||||
if (ConfMan.hasGameDomain(command) || gd.gameId) {
|
const Plugin *plugin = nullptr;
|
||||||
bool idCameFromCommandLine = false;
|
if (ConfMan.hasGameDomain(command)) {
|
||||||
|
// Command is a known target
|
||||||
|
ConfMan.setActiveDomain(command);
|
||||||
|
} else if (gd = EngineMan.findGame(command, &plugin), gd.gameId) {
|
||||||
|
// Command is a known game ID
|
||||||
|
ConfMan.setActiveDomain(command);
|
||||||
|
|
||||||
|
ConfMan.set("gameid", gd.gameId);
|
||||||
|
ConfMan.set("engineid", plugin->get<MetaEngine>().getEngineId());
|
||||||
|
|
||||||
// WORKAROUND: Fix for bug #1719463: "DETECTOR: Launching
|
// WORKAROUND: Fix for bug #1719463: "DETECTOR: Launching
|
||||||
// undefined target adds launcher entry"
|
// undefined target adds launcher entry"
|
||||||
|
@ -1258,15 +1267,7 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
|
||||||
// We designate gameids which come strictly from command line
|
// We designate gameids which come strictly from command line
|
||||||
// so AdvancedDetector will not save config file with invalid
|
// so AdvancedDetector will not save config file with invalid
|
||||||
// gameid in case target autoupgrade was performed
|
// gameid in case target autoupgrade was performed
|
||||||
if (!ConfMan.hasGameDomain(command)) {
|
ConfMan.set("id_came_from_command_line", "1");
|
||||||
idCameFromCommandLine = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfMan.setActiveDomain(command);
|
|
||||||
|
|
||||||
if (idCameFromCommandLine)
|
|
||||||
ConfMan.set("id_came_from_command_line", "1");
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
#ifndef DISABLE_COMMAND_LINE
|
#ifndef DISABLE_COMMAND_LINE
|
||||||
usage("Unrecognized game target '%s'", command.c_str());
|
usage("Unrecognized game target '%s'", command.c_str());
|
||||||
|
|
|
@ -108,39 +108,50 @@ static bool launcherDialog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Plugin *detectPlugin() {
|
static const Plugin *detectPlugin() {
|
||||||
const Plugin *plugin = nullptr;
|
// Figure out the engine ID and game ID
|
||||||
|
Common::String engineId = ConfMan.get("engineid");
|
||||||
|
Common::String gameId = ConfMan.get("gameid");
|
||||||
|
|
||||||
// Make sure the gameid is set in the config manager, and that it is lowercase.
|
// Print text saying what's going on
|
||||||
Common::String gameid(ConfMan.getActiveDomainName());
|
printf("User picked target '%s' (engine ID '%s', game ID '%s')...\n", ConfMan.getActiveDomainName().c_str(), engineId.c_str(), gameId.c_str());
|
||||||
assert(!gameid.empty());
|
|
||||||
if (ConfMan.hasKey("gameid")) {
|
|
||||||
gameid = ConfMan.get("gameid");
|
|
||||||
|
|
||||||
// Set last selected game, that the game will be highlighted
|
// At this point the engine ID and game ID must be known
|
||||||
// on RTL
|
if (engineId.empty()) {
|
||||||
ConfMan.set("lastselectedgame", ConfMan.getActiveDomainName(), Common::ConfigManager::kApplicationDomain);
|
warning("The engine ID is not set for target '%s'", ConfMan.getActiveDomainName().c_str());
|
||||||
ConfMan.flushToDisk();
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
gameid.toLowercase();
|
if (gameId.empty()) {
|
||||||
ConfMan.set("gameid", gameid);
|
warning("The game ID is not set for target '%s'", ConfMan.getActiveDomainName().c_str());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Query the plugins and find one that will handle the specified gameid
|
const Plugin *plugin = EngineMan.findPlugin(engineId);
|
||||||
printf("User picked target '%s' (gameid '%s')...\n", ConfMan.getActiveDomainName().c_str(), gameid.c_str());
|
if (!plugin) {
|
||||||
printf(" Looking for a plugin supporting this gameid... ");
|
warning("'%s' is an invalid engine ID. Use the --list-engines command to list supported engine IDs", engineId.c_str());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
PlainGameDescriptor game = EngineMan.findGame(gameid, &plugin);
|
// Query the plugin for the game descriptor
|
||||||
|
printf(" Looking for a plugin supporting this target... %s\n", plugin->getName());
|
||||||
if (plugin == 0) {
|
PlainGameDescriptor game = plugin->get<MetaEngine>().findGame(gameId.c_str());
|
||||||
printf("failed\n");
|
if (!game.gameId) {
|
||||||
warning("%s is an invalid gameid. Use the --list-games option to list supported gameid", gameid.c_str());
|
warning("'%s' is an invalid game ID for the engine '%s'. Use the --list-games option to list supported game IDs", gameId.c_str(), engineId.c_str());
|
||||||
} else {
|
return 0;
|
||||||
printf("%s\n Starting '%s'\n", plugin->getName(), game.description);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void saveLastLaunchedTarget(const Common::String &target) {
|
||||||
|
if (ConfMan.hasGameDomain(target)) {
|
||||||
|
// Set the last selected game, so the game will be highlighted next time the user
|
||||||
|
// returns to the launcher.
|
||||||
|
ConfMan.set("lastselectedgame", target, Common::ConfigManager::kApplicationDomain);
|
||||||
|
ConfMan.flushToDisk();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: specify the possible return values here
|
// TODO: specify the possible return values here
|
||||||
static Common::Error runGame(const Plugin *plugin, OSystem &system, const Common::String &edebuglevels) {
|
static Common::Error runGame(const Plugin *plugin, OSystem &system, const Common::String &edebuglevels) {
|
||||||
// Determine the game data path, for validation and error messages
|
// Determine the game data path, for validation and error messages
|
||||||
|
@ -208,7 +219,7 @@ static Common::Error runGame(const Plugin *plugin, OSystem &system, const Common
|
||||||
Common::String caption(ConfMan.get("description"));
|
Common::String caption(ConfMan.get("description"));
|
||||||
|
|
||||||
if (caption.empty()) {
|
if (caption.empty()) {
|
||||||
PlainGameDescriptor game = EngineMan.findGame(ConfMan.get("gameid"));
|
PlainGameDescriptor game = EngineMan.findTarget(ConfMan.getActiveDomainName());
|
||||||
if (game.description) {
|
if (game.description) {
|
||||||
caption = game.description;
|
caption = game.description;
|
||||||
}
|
}
|
||||||
|
@ -532,6 +543,8 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
|
||||||
// work as well as it should. In theory everything should be destroyed
|
// work as well as it should. In theory everything should be destroyed
|
||||||
// cleanly, so this is now enabled to encourage people to fix bits :)
|
// cleanly, so this is now enabled to encourage people to fix bits :)
|
||||||
while (0 != ConfMan.getActiveDomain()) {
|
while (0 != ConfMan.getActiveDomain()) {
|
||||||
|
saveLastLaunchedTarget(ConfMan.getActiveDomainName());
|
||||||
|
|
||||||
// Try to find a plugin which feels responsible for the specified game.
|
// Try to find a plugin which feels responsible for the specified game.
|
||||||
const Plugin *plugin = detectPlugin();
|
const Plugin *plugin = detectPlugin();
|
||||||
if (plugin) {
|
if (plugin) {
|
||||||
|
|
104
base/plugins.cpp
104
base/plugins.cpp
|
@ -287,14 +287,14 @@ void PluginManagerUncached::init() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to load the plugin by searching in the ConfigManager for a matching
|
* Try to load the plugin by searching in the ConfigManager for a matching
|
||||||
* gameId under the domain 'plugin_files'.
|
* engine ID under the domain 'engine_plugin_files'.
|
||||||
**/
|
**/
|
||||||
bool PluginManagerUncached::loadPluginFromGameId(const Common::String &gameId) {
|
bool PluginManagerUncached::loadPluginFromEngineId(const Common::String &engineId) {
|
||||||
Common::ConfigManager::Domain *domain = ConfMan.getDomain("plugin_files");
|
Common::ConfigManager::Domain *domain = ConfMan.getDomain("engine_plugin_files");
|
||||||
|
|
||||||
if (domain) {
|
if (domain) {
|
||||||
if (domain->contains(gameId)) {
|
if (domain->contains(engineId)) {
|
||||||
Common::String filename = (*domain)[gameId];
|
Common::String filename = (*domain)[engineId];
|
||||||
|
|
||||||
if (loadPluginByFileName(filename)) {
|
if (loadPluginByFileName(filename)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -326,17 +326,17 @@ bool PluginManagerUncached::loadPluginByFileName(const Common::String &filename)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the config manager with a plugin file name that we found can handle
|
* Update the config manager with a plugin file name that we found can handle
|
||||||
* the game.
|
* the engine.
|
||||||
**/
|
**/
|
||||||
void PluginManagerUncached::updateConfigWithFileName(const Common::String &gameId) {
|
void PluginManagerUncached::updateConfigWithFileName(const Common::String &engineId) {
|
||||||
// Check if we have a filename for the current plugin
|
// Check if we have a filename for the current plugin
|
||||||
if ((*_currentPlugin)->getFileName()) {
|
if ((*_currentPlugin)->getFileName()) {
|
||||||
if (!ConfMan.hasMiscDomain("plugin_files"))
|
if (!ConfMan.hasMiscDomain("engine_plugin_files"))
|
||||||
ConfMan.addMiscDomain("plugin_files");
|
ConfMan.addMiscDomain("engine_plugin_files");
|
||||||
|
|
||||||
Common::ConfigManager::Domain *domain = ConfMan.getDomain("plugin_files");
|
Common::ConfigManager::Domain *domain = ConfMan.getDomain("engine_plugin_files");
|
||||||
assert(domain);
|
assert(domain);
|
||||||
(*domain)[gameId] = (*_currentPlugin)->getFileName();
|
(*domain)[engineId] = (*_currentPlugin)->getFileName();
|
||||||
|
|
||||||
ConfMan.flushToDisk();
|
ConfMan.flushToDisk();
|
||||||
}
|
}
|
||||||
|
@ -490,24 +490,12 @@ PlainGameDescriptor EngineManager::findGame(const Common::String &gameName, cons
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now look for the game using the gameId. This is much faster than scanning plugin
|
// We failed to find it in memory. Scan the list of plugins
|
||||||
// by plugin
|
|
||||||
if (PluginMan.loadPluginFromGameId(gameName)) {
|
|
||||||
result = findGameInLoadedPlugins(gameName, plugin);
|
|
||||||
if (result.gameId) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// We failed to find it using the gameid. Scan the list of plugins
|
|
||||||
PluginMan.loadFirstPlugin();
|
PluginMan.loadFirstPlugin();
|
||||||
do {
|
do {
|
||||||
result = findGameInLoadedPlugins(gameName, plugin);
|
result = findGameInLoadedPlugins(gameName, plugin);
|
||||||
if (result.gameId) {
|
if (result.gameId)
|
||||||
// Update with new plugin file name
|
|
||||||
PluginMan.updateConfigWithFileName(gameName);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
} while (PluginMan.loadNextPlugin());
|
} while (PluginMan.loadNextPlugin());
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -551,7 +539,6 @@ DetectionResults EngineManager::detectGames(const Common::FSList &fslist) const
|
||||||
DetectedGames engineCandidates = metaEngine.detectGames(fslist);
|
DetectedGames engineCandidates = metaEngine.detectGames(fslist);
|
||||||
|
|
||||||
for (uint i = 0; i < engineCandidates.size(); i++) {
|
for (uint i = 0; i < engineCandidates.size(); i++) {
|
||||||
engineCandidates[i].engineName = metaEngine.getName();
|
|
||||||
engineCandidates[i].path = fslist.begin()->getParent().getPath();
|
engineCandidates[i].path = fslist.begin()->getParent().getPath();
|
||||||
engineCandidates[i].shortPath = fslist.begin()->getParent().getDisplayName();
|
engineCandidates[i].shortPath = fslist.begin()->getParent().getDisplayName();
|
||||||
candidates.push_back(engineCandidates[i]);
|
candidates.push_back(engineCandidates[i]);
|
||||||
|
@ -597,6 +584,7 @@ Common::String EngineManager::createTargetForGame(const DetectedGame &game) {
|
||||||
ConfMan.addGameDomain(domain);
|
ConfMan.addGameDomain(domain);
|
||||||
|
|
||||||
// Copy all non-empty relevant values into the new domain
|
// Copy all non-empty relevant values into the new domain
|
||||||
|
addStringToConf("engineid", game.engineId, domain);
|
||||||
addStringToConf("gameid", game.gameId, domain);
|
addStringToConf("gameid", game.gameId, domain);
|
||||||
addStringToConf("description", game.description, domain);
|
addStringToConf("description", game.description, domain);
|
||||||
addStringToConf("language", Common::getLanguageCode(game.language), domain);
|
addStringToConf("language", Common::getLanguageCode(game.language), domain);
|
||||||
|
@ -623,6 +611,70 @@ Common::String EngineManager::createTargetForGame(const DetectedGame &game) {
|
||||||
return domain;
|
return domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Plugin *EngineManager::findLoadedPlugin(const Common::String &engineId) const {
|
||||||
|
const PluginList &plugins = getPlugins();
|
||||||
|
|
||||||
|
for (PluginList::const_iterator iter = plugins.begin(); iter != plugins.end(); iter++)
|
||||||
|
if (engineId == (*iter)->get<MetaEngine>().getEngineId())
|
||||||
|
return *iter;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Plugin *EngineManager::findPlugin(const Common::String &engineId) const {
|
||||||
|
// First look for the game using the plugins in memory. This is critical
|
||||||
|
// for calls coming from inside games
|
||||||
|
const Plugin *plugin = findLoadedPlugin(engineId);
|
||||||
|
if (plugin)
|
||||||
|
return plugin;
|
||||||
|
|
||||||
|
// Now look for the plugin using the engine ID. This is much faster than scanning plugin
|
||||||
|
// by plugin
|
||||||
|
if (PluginMan.loadPluginFromEngineId(engineId)) {
|
||||||
|
plugin = findLoadedPlugin(engineId);
|
||||||
|
if (plugin)
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We failed to find it using the engine ID. Scan the list of plugins
|
||||||
|
PluginMan.loadFirstPlugin();
|
||||||
|
do {
|
||||||
|
plugin = findLoadedPlugin(engineId);
|
||||||
|
if (plugin) {
|
||||||
|
// Update with new plugin file name
|
||||||
|
PluginMan.updateConfigWithFileName(engineId);
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
} while (PluginMan.loadNextPlugin());
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlainGameDescriptor EngineManager::findTarget(const Common::String &target, const Plugin **plugin) const {
|
||||||
|
// Ignore empty targets
|
||||||
|
if (target.empty())
|
||||||
|
return PlainGameDescriptor();
|
||||||
|
|
||||||
|
// Lookup the domain. If we have no domain, fallback on the old function [ultra-deprecated].
|
||||||
|
const Common::ConfigManager::Domain *domain = ConfMan.getDomain(target);
|
||||||
|
if (!domain || !domain->contains("gameid") || !domain->contains("engineid"))
|
||||||
|
return PlainGameDescriptor();
|
||||||
|
|
||||||
|
// Look for the engine ID
|
||||||
|
const Plugin *foundPlugin = findPlugin(domain->getVal("engineid"));
|
||||||
|
if (!foundPlugin) {
|
||||||
|
return PlainGameDescriptor();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure it does support the game ID
|
||||||
|
PlainGameDescriptor desc = foundPlugin->get<MetaEngine>().findGame(domain->getVal("gameid").c_str());
|
||||||
|
|
||||||
|
if (desc.gameId && plugin)
|
||||||
|
*plugin = foundPlugin;
|
||||||
|
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
// Music plugins
|
// Music plugins
|
||||||
|
|
||||||
#include "audio/musicplugin.h"
|
#include "audio/musicplugin.h"
|
||||||
|
|
|
@ -315,8 +315,8 @@ public:
|
||||||
virtual void init() {}
|
virtual void init() {}
|
||||||
virtual void loadFirstPlugin() {}
|
virtual void loadFirstPlugin() {}
|
||||||
virtual bool loadNextPlugin() { return false; }
|
virtual bool loadNextPlugin() { return false; }
|
||||||
virtual bool loadPluginFromGameId(const Common::String &gameId) { return false; }
|
virtual bool loadPluginFromEngineId(const Common::String &engineId) { return false; }
|
||||||
virtual void updateConfigWithFileName(const Common::String &gameId) {}
|
virtual void updateConfigWithFileName(const Common::String &engineId) {}
|
||||||
|
|
||||||
// Functions used only by the cached PluginManager
|
// Functions used only by the cached PluginManager
|
||||||
virtual void loadAllPlugins();
|
virtual void loadAllPlugins();
|
||||||
|
@ -345,8 +345,8 @@ public:
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void loadFirstPlugin();
|
virtual void loadFirstPlugin();
|
||||||
virtual bool loadNextPlugin();
|
virtual bool loadNextPlugin();
|
||||||
virtual bool loadPluginFromGameId(const Common::String &gameId);
|
virtual bool loadPluginFromEngineId(const Common::String &engineId);
|
||||||
virtual void updateConfigWithFileName(const Common::String &gameId);
|
virtual void updateConfigWithFileName(const Common::String &engineId);
|
||||||
|
|
||||||
virtual void loadAllPlugins() {} // we don't allow these
|
virtual void loadAllPlugins() {} // we don't allow these
|
||||||
virtual void loadAllPluginsOfType(PluginType type) {}
|
virtual void loadAllPluginsOfType(PluginType type) {}
|
||||||
|
|
|
@ -82,8 +82,6 @@ static Common::String generatePreferredTarget(const ADGameDescription *desc) {
|
||||||
DetectedGame AdvancedMetaEngine::toDetectedGame(const ADDetectedGame &adGame) const {
|
DetectedGame AdvancedMetaEngine::toDetectedGame(const ADDetectedGame &adGame) const {
|
||||||
const ADGameDescription *desc = adGame.desc;
|
const ADGameDescription *desc = adGame.desc;
|
||||||
|
|
||||||
const char *gameId = _singleId ? _singleId : desc->gameId;
|
|
||||||
|
|
||||||
const char *title;
|
const char *title;
|
||||||
const char *extra;
|
const char *extra;
|
||||||
if (desc->flags & ADGF_USEEXTRAASTITLE) {
|
if (desc->flags & ADGF_USEEXTRAASTITLE) {
|
||||||
|
@ -99,7 +97,7 @@ DetectedGame AdvancedMetaEngine::toDetectedGame(const ADDetectedGame &adGame) co
|
||||||
extra = desc->extra;
|
extra = desc->extra;
|
||||||
}
|
}
|
||||||
|
|
||||||
DetectedGame game(gameId, title, desc->language, desc->platform, extra);
|
DetectedGame game(getEngineId(), desc->gameId, title, desc->language, desc->platform, extra);
|
||||||
game.hasUnknownFiles = adGame.hasUnknownFiles;
|
game.hasUnknownFiles = adGame.hasUnknownFiles;
|
||||||
game.matchedFiles = adGame.matchedFiles;
|
game.matchedFiles = adGame.matchedFiles;
|
||||||
game.preferredTarget = generatePreferredTarget(desc);
|
game.preferredTarget = generatePreferredTarget(desc);
|
||||||
|
@ -264,7 +262,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine)
|
||||||
|
|
||||||
ADDetectedGame agdDesc;
|
ADDetectedGame agdDesc;
|
||||||
for (uint i = 0; i < matches.size(); i++) {
|
for (uint i = 0; i < matches.size(); i++) {
|
||||||
if ((_singleId || matches[i].desc->gameId == gameid) && !matches[i].hasUnknownFiles) {
|
if (matches[i].desc->gameId == gameid && !matches[i].hasUnknownFiles) {
|
||||||
agdDesc = matches[i];
|
agdDesc = matches[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -277,7 +275,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine)
|
||||||
if (agdDesc.desc) {
|
if (agdDesc.desc) {
|
||||||
// Seems we found a fallback match. But first perform a basic
|
// Seems we found a fallback match. But first perform a basic
|
||||||
// sanity check: the gameid must match.
|
// sanity check: the gameid must match.
|
||||||
if (!_singleId && agdDesc.desc->gameId != gameid)
|
if (agdDesc.desc->gameId != gameid)
|
||||||
agdDesc = ADDetectedGame();
|
agdDesc = ADDetectedGame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -556,21 +554,6 @@ ADDetectedGame AdvancedMetaEngine::detectGameFilebased(const FileMap &allFiles,
|
||||||
}
|
}
|
||||||
|
|
||||||
PlainGameList AdvancedMetaEngine::getSupportedGames() const {
|
PlainGameList AdvancedMetaEngine::getSupportedGames() const {
|
||||||
if (_singleId != NULL) {
|
|
||||||
PlainGameList gl;
|
|
||||||
|
|
||||||
const PlainGameDescriptor *g = _gameIds;
|
|
||||||
while (g->gameId) {
|
|
||||||
if (0 == scumm_stricmp(_singleId, g->gameId)) {
|
|
||||||
gl.push_back(*g);
|
|
||||||
|
|
||||||
return gl;
|
|
||||||
}
|
|
||||||
g++;
|
|
||||||
}
|
|
||||||
error("Engine %s doesn't have its singleid specified in ids list", _singleId);
|
|
||||||
}
|
|
||||||
|
|
||||||
return PlainGameList(_gameIds);
|
return PlainGameList(_gameIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,7 +572,6 @@ AdvancedMetaEngine::AdvancedMetaEngine(const void *descs, uint descItemSize, con
|
||||||
_extraGuiOptions(extraGuiOptions) {
|
_extraGuiOptions(extraGuiOptions) {
|
||||||
|
|
||||||
_md5Bytes = 5000;
|
_md5Bytes = 5000;
|
||||||
_singleId = NULL;
|
|
||||||
_flags = 0;
|
_flags = 0;
|
||||||
_guiOptions = GUIO_NONE;
|
_guiOptions = GUIO_NONE;
|
||||||
_maxScanDepth = 1;
|
_maxScanDepth = 1;
|
||||||
|
|
|
@ -205,19 +205,6 @@ protected:
|
||||||
*/
|
*/
|
||||||
uint _md5Bytes;
|
uint _md5Bytes;
|
||||||
|
|
||||||
/**
|
|
||||||
* Name of single gameid (optional).
|
|
||||||
*
|
|
||||||
* Used to override gameid.
|
|
||||||
* This is a recommended setting to prevent global gameid pollution.
|
|
||||||
* With this option set, the gameid effectively turns into engineid.
|
|
||||||
*
|
|
||||||
* FIXME: This field actually removes a feature (gameid) in order to
|
|
||||||
* address a more generic problem. We should find a better way to
|
|
||||||
* disambiguate gameids.
|
|
||||||
*/
|
|
||||||
const char *_singleId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A bitmask of flags which can be used to configure the behavior
|
* A bitmask of flags which can be used to configure the behavior
|
||||||
* of the AdvancedDetector. Refer to ADFlags for a list of flags
|
* of the AdvancedDetector. Refer to ADFlags for a list of flags
|
||||||
|
|
|
@ -673,12 +673,7 @@ bool Engine::shouldQuit() {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
EnginePlugin *Engine::getMetaEnginePlugin() const {
|
EnginePlugin *Engine::getMetaEnginePlugin() const {
|
||||||
|
return EngineMan.findPlugin(ConfMan.get("engineid"));
|
||||||
const EnginePlugin *plugin = 0;
|
|
||||||
Common::String gameid = ConfMan.get("gameid");
|
|
||||||
gameid.toLowercase();
|
|
||||||
EngineMan.findGame(gameid, &plugin);
|
|
||||||
return plugin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -50,7 +50,6 @@ PlainGameDescriptor PlainGameDescriptor::of(const char *gameId, const char *desc
|
||||||
}
|
}
|
||||||
|
|
||||||
DetectedGame::DetectedGame() :
|
DetectedGame::DetectedGame() :
|
||||||
engineName(nullptr),
|
|
||||||
hasUnknownFiles(false),
|
hasUnknownFiles(false),
|
||||||
canBeAdded(true),
|
canBeAdded(true),
|
||||||
language(Common::UNK_LANG),
|
language(Common::UNK_LANG),
|
||||||
|
@ -58,8 +57,8 @@ DetectedGame::DetectedGame() :
|
||||||
gameSupportLevel(kStableGame) {
|
gameSupportLevel(kStableGame) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DetectedGame::DetectedGame(const PlainGameDescriptor &pgd) :
|
DetectedGame::DetectedGame(const Common::String &engine, const PlainGameDescriptor &pgd) :
|
||||||
engineName(nullptr),
|
engineId(engine),
|
||||||
hasUnknownFiles(false),
|
hasUnknownFiles(false),
|
||||||
canBeAdded(true),
|
canBeAdded(true),
|
||||||
language(Common::UNK_LANG),
|
language(Common::UNK_LANG),
|
||||||
|
@ -71,8 +70,8 @@ DetectedGame::DetectedGame(const PlainGameDescriptor &pgd) :
|
||||||
description = pgd.description;
|
description = pgd.description;
|
||||||
}
|
}
|
||||||
|
|
||||||
DetectedGame::DetectedGame(const Common::String &id, const Common::String &d, Common::Language l, Common::Platform p, const Common::String &ex) :
|
DetectedGame::DetectedGame(const Common::String &engine, const Common::String &id, const Common::String &d, Common::Language l, Common::Platform p, const Common::String &ex) :
|
||||||
engineName(nullptr),
|
engineId(engine),
|
||||||
hasUnknownFiles(false),
|
hasUnknownFiles(false),
|
||||||
canBeAdded(true),
|
canBeAdded(true),
|
||||||
gameSupportLevel(kStableGame) {
|
gameSupportLevel(kStableGame) {
|
||||||
|
@ -178,20 +177,20 @@ Common::String generateUnknownGameReport(const DetectedGames &detectedGames, boo
|
||||||
|
|
||||||
FilePropertiesMap matchedFiles;
|
FilePropertiesMap matchedFiles;
|
||||||
|
|
||||||
const char *currentEngineName = nullptr;
|
Common::String currentEngineId;
|
||||||
for (uint i = 0; i < detectedGames.size(); i++) {
|
for (uint i = 0; i < detectedGames.size(); i++) {
|
||||||
const DetectedGame &game = detectedGames[i];
|
const DetectedGame &game = detectedGames[i];
|
||||||
|
|
||||||
if (!game.hasUnknownFiles) continue;
|
if (!game.hasUnknownFiles) continue;
|
||||||
|
|
||||||
if (!currentEngineName || strcmp(currentEngineName, game.engineName) != 0) {
|
if (currentEngineId.empty() || currentEngineId != game.engineId) {
|
||||||
currentEngineName = game.engineName;
|
currentEngineId = game.engineId;
|
||||||
|
|
||||||
// If the engine is not the same as for the previous entry, print an engine line header
|
// If the engine is not the same as for the previous entry, print an engine line header
|
||||||
report += "\n";
|
report += "\n";
|
||||||
report += Common::String::format(
|
report += Common::String::format(
|
||||||
translate ? _(reportEngineHeader) : reportEngineHeader,
|
translate ? _(reportEngineHeader) : reportEngineHeader,
|
||||||
game.engineName
|
game.engineId.c_str()
|
||||||
);
|
);
|
||||||
report += " ";
|
report += " ";
|
||||||
|
|
||||||
|
|
|
@ -98,8 +98,8 @@ typedef Common::HashMap<Common::String, FileProperties, Common::IgnoreCase_Hash,
|
||||||
*/
|
*/
|
||||||
struct DetectedGame {
|
struct DetectedGame {
|
||||||
DetectedGame();
|
DetectedGame();
|
||||||
explicit DetectedGame(const PlainGameDescriptor &pgd);
|
DetectedGame(const Common::String &engine, const PlainGameDescriptor &pgd);
|
||||||
DetectedGame(const Common::String &id,
|
DetectedGame(const Common::String &engine, const Common::String &id,
|
||||||
const Common::String &description,
|
const Common::String &description,
|
||||||
Common::Language language = Common::UNK_LANG,
|
Common::Language language = Common::UNK_LANG,
|
||||||
Common::Platform platform = Common::kPlatformUnknown,
|
Common::Platform platform = Common::kPlatformUnknown,
|
||||||
|
@ -109,10 +109,7 @@ struct DetectedGame {
|
||||||
void appendGUIOptions(const Common::String &str);
|
void appendGUIOptions(const Common::String &str);
|
||||||
Common::String getGUIOptions() const { return _guiOptions; }
|
Common::String getGUIOptions() const { return _guiOptions; }
|
||||||
|
|
||||||
/**
|
Common::String engineId;
|
||||||
* The name of the engine supporting the detected game
|
|
||||||
*/
|
|
||||||
const char *engineName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A game was detected, but some files were not recognized
|
* A game was detected, but some files were not recognized
|
||||||
|
|
|
@ -104,27 +104,27 @@
|
||||||
namespace Glk {
|
namespace Glk {
|
||||||
|
|
||||||
GlkDetectedGame::GlkDetectedGame(const char *id, const char *desc, const Common::String &filename) :
|
GlkDetectedGame::GlkDetectedGame(const char *id, const char *desc, const Common::String &filename) :
|
||||||
DetectedGame(id, desc, Common::EN_ANY, Common::kPlatformUnknown) {
|
DetectedGame("glk", id, desc, Common::EN_ANY, Common::kPlatformUnknown) {
|
||||||
setGUIOptions(GUIO3(GUIO_NOSPEECH, GUIO_NOMUSIC, GUIO_NOSUBTITLES));
|
setGUIOptions(GUIO3(GUIO_NOSPEECH, GUIO_NOMUSIC, GUIO_NOSUBTITLES));
|
||||||
addExtraEntry("filename", filename);
|
addExtraEntry("filename", filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
GlkDetectedGame::GlkDetectedGame(const char *id, const char *desc, const Common::String &filename,
|
GlkDetectedGame::GlkDetectedGame(const char *id, const char *desc, const Common::String &filename,
|
||||||
Common::Language lang) : DetectedGame(id, desc, lang, Common::kPlatformUnknown) {
|
Common::Language lang) : DetectedGame("glk", id, desc, lang, Common::kPlatformUnknown) {
|
||||||
setGUIOptions(GUIO3(GUIO_NOSPEECH, GUIO_NOMUSIC, GUIO_NOSUBTITLES));
|
setGUIOptions(GUIO3(GUIO_NOSPEECH, GUIO_NOMUSIC, GUIO_NOSUBTITLES));
|
||||||
addExtraEntry("filename", filename);
|
addExtraEntry("filename", filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
GlkDetectedGame::GlkDetectedGame(const char *id, const char *desc, const char *xtra,
|
GlkDetectedGame::GlkDetectedGame(const char *id, const char *desc, const char *xtra,
|
||||||
const Common::String &filename, Common::Language lang) :
|
const Common::String &filename, Common::Language lang) :
|
||||||
DetectedGame(id, desc, lang, Common::kPlatformUnknown, xtra) {
|
DetectedGame("glk", id, desc, lang, Common::kPlatformUnknown, xtra) {
|
||||||
setGUIOptions(GUIO3(GUIO_NOSPEECH, GUIO_NOMUSIC, GUIO_NOSUBTITLES));
|
setGUIOptions(GUIO3(GUIO_NOSPEECH, GUIO_NOMUSIC, GUIO_NOSUBTITLES));
|
||||||
addExtraEntry("filename", filename);
|
addExtraEntry("filename", filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
GlkDetectedGame::GlkDetectedGame(const char *id, const char *desc, const Common::String &filename,
|
GlkDetectedGame::GlkDetectedGame(const char *id, const char *desc, const Common::String &filename,
|
||||||
const Common::String &md5, size_t filesize) :
|
const Common::String &md5, size_t filesize) :
|
||||||
DetectedGame(id, desc, Common::UNK_LANG, Common::kPlatformUnknown) {
|
DetectedGame("glk", id, desc, Common::UNK_LANG, Common::kPlatformUnknown) {
|
||||||
setGUIOptions(GUIO3(GUIO_NOSPEECH, GUIO_NOMUSIC, GUIO_NOSUBTITLES));
|
setGUIOptions(GUIO3(GUIO_NOSPEECH, GUIO_NOMUSIC, GUIO_NOSUBTITLES));
|
||||||
addExtraEntry("filename", filename);
|
addExtraEntry("filename", filename);
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ bool FrotzMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g
|
||||||
gameList.push_back(GlkDetectedGame(desc.gameId, desc.description, filename, md5, filesize));
|
gameList.push_back(GlkDetectedGame(desc.gameId, desc.description, filename, md5, filesize));
|
||||||
} else {
|
} else {
|
||||||
GameDescriptor gameDesc = findGame(p->_gameId);
|
GameDescriptor gameDesc = findGame(p->_gameId);
|
||||||
DetectedGame gd = DetectedGame(p->_gameId, gameDesc._description, p->_language, Common::kPlatformUnknown, p->_extra);
|
DetectedGame gd = DetectedGame("glk", p->_gameId, gameDesc._description, p->_language, Common::kPlatformUnknown, p->_extra);
|
||||||
gd.setGUIOptions(p->_guiOptions);
|
gd.setGUIOptions(p->_guiOptions);
|
||||||
|
|
||||||
gd.addExtraEntry("filename", filename);
|
gd.addExtraEntry("filename", filename);
|
||||||
|
|
|
@ -752,7 +752,7 @@ bool Level9MetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Found the game, add a detection entry
|
// Found the game, add a detection entry
|
||||||
DetectedGame gd = DetectedGame(game->gameId, game->name, Common::UNK_LANG,
|
DetectedGame gd = DetectedGame("glk", game->gameId, game->name, Common::UNK_LANG,
|
||||||
Common::kPlatformUnknown, game->extra);
|
Common::kPlatformUnknown, game->extra);
|
||||||
gd.addExtraEntry("filename", filename);
|
gd.addExtraEntry("filename", filename);
|
||||||
gameList.push_back(gd);
|
gameList.push_back(gd);
|
||||||
|
|
|
@ -110,7 +110,7 @@ bool TADSMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &ga
|
||||||
gameList.push_back(GlkDetectedGame(desc._gameId, desc._description, filename, md5, filesize));
|
gameList.push_back(GlkDetectedGame(desc._gameId, desc._description, filename, md5, filesize));
|
||||||
} else {
|
} else {
|
||||||
PlainGameDescriptor gameDesc = findGame(p->_gameId);
|
PlainGameDescriptor gameDesc = findGame(p->_gameId);
|
||||||
gd = DetectedGame(p->_gameId, gameDesc.description, p->_language, Common::kPlatformUnknown, p->_extra);
|
gd = DetectedGame("glk", p->_gameId, gameDesc.description, p->_language, Common::kPlatformUnknown, p->_extra);
|
||||||
gd.addExtraEntry("filename", filename);
|
gd.addExtraEntry("filename", filename);
|
||||||
gameList.push_back(gd);
|
gameList.push_back(gd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -673,14 +673,12 @@ MenuActionLoadGame::MenuActionLoadGame(BaseMenuSystem *menuSystem, uint choiceIn
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuActionLoadGame::execute() {
|
void MenuActionLoadGame::execute() {
|
||||||
const Plugin *plugin = NULL;
|
|
||||||
EngineMan.findGame(ConfMan.get("gameid"), &plugin);
|
|
||||||
GUI::SaveLoadChooser *dialog;
|
GUI::SaveLoadChooser *dialog;
|
||||||
Common::String desc;
|
Common::String desc;
|
||||||
int slot;
|
int slot;
|
||||||
|
|
||||||
dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false);
|
dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false);
|
||||||
slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
|
slot = dialog->runModalWithCurrentTarget();
|
||||||
|
|
||||||
delete dialog;
|
delete dialog;
|
||||||
|
|
||||||
|
@ -698,14 +696,12 @@ MenuActionSaveGame::MenuActionSaveGame(BaseMenuSystem *menuSystem, uint choiceIn
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuActionSaveGame::execute() {
|
void MenuActionSaveGame::execute() {
|
||||||
const Plugin *plugin = NULL;
|
|
||||||
EngineMan.findGame(ConfMan.get("gameid"), &plugin);
|
|
||||||
GUI::SaveLoadChooser *dialog;
|
GUI::SaveLoadChooser *dialog;
|
||||||
Common::String desc;
|
Common::String desc;
|
||||||
int slot;
|
int slot;
|
||||||
|
|
||||||
dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
|
dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
|
||||||
slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
|
slot = dialog->runModalWithCurrentTarget();
|
||||||
desc = dialog->getResultString().c_str();
|
desc = dialog->getResultString().c_str();
|
||||||
|
|
||||||
delete dialog;
|
delete dialog;
|
||||||
|
|
|
@ -63,10 +63,6 @@ public:
|
||||||
_md5Bytes = 5000000; // TODO: Upper limit, adjust it once all games are added
|
_md5Bytes = 5000000; // TODO: Upper limit, adjust it once all games are added
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *getName() const {
|
|
||||||
return "MacVenture";
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *getEngineId() const override {
|
const char *getEngineId() const override {
|
||||||
return "macventure";
|
return "macventure";
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,9 @@ class MetaEngine : public PluginObject {
|
||||||
public:
|
public:
|
||||||
virtual ~MetaEngine() {}
|
virtual ~MetaEngine() {}
|
||||||
|
|
||||||
|
/** Get the engine ID */
|
||||||
|
virtual const char *getEngineId() const = 0;
|
||||||
|
|
||||||
/** Returns some copyright information about the original engine. */
|
/** Returns some copyright information about the original engine. */
|
||||||
virtual const char *getOriginalCopyright() const = 0;
|
virtual const char *getOriginalCopyright() const = 0;
|
||||||
|
|
||||||
|
@ -267,17 +270,37 @@ public:
|
||||||
*/
|
*/
|
||||||
class EngineManager : public Common::Singleton<EngineManager> {
|
class EngineManager : public Common::Singleton<EngineManager> {
|
||||||
public:
|
public:
|
||||||
PlainGameDescriptor findGameInLoadedPlugins(const Common::String &gameName, const Plugin **plugin = NULL) const;
|
/**
|
||||||
PlainGameDescriptor findGame(const Common::String &gameName, const Plugin **plugin = NULL) const;
|
* Given a list of FSNodes in a given directory, detect a set of games contained within
|
||||||
|
*
|
||||||
|
* Returns an empty list if none are found.
|
||||||
|
*/
|
||||||
DetectionResults detectGames(const Common::FSList &fslist) const;
|
DetectionResults detectGames(const Common::FSList &fslist) const;
|
||||||
|
|
||||||
|
/** Find a plugin by its engine ID */
|
||||||
|
const Plugin *findPlugin(const Common::String &engineId) const;
|
||||||
|
|
||||||
|
/** Get the list of all engine plugins */
|
||||||
const PluginList &getPlugins() const;
|
const PluginList &getPlugins() const;
|
||||||
|
|
||||||
|
/** Find a target */ // TODO: Expand on description
|
||||||
|
PlainGameDescriptor findTarget(const Common::String &target, const Plugin **plugin = NULL) const;
|
||||||
|
|
||||||
|
/** Find a game across all plugins */ // TODO: Naming, this should be gameId
|
||||||
|
PlainGameDescriptor findGame(const Common::String &gameName, const Plugin **plugin = NULL) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a target from the supplied game descriptor
|
* Create a target from the supplied game descriptor
|
||||||
*
|
*
|
||||||
* Returns the created target name.
|
* Returns the created target name.
|
||||||
*/
|
*/
|
||||||
Common::String createTargetForGame(const DetectedGame &game);
|
Common::String createTargetForGame(const DetectedGame &game);
|
||||||
|
private:
|
||||||
|
/** Find a game across all loaded plugins */
|
||||||
|
PlainGameDescriptor findGameInLoadedPlugins(const Common::String &gameName, const Plugin **plugin = NULL) const;
|
||||||
|
|
||||||
|
/** Find a loaded plugin with the given engine ID */
|
||||||
|
const Plugin *findLoadedPlugin(const Common::String &engineId) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Convenience shortcut for accessing the engine manager. */
|
/** Convenience shortcut for accessing the engine manager. */
|
||||||
|
|
|
@ -870,8 +870,6 @@ void SavegameListBox::pageDown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int GameStateMenu::scummVMSaveLoadDialog(bool isSave, Common::String &saveDesc) {
|
int GameStateMenu::scummVMSaveLoadDialog(bool isSave, Common::String &saveDesc) {
|
||||||
const Plugin *plugin = nullptr;
|
|
||||||
EngineMan.findGame(ConfMan.get("gameid"), &plugin);
|
|
||||||
GUI::SaveLoadChooser *dialog;
|
GUI::SaveLoadChooser *dialog;
|
||||||
Common::String desc;
|
Common::String desc;
|
||||||
int slot;
|
int slot;
|
||||||
|
@ -879,7 +877,7 @@ int GameStateMenu::scummVMSaveLoadDialog(bool isSave, Common::String &saveDesc)
|
||||||
if (isSave) {
|
if (isSave) {
|
||||||
dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
|
dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
|
||||||
|
|
||||||
slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
|
slot = dialog->runModalWithCurrentTarget();
|
||||||
desc = dialog->getResultString();
|
desc = dialog->getResultString();
|
||||||
|
|
||||||
if (desc.empty())
|
if (desc.empty())
|
||||||
|
@ -891,7 +889,7 @@ int GameStateMenu::scummVMSaveLoadDialog(bool isSave, Common::String &saveDesc)
|
||||||
saveDesc = desc;
|
saveDesc = desc;
|
||||||
} else {
|
} else {
|
||||||
dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false);
|
dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false);
|
||||||
slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
|
slot = dialog->runModalWithCurrentTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete dialog;
|
delete dialog;
|
||||||
|
|
|
@ -58,8 +58,7 @@ void upgradeTargetIfNecessary(const ObsoleteGameID *obsoleteList) {
|
||||||
PlainGameDescriptor findGameID(
|
PlainGameDescriptor findGameID(
|
||||||
const char *gameid,
|
const char *gameid,
|
||||||
const PlainGameDescriptor *gameids,
|
const PlainGameDescriptor *gameids,
|
||||||
const ObsoleteGameID *obsoleteList
|
const ObsoleteGameID *obsoleteList) {
|
||||||
) {
|
|
||||||
// First search the list of supported gameids for a match.
|
// First search the list of supported gameids for a match.
|
||||||
const PlainGameDescriptor *g = findPlainGameDescriptor(gameid, gameids);
|
const PlainGameDescriptor *g = findPlainGameDescriptor(gameid, gameids);
|
||||||
if (g)
|
if (g)
|
||||||
|
|
|
@ -69,8 +69,7 @@ void upgradeTargetIfNecessary(const ObsoleteGameID *obsoleteList);
|
||||||
PlainGameDescriptor findGameID(
|
PlainGameDescriptor findGameID(
|
||||||
const char *gameid,
|
const char *gameid,
|
||||||
const PlainGameDescriptor *gameids,
|
const PlainGameDescriptor *gameids,
|
||||||
const ObsoleteGameID *obsoleteList = 0
|
const ObsoleteGameID *obsoleteList = 0);
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
} // End of namespace Engines
|
} // End of namespace Engines
|
||||||
|
|
|
@ -354,12 +354,7 @@ void PegasusEngine::runIntro() {
|
||||||
Common::Error PegasusEngine::showLoadDialog() {
|
Common::Error PegasusEngine::showLoadDialog() {
|
||||||
GUI::SaveLoadChooser slc(_("Load game:"), _("Load"), false);
|
GUI::SaveLoadChooser slc(_("Load game:"), _("Load"), false);
|
||||||
|
|
||||||
Common::String gameId = ConfMan.get("gameid");
|
int slot = slc.runModalWithCurrentTarget();
|
||||||
|
|
||||||
const Plugin *plugin = nullptr;
|
|
||||||
EngineMan.findGame(gameId, &plugin);
|
|
||||||
|
|
||||||
int slot = slc.runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
|
|
||||||
|
|
||||||
Common::Error result;
|
Common::Error result;
|
||||||
|
|
||||||
|
@ -378,12 +373,7 @@ Common::Error PegasusEngine::showLoadDialog() {
|
||||||
Common::Error PegasusEngine::showSaveDialog() {
|
Common::Error PegasusEngine::showSaveDialog() {
|
||||||
GUI::SaveLoadChooser slc(_("Save game:"), _("Save"), true);
|
GUI::SaveLoadChooser slc(_("Save game:"), _("Save"), true);
|
||||||
|
|
||||||
Common::String gameId = ConfMan.get("gameid");
|
int slot = slc.runModalWithCurrentTarget();
|
||||||
|
|
||||||
const Plugin *plugin = nullptr;
|
|
||||||
EngineMan.findGame(gameId, &plugin);
|
|
||||||
|
|
||||||
int slot = slc.runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
|
|
||||||
|
|
||||||
if (slot >= 0)
|
if (slot >= 0)
|
||||||
return saveGameState(slot, slc.getResultString());
|
return saveGameState(slot, slc.getResultString());
|
||||||
|
|
|
@ -1049,7 +1049,7 @@ DetectedGames ScummMetaEngine::detectGames(const Common::FSList &fslist) const {
|
||||||
const PlainGameDescriptor *g = findPlainGameDescriptor(x->game.gameid, gameDescriptions);
|
const PlainGameDescriptor *g = findPlainGameDescriptor(x->game.gameid, gameDescriptions);
|
||||||
assert(g);
|
assert(g);
|
||||||
|
|
||||||
DetectedGame game = DetectedGame(x->game.gameid, g->description, x->language, x->game.platform, x->extra);
|
DetectedGame game = DetectedGame(getEngineId(), x->game.gameid, g->description, x->language, x->game.platform, x->extra);
|
||||||
|
|
||||||
// Compute and set the preferred target name for this game.
|
// Compute and set the preferred target name for this game.
|
||||||
// Based on generateComplexID() in advancedDetector.cpp.
|
// Based on generateComplexID() in advancedDetector.cpp.
|
||||||
|
|
|
@ -189,12 +189,12 @@ DetectedGames SkyMetaEngine::detectGames(const Common::FSList &fslist) const {
|
||||||
if (sv->dinnerTableEntries) {
|
if (sv->dinnerTableEntries) {
|
||||||
Common::String extra = Common::String::format("v0.0%d %s", sv->version, sv->extraDesc);
|
Common::String extra = Common::String::format("v0.0%d %s", sv->version, sv->extraDesc);
|
||||||
|
|
||||||
DetectedGame game = DetectedGame(skySetting.gameId, skySetting.description, Common::UNK_LANG, Common::kPlatformUnknown, extra);
|
DetectedGame game = DetectedGame(getEngineId(), skySetting.gameId, skySetting.description, Common::UNK_LANG, Common::kPlatformUnknown, extra);
|
||||||
game.setGUIOptions(sv->guioptions);
|
game.setGUIOptions(sv->guioptions);
|
||||||
|
|
||||||
detectedGames.push_back(game);
|
detectedGames.push_back(game);
|
||||||
} else {
|
} else {
|
||||||
detectedGames.push_back(DetectedGame(skySetting.gameId, skySetting.description));
|
detectedGames.push_back(DetectedGame(getEngineId(), skySetting.gameId, skySetting.description));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -218,17 +218,17 @@ DetectedGames SwordMetaEngine::detectGames(const Common::FSList &fslist) const {
|
||||||
|
|
||||||
DetectedGame game;
|
DetectedGame game;
|
||||||
if (mainFilesFound && pcFilesFound && demoFilesFound)
|
if (mainFilesFound && pcFilesFound && demoFilesFound)
|
||||||
game = DetectedGame(sword1DemoSettings);
|
game = DetectedGame(getEngineId(), sword1DemoSettings);
|
||||||
else if (mainFilesFound && pcFilesFound && psxFilesFound)
|
else if (mainFilesFound && pcFilesFound && psxFilesFound)
|
||||||
game = DetectedGame(sword1PSXSettings);
|
game = DetectedGame(getEngineId(), sword1PSXSettings);
|
||||||
else if (mainFilesFound && pcFilesFound && psxDemoFilesFound)
|
else if (mainFilesFound && pcFilesFound && psxDemoFilesFound)
|
||||||
game = DetectedGame(sword1PSXDemoSettings);
|
game = DetectedGame(getEngineId(), sword1PSXDemoSettings);
|
||||||
else if (mainFilesFound && pcFilesFound && !psxFilesFound)
|
else if (mainFilesFound && pcFilesFound && !psxFilesFound)
|
||||||
game = DetectedGame(sword1FullSettings);
|
game = DetectedGame(getEngineId(), sword1FullSettings);
|
||||||
else if (mainFilesFound && macFilesFound)
|
else if (mainFilesFound && macFilesFound)
|
||||||
game = DetectedGame(sword1MacFullSettings);
|
game = DetectedGame(getEngineId(), sword1MacFullSettings);
|
||||||
else if (mainFilesFound && macDemoFilesFound)
|
else if (mainFilesFound && macDemoFilesFound)
|
||||||
game = DetectedGame(sword1MacDemoSettings);
|
game = DetectedGame(getEngineId(), sword1MacDemoSettings);
|
||||||
else
|
else
|
||||||
return detectedGames;
|
return detectedGames;
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ DetectedGames detectGamesImpl(const Common::FSList &fslist, bool recursion = fal
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Match found, add to list of candidates, then abort inner loop.
|
// Match found, add to list of candidates, then abort inner loop.
|
||||||
DetectedGame game = DetectedGame(g->gameid, g->description);
|
DetectedGame game = DetectedGame("sword2", g->gameid, g->description);
|
||||||
game.setGUIOptions(GUIO2(GUIO_NOMIDI, GUIO_NOASPECT));
|
game.setGUIOptions(GUIO2(GUIO_NOMIDI, GUIO_NOASPECT));
|
||||||
|
|
||||||
detectedGames.push_back(game);
|
detectedGames.push_back(game);
|
||||||
|
|
|
@ -599,7 +599,7 @@ void EventRecorder::setFileHeader() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TimeDate t;
|
TimeDate t;
|
||||||
PlainGameDescriptor desc = EngineMan.findGame(ConfMan.getActiveDomainName());
|
PlainGameDescriptor desc = EngineMan.findTarget(ConfMan.getActiveDomainName());
|
||||||
g_system->getTimeAndDate(t);
|
g_system->getTimeAndDate(t);
|
||||||
if (_author.empty()) {
|
if (_author.empty()) {
|
||||||
setAuthor("Unknown Author");
|
setAuthor("Unknown Author");
|
||||||
|
@ -618,9 +618,7 @@ SDL_Surface *EventRecorder::getSurface(int width, int height) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EventRecorder::switchMode() {
|
bool EventRecorder::switchMode() {
|
||||||
const Common::String gameId = ConfMan.get("gameid");
|
const Plugin *plugin = EngineMan.findPlugin(ConfMan.get("engineid"));
|
||||||
const Plugin *plugin = nullptr;
|
|
||||||
EngineMan.findGame(gameId, &plugin);
|
|
||||||
bool metaInfoSupport = plugin->get<MetaEngine>().hasFeature(MetaEngine::kSavesSupportMetaInfo);
|
bool metaInfoSupport = plugin->get<MetaEngine>().hasFeature(MetaEngine::kSavesSupportMetaInfo);
|
||||||
bool featuresSupport = metaInfoSupport &&
|
bool featuresSupport = metaInfoSupport &&
|
||||||
g_engine->canSaveGameStateCurrently() &&
|
g_engine->canSaveGameStateCurrently() &&
|
||||||
|
@ -630,8 +628,10 @@ bool EventRecorder::switchMode() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Common::String target = ConfMan.getActiveDomainName();
|
||||||
|
SaveStateList saveList = plugin->get<MetaEngine>().listSaves(target.c_str());
|
||||||
|
|
||||||
int emptySlot = 1;
|
int emptySlot = 1;
|
||||||
SaveStateList saveList = plugin->get<MetaEngine>().listSaves(gameId.c_str());
|
|
||||||
for (SaveStateList::const_iterator x = saveList.begin(); x != saveList.end(); ++x) {
|
for (SaveStateList::const_iterator x = saveList.begin(); x != saveList.end(); ++x) {
|
||||||
int saveSlot = x->getSaveSlot();
|
int saveSlot = x->getSaveSlot();
|
||||||
if (saveSlot == 0) {
|
if (saveSlot == 0) {
|
||||||
|
@ -666,10 +666,9 @@ bool EventRecorder::checkForContinueGame() {
|
||||||
|
|
||||||
void EventRecorder::deleteTemporarySave() {
|
void EventRecorder::deleteTemporarySave() {
|
||||||
if (_temporarySlot == -1) return;
|
if (_temporarySlot == -1) return;
|
||||||
const Common::String gameId = ConfMan.get("gameid");
|
const Plugin *plugin = EngineMan.findPlugin(ConfMan.get("engineid"));
|
||||||
const Plugin *plugin = 0;
|
const Common::String target = ConfMan.getActiveDomainName();
|
||||||
EngineMan.findGame(gameId, &plugin);
|
plugin->get<MetaEngine>().removeSaveState(target.c_str(), _temporarySlot);
|
||||||
plugin->get<MetaEngine>().removeSaveState(gameId.c_str(), _temporarySlot);
|
|
||||||
_temporarySlot = -1;
|
_temporarySlot = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -269,8 +269,9 @@ void LauncherDialog::updateListing() {
|
||||||
|
|
||||||
if (gameid.empty())
|
if (gameid.empty())
|
||||||
gameid = iter->_key;
|
gameid = iter->_key;
|
||||||
|
|
||||||
if (description.empty()) {
|
if (description.empty()) {
|
||||||
PlainGameDescriptor g = EngineMan.findGame(gameid);
|
PlainGameDescriptor g = EngineMan.findTarget(iter->_key);
|
||||||
if (g.description)
|
if (g.description)
|
||||||
description = g.description;
|
description = g.description;
|
||||||
}
|
}
|
||||||
|
@ -416,9 +417,6 @@ void LauncherDialog::editGame(int item) {
|
||||||
// This is useful because e.g. MonkeyVGA needs AdLib music to have decent
|
// This is useful because e.g. MonkeyVGA needs AdLib music to have decent
|
||||||
// music support etc.
|
// music support etc.
|
||||||
assert(item >= 0);
|
assert(item >= 0);
|
||||||
String gameId(ConfMan.get("gameid", _domains[item]));
|
|
||||||
if (gameId.empty())
|
|
||||||
gameId = _domains[item];
|
|
||||||
|
|
||||||
EditGameDialog editDialog(_domains[item]);
|
EditGameDialog editDialog(_domains[item]);
|
||||||
if (editDialog.runModal() > 0) {
|
if (editDialog.runModal() > 0) {
|
||||||
|
@ -480,17 +478,13 @@ void LauncherDialog::recordGame(int item) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void LauncherDialog::loadGame(int item) {
|
void LauncherDialog::loadGame(int item) {
|
||||||
String gameId = ConfMan.get("gameid", _domains[item]);
|
|
||||||
if (gameId.empty())
|
|
||||||
gameId = _domains[item];
|
|
||||||
|
|
||||||
const Plugin *plugin = nullptr;
|
|
||||||
|
|
||||||
EngineMan.findGame(gameId, &plugin);
|
|
||||||
|
|
||||||
String target = _domains[item];
|
String target = _domains[item];
|
||||||
target.toLowercase();
|
target.toLowercase();
|
||||||
|
|
||||||
|
// Look for the plugin
|
||||||
|
const Plugin *plugin = nullptr;
|
||||||
|
EngineMan.findTarget(target, &plugin);
|
||||||
|
|
||||||
if (plugin) {
|
if (plugin) {
|
||||||
const MetaEngine &metaEngine = plugin->get<MetaEngine>();
|
const MetaEngine &metaEngine = plugin->get<MetaEngine>();
|
||||||
if (metaEngine.hasFeature(MetaEngine::kSupportsListSaves) &&
|
if (metaEngine.hasFeature(MetaEngine::kSupportsListSaves) &&
|
||||||
|
|
|
@ -207,7 +207,7 @@ void MassAddDialog::handleTickle() {
|
||||||
while (path != "/" && path.lastChar() == '/')
|
while (path != "/" && path.lastChar() == '/')
|
||||||
path.deleteLastChar();
|
path.deleteLastChar();
|
||||||
|
|
||||||
// Check for existing config entries for this path/gameid/lang/platform combination
|
// Check for existing config entries for this path/engineid/gameid/lang/platform combination
|
||||||
if (_pathToTargets.contains(path)) {
|
if (_pathToTargets.contains(path)) {
|
||||||
Common::String resultPlatformCode = Common::getPlatformCode(result.platform);
|
Common::String resultPlatformCode = Common::getPlatformCode(result.platform);
|
||||||
Common::String resultLanguageCode = Common::getLanguageCode(result.language);
|
Common::String resultLanguageCode = Common::getLanguageCode(result.language);
|
||||||
|
@ -215,11 +215,12 @@ void MassAddDialog::handleTickle() {
|
||||||
bool duplicate = false;
|
bool duplicate = false;
|
||||||
const StringArray &targets = _pathToTargets[path];
|
const StringArray &targets = _pathToTargets[path];
|
||||||
for (StringArray::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) {
|
for (StringArray::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) {
|
||||||
// If the gameid, platform and language match -> skip it
|
// If the engineid, gameid, platform and language match -> skip it
|
||||||
Common::ConfigManager::Domain *dom = ConfMan.getDomain(*iter);
|
Common::ConfigManager::Domain *dom = ConfMan.getDomain(*iter);
|
||||||
assert(dom);
|
assert(dom);
|
||||||
|
|
||||||
if ((*dom)["gameid"] == result.gameId &&
|
if ((*dom)["engineid"] == result.engineId &&
|
||||||
|
(*dom)["gameid"] == result.gameId &&
|
||||||
(*dom)["platform"] == resultPlatformCode &&
|
(*dom)["platform"] == resultPlatformCode &&
|
||||||
(*dom)["language"] == resultLanguageCode) {
|
(*dom)["language"] == resultLanguageCode) {
|
||||||
duplicate = true;
|
duplicate = true;
|
||||||
|
|
|
@ -166,8 +166,7 @@ void RecorderDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|
||||||
break;
|
break;
|
||||||
case kRecordCmd: {
|
case kRecordCmd: {
|
||||||
TimeDate t;
|
TimeDate t;
|
||||||
Common::String gameId = ConfMan.get("gameid", _target);
|
PlainGameDescriptor desc = EngineMan.findTarget(_target);
|
||||||
PlainGameDescriptor desc = EngineMan.findGame(gameId);
|
|
||||||
g_system->getTimeAndDate(t);
|
g_system->getTimeAndDate(t);
|
||||||
EditRecordDialog editDlg(_("Unknown Author"), Common::String::format("%.2d.%.2d.%.4d ", t.tm_mday, t.tm_mon, 1900 + t.tm_year) + desc.description, "");
|
EditRecordDialog editDlg(_("Unknown Author"), Common::String::format("%.2d.%.2d.%.4d ", t.tm_mday, t.tm_mon, 1900 + t.tm_year) + desc.description, "");
|
||||||
if (editDlg.runModal() != kOKCmd) {
|
if (editDlg.runModal() != kOKCmd) {
|
||||||
|
|
|
@ -76,11 +76,7 @@ Common::String SaveLoadChooser::createDefaultSaveDescription(const int slot) con
|
||||||
}
|
}
|
||||||
|
|
||||||
int SaveLoadChooser::runModalWithCurrentTarget() {
|
int SaveLoadChooser::runModalWithCurrentTarget() {
|
||||||
const Common::String gameId = ConfMan.get("gameid");
|
const Plugin *plugin = EngineMan.findPlugin(ConfMan.get("engineid"));
|
||||||
|
|
||||||
const Plugin *plugin = 0;
|
|
||||||
EngineMan.findGame(gameId, &plugin);
|
|
||||||
|
|
||||||
return runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
|
return runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -193,13 +193,13 @@ Common::String UnknownGameDialog::generateBugtrackerURL() {
|
||||||
Common::String report = generateUnknownGameReport(_detectedGame, false, false);
|
Common::String report = generateUnknownGameReport(_detectedGame, false, false);
|
||||||
report = encodeUrlString(report);
|
report = encodeUrlString(report);
|
||||||
|
|
||||||
Common::String engineName = encodeUrlString(_detectedGame.engineName);
|
Common::String engineId = encodeUrlString(_detectedGame.engineId);
|
||||||
|
|
||||||
return Common::String::format(
|
return Common::String::format(
|
||||||
"https://www.scummvm.org/unknowngame?"
|
"https://www.scummvm.org/unknowngame?"
|
||||||
"engine=%s"
|
"engine=%s"
|
||||||
"&description=%s",
|
"&description=%s",
|
||||||
engineName.c_str(),
|
engineId.c_str(),
|
||||||
report.c_str());
|
report.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue