ENGINES: Copy the data referenced by QualifiedGameDescriptor
The engineId, gameId and description come from static data in the game engines. When the game engines are compiled as dynamic plugins, the QGD structure may outlive the engine plugin. Making a copy ensures the data remains available. Fixes #11292.
This commit is contained in:
parent
13e0ea0ad4
commit
9454346782
6 changed files with 15 additions and 21 deletions
|
@ -804,7 +804,7 @@ static void listTargets() {
|
|||
// If there's no description, fallback on the default description.
|
||||
if (description.empty()) {
|
||||
QualifiedGameDescriptor g = EngineMan.findTarget(name);
|
||||
if (g.description)
|
||||
if (!g.description.empty())
|
||||
description = g.description;
|
||||
}
|
||||
// If there's still no description, we cannot come up with one. Insert some dummy text.
|
||||
|
@ -854,7 +854,7 @@ static Common::Error listSaves(const Common::String &singleTarget) {
|
|||
currentTarget = *i;
|
||||
EngineMan.upgradeTargetIfNecessary(*i);
|
||||
game = EngineMan.findTarget(*i, &plugin);
|
||||
} else if (game = findGameMatchingName(*i), game.gameId) {
|
||||
} else if (game = findGameMatchingName(*i), !game.gameId.empty()) {
|
||||
// The name is a known game id
|
||||
plugin = EngineMan.findPlugin(game.engineId);
|
||||
currentTarget = createTemporaryTarget(game.engineId, game.gameId);
|
||||
|
@ -1278,7 +1278,7 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
|
|||
QualifiedGameDescriptor gameOption;
|
||||
if (settings.contains("game")) {
|
||||
gameOption = findGameMatchingName(settings["game"]);
|
||||
if (!gameOption.gameId) {
|
||||
if (gameOption.gameId.empty()) {
|
||||
usage("Unrecognized game '%s'. Use the --list-games command for a list of accepted values.\n", settings["game"].c_str());
|
||||
}
|
||||
}
|
||||
|
@ -1361,7 +1361,7 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
|
|||
if (ConfMan.hasGameDomain(command)) {
|
||||
// Command is a known target
|
||||
ConfMan.setActiveDomain(command);
|
||||
} else if (gd = findGameMatchingName(command), gd.gameId) {
|
||||
} else if (gd = findGameMatchingName(command), !gd.gameId.empty()) {
|
||||
// Command is a known game ID
|
||||
Common::String domainName = createTemporaryTarget(gd.engineId, gd.gameId);
|
||||
ConfMan.setActiveDomain(domainName);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue