ENGINES: Remove support for GUI options in MetaEngineDetection subclasses
This commit is contained in:
parent
0da774a218
commit
2c8a7d3900
14 changed files with 24 additions and 151 deletions
|
@ -186,12 +186,6 @@ static Common::Error runGame(const Plugin *plugin, const Plugin *enginePlugin, O
|
|||
|
||||
// Create the game's MetaEngineDetection.
|
||||
const MetaEngineDetection &metaEngineDetection = plugin->get<MetaEngineDetection>();
|
||||
if (err.getCode() == Common::kNoError) {
|
||||
// Set default values for all of the custom engine options
|
||||
// Apparently some engines query them in their constructor, thus we
|
||||
// need to set this up before instance creation.
|
||||
metaEngineDetection.registerDefaultSettings(target);
|
||||
}
|
||||
|
||||
// before we instantiate the engine, we register debug channels for it
|
||||
DebugMan.addAllDebugChannels(metaEngineDetection.getDebugChannels());
|
||||
|
|
|
@ -309,34 +309,6 @@ DetectedGames AdvancedMetaEngineDetection::detectGames(const Common::FSList &fsl
|
|||
return detectedGames;
|
||||
}
|
||||
|
||||
const ExtraGuiOptions AdvancedMetaEngineDetection::getExtraGuiOptions(const Common::String &target) const {
|
||||
if (!_extraGuiOptions)
|
||||
return ExtraGuiOptions();
|
||||
|
||||
ExtraGuiOptions options;
|
||||
|
||||
// If there isn't any target specified, return all available GUI options.
|
||||
// Only used when an engine starts in order to set option defaults.
|
||||
if (target.empty()) {
|
||||
for (const ADExtraGuiOptionsMap *entry = _extraGuiOptions; entry->guioFlag; ++entry)
|
||||
options.push_back(entry->option);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
// Query the GUI options
|
||||
const Common::String guiOptionsString = ConfMan.get("guioptions", target);
|
||||
const Common::String guiOptions = parseGameGUIOptions(guiOptionsString);
|
||||
|
||||
// Add all the applying extra GUI options.
|
||||
for (const ADExtraGuiOptionsMap *entry = _extraGuiOptions; entry->guioFlag; ++entry) {
|
||||
if (guiOptions.contains(entry->guioFlag))
|
||||
options.push_back(entry->option);
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
const ExtraGuiOptions AdvancedMetaEngine::getExtraGuiOptions(const Common::String &target) const {
|
||||
const ADExtraGuiOptionsMap *extraGuiOptions = getAdvancedExtraGuiOptions();
|
||||
if (!extraGuiOptions)
|
||||
|
@ -828,9 +800,8 @@ static const char *grayList[] = {
|
|||
0
|
||||
};
|
||||
|
||||
AdvancedMetaEngineDetection::AdvancedMetaEngineDetection(const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds, const ADExtraGuiOptionsMap *extraGuiOptions)
|
||||
: _gameDescriptors((const byte *)descs), _descItemSize(descItemSize), _gameIds(gameIds),
|
||||
_extraGuiOptions(extraGuiOptions) {
|
||||
AdvancedMetaEngineDetection::AdvancedMetaEngineDetection(const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds)
|
||||
: _gameDescriptors((const byte *)descs), _descItemSize(descItemSize), _gameIds(gameIds) {
|
||||
|
||||
_md5Bytes = 5000;
|
||||
_flags = 0;
|
||||
|
|
|
@ -283,11 +283,6 @@ protected:
|
|||
*/
|
||||
const PlainGameDescriptor *_gameIds;
|
||||
|
||||
/**
|
||||
* A map containing all the extra game GUI options the engine supports.
|
||||
*/
|
||||
const ADExtraGuiOptionsMap * const _extraGuiOptions;
|
||||
|
||||
/**
|
||||
* The number of bytes to compute the MD5 checksum for.
|
||||
*
|
||||
|
@ -343,7 +338,7 @@ public:
|
|||
/**
|
||||
* Initialize game detection using AdvancedMetaEngineDetection.
|
||||
*/
|
||||
AdvancedMetaEngineDetection(const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds, const ADExtraGuiOptionsMap *extraGuiOptions = 0);
|
||||
AdvancedMetaEngineDetection(const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds);
|
||||
|
||||
/**
|
||||
* Return a list of targets supported by the engine.
|
||||
|
@ -370,22 +365,6 @@ public:
|
|||
*/
|
||||
Common::Error createInstance(OSystem *syst, Engine **engine);
|
||||
|
||||
/**
|
||||
* Return a list of extra GUI options for the specified target.
|
||||
*
|
||||
* If no target is specified, all of the available custom GUI options are
|
||||
* returned for the plugin (used to set default values).
|
||||
*
|
||||
* Currently, this only supports options with checkboxes.
|
||||
*
|
||||
* The default implementation returns an empty list.
|
||||
*
|
||||
* @param target Name of a config manager target.
|
||||
*
|
||||
* @return A list of extra GUI options for an engine plugin and target.
|
||||
*/
|
||||
const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const override final;
|
||||
|
||||
static Common::StringArray getPathsFromEntry(const ADGameDescription *g);
|
||||
|
||||
uint getMD5Bytes() const { return _md5Bytes; }
|
||||
|
|
|
@ -132,6 +132,6 @@ bool AGSOptionsWidget::save() {
|
|||
|
||||
} // namespace AGS3
|
||||
|
||||
GUI::OptionsContainerWidget *AGSMetaEngine::buildEngineOptionsWidgetDynamic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
|
||||
GUI::OptionsContainerWidget *AGSMetaEngine::buildEngineOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
|
||||
return new AGS3::AGSOptionsWidget(boss, name, target);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
*/
|
||||
Common::String getSavegameFile(int saveGameIdx, const char *target = nullptr) const override;
|
||||
|
||||
GUI::OptionsContainerWidget *buildEngineOptionsWidgetDynamic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
|
||||
GUI::OptionsContainerWidget *buildEngineOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
|
||||
|
||||
/**
|
||||
* Determine whether the engine supports the specified MetaEngine feature.
|
||||
|
|
|
@ -265,7 +265,6 @@ ConfigDialog::ConfigDialog() :
|
|||
|
||||
const Common::String &gameDomain = ConfMan.getActiveDomainName();
|
||||
const MetaEngine *metaEngine = g_engine->getMetaEngine();
|
||||
const MetaEngineDetection &metaEngineDetection = g_engine->getMetaEngineDetection();
|
||||
|
||||
// GUI: Add tab widget
|
||||
GUI::TabWidget *tab = new GUI::TabWidget(this, "GlobalConfig.TabWidget");
|
||||
|
@ -277,9 +276,7 @@ ConfigDialog::ConfigDialog() :
|
|||
int tabId = tab->addTab(_("Game"), "GlobalConfig_Engine");
|
||||
|
||||
if (g_engine->hasFeature(Engine::kSupportsChangingOptionsDuringRuntime)) {
|
||||
_engineOptions = metaEngine->buildEngineOptionsWidgetDynamic(tab, "GlobalConfig_Engine.Container", gameDomain);
|
||||
if (!_engineOptions)
|
||||
_engineOptions = metaEngineDetection.buildEngineOptionsWidgetStatic(tab, "GlobalConfig_Engine.Container", gameDomain);
|
||||
_engineOptions = metaEngine->buildEngineOptionsWidget(tab, "GlobalConfig_Engine.Container", gameDomain);
|
||||
}
|
||||
|
||||
if (_engineOptions) {
|
||||
|
|
|
@ -395,27 +395,7 @@ void MetaEngine::registerDefaultSettings(const Common::String &) const {
|
|||
}
|
||||
}
|
||||
|
||||
void MetaEngineDetection::registerDefaultSettings(const Common::String &) const {
|
||||
// Note that as we don't pass the target to getExtraGuiOptions
|
||||
// we get all the options, even those not relevant for the current
|
||||
// game. This is necessary because some engines unconditionally
|
||||
// access the configuration.
|
||||
const ExtraGuiOptions engineOptions = getExtraGuiOptions("");
|
||||
for (uint i = 0; i < engineOptions.size(); i++) {
|
||||
ConfMan.registerDefault(engineOptions[i].configOption, engineOptions[i].defaultState);
|
||||
}
|
||||
}
|
||||
|
||||
GUI::OptionsContainerWidget *MetaEngine::buildEngineOptionsWidgetDynamic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
|
||||
const ExtraGuiOptions engineOptions = getExtraGuiOptions(target);
|
||||
if (engineOptions.empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return new GUI::ExtraGuiOptionsWidget(boss, name, target, engineOptions);
|
||||
}
|
||||
|
||||
GUI::OptionsContainerWidget *MetaEngineDetection::buildEngineOptionsWidgetStatic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
|
||||
GUI::OptionsContainerWidget *MetaEngine::buildEngineOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
|
||||
const ExtraGuiOptions engineOptions = getExtraGuiOptions(target);
|
||||
if (engineOptions.empty()) {
|
||||
return nullptr;
|
||||
|
|
|
@ -163,24 +163,6 @@ public:
|
|||
*/
|
||||
virtual DetectedGames detectGames(const Common::FSList &fslist, uint32 skipADFlags = 0, bool skipIncomplete = false) = 0;
|
||||
|
||||
/**
|
||||
* Return a list of extra GUI options for the specified target.
|
||||
*
|
||||
* If no target is specified, all of the available custom GUI options are
|
||||
* returned for the plugin (used to set default values).
|
||||
*
|
||||
* Currently, this only supports options with checkboxes.
|
||||
*
|
||||
* The default implementation returns an empty list.
|
||||
*
|
||||
* @param target Name of a config manager target.
|
||||
*
|
||||
* @return A list of extra GUI options for an engine plugin and target.
|
||||
*/
|
||||
virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const {
|
||||
return ExtraGuiOptions();
|
||||
}
|
||||
|
||||
/**
|
||||
* The default version of this method will just parse the options string from
|
||||
* the config manager. However it also allows the meta engine to post process
|
||||
|
@ -206,30 +188,6 @@ public:
|
|||
virtual const DebugChannelDef *getDebugChannels() const {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the default values for the settings that the engine uses into the
|
||||
* configuration manager.
|
||||
*
|
||||
* @param target Name of a config manager target.
|
||||
*/
|
||||
void registerDefaultSettings(const Common::String &target) const;
|
||||
|
||||
/**
|
||||
* Return a GUI widget container for configuring the specified target options.
|
||||
*
|
||||
* The returned widget is shown in the Engine tab in the Edit Game dialog.
|
||||
* Engines can build custom option dialogs, but by default a simple widget
|
||||
* allowing to configure the extra GUI options is used.
|
||||
*
|
||||
* Engines that are not supposed to have an Engine tab in the Edit Game dialog
|
||||
* can return nullptr.
|
||||
*
|
||||
* @param boss The widget or dialog that the returned widget is a child of.
|
||||
* @param name The name that the returned widget must use.
|
||||
* @param target Name of a config manager target.
|
||||
*/
|
||||
GUI::OptionsContainerWidget *buildEngineOptionsWidgetStatic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -436,7 +394,7 @@ public:
|
|||
* @param name The name that the returned widget must use.
|
||||
* @param target Name of a config manager target.
|
||||
*/
|
||||
virtual GUI::OptionsContainerWidget *buildEngineOptionsWidgetDynamic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const;
|
||||
virtual GUI::OptionsContainerWidget *buildEngineOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const;
|
||||
|
||||
/**
|
||||
* MetaEngine feature flags.
|
||||
|
|
|
@ -140,7 +140,7 @@ public:
|
|||
|
||||
|
||||
void registerDefaultSettings(const Common::String &target) const override;
|
||||
GUI::OptionsContainerWidget *buildEngineOptionsWidgetDynamic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
|
||||
GUI::OptionsContainerWidget *buildEngineOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
|
||||
Common::String getSavegameFile(int saveGameIdx, const char *target) const override {
|
||||
if (!target)
|
||||
target = getName();
|
||||
|
@ -338,7 +338,7 @@ void MohawkMetaEngine::registerDefaultSettings(const Common::String &target) con
|
|||
return MetaEngine::registerDefaultSettings(target);
|
||||
}
|
||||
|
||||
GUI::OptionsContainerWidget *MohawkMetaEngine::buildEngineOptionsWidgetDynamic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
|
||||
GUI::OptionsContainerWidget *MohawkMetaEngine::buildEngineOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
|
||||
Common::String gameId = ConfMan.get("gameid", target);
|
||||
|
||||
#ifdef ENABLE_MYST
|
||||
|
@ -352,7 +352,7 @@ GUI::OptionsContainerWidget *MohawkMetaEngine::buildEngineOptionsWidgetDynamic(G
|
|||
}
|
||||
#endif
|
||||
|
||||
return MetaEngine::buildEngineOptionsWidgetDynamic(boss, name, target);
|
||||
return MetaEngine::buildEngineOptionsWidget(boss, name, target);
|
||||
}
|
||||
|
||||
#if PLUGIN_ENABLED_DYNAMIC(MOHAWK)
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
Common::KeymapArray initKeymaps(const char *target) const override;
|
||||
|
||||
void registerDefaultSettings(const Common::String &target) const override;
|
||||
GUI::OptionsContainerWidget *buildEngineOptionsWidgetDynamic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
|
||||
GUI::OptionsContainerWidget *buildEngineOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
|
||||
};
|
||||
|
||||
Common::KeymapArray NancyMetaEngine::initKeymaps(const char *target) const {
|
||||
|
@ -82,7 +82,7 @@ void NancyMetaEngine::registerDefaultSettings(const Common::String &target) cons
|
|||
ConfMan.setBool("subtitles", true, target);
|
||||
}
|
||||
|
||||
GUI::OptionsContainerWidget *NancyMetaEngine::buildEngineOptionsWidgetDynamic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
|
||||
GUI::OptionsContainerWidget *NancyMetaEngine::buildEngineOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
|
||||
return new Nancy::NancyOptionsWidget(boss, name, target);
|
||||
}
|
||||
|
||||
|
|
|
@ -288,7 +288,7 @@ public:
|
|||
ADDetectedGame fallbackDetectExtern(uint md5Bytes, const FileMap &allFiles, const Common::FSList &fslist, ADDetectedGameExtraInfo **extra) const override;
|
||||
|
||||
void registerDefaultSettings(const Common::String &target) const override;
|
||||
GUI::OptionsContainerWidget *buildEngineOptionsWidgetDynamic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
|
||||
GUI::OptionsContainerWidget *buildEngineOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
|
||||
};
|
||||
|
||||
Common::Error SciMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
|
||||
|
@ -716,7 +716,7 @@ void SciMetaEngine::registerDefaultSettings(const Common::String &target) const
|
|||
ConfMan.registerDefault(entry->configOption, entry->defaultState);
|
||||
}
|
||||
|
||||
GUI::OptionsContainerWidget *SciMetaEngine::buildEngineOptionsWidgetDynamic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
|
||||
GUI::OptionsContainerWidget *SciMetaEngine::buildEngineOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
|
||||
return new OptionsWidget(boss, name, target);
|
||||
}
|
||||
|
||||
|
|
|
@ -556,14 +556,14 @@ SaveStateDescriptor ScummMetaEngine::querySaveMetaInfos(const char *target, int
|
|||
return desc;
|
||||
}
|
||||
|
||||
GUI::OptionsContainerWidget *ScummMetaEngine::buildEngineOptionsWidgetDynamic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
|
||||
GUI::OptionsContainerWidget *ScummMetaEngine::buildEngineOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
|
||||
Common::String gameid = ConfMan.get("gameid", target);
|
||||
Common::String extra = ConfMan.get("extra", target);
|
||||
|
||||
if (gameid == "loom") {
|
||||
Common::Platform platform = Common::parsePlatform(ConfMan.get("platform", target));
|
||||
if (platform != Common::kPlatformUnknown && platform != Common::kPlatformDOS)
|
||||
return MetaEngine::buildEngineOptionsWidgetDynamic(boss, name, target);
|
||||
return MetaEngine::buildEngineOptionsWidget(boss, name, target);
|
||||
|
||||
// The VGA Loom settings are only relevant for the DOS CD
|
||||
// version, not the Steam version (which is assumed to be well
|
||||
|
@ -573,7 +573,7 @@ GUI::OptionsContainerWidget *ScummMetaEngine::buildEngineOptionsWidgetDynamic(GU
|
|||
return new Scumm::LoomVgaGameOptionsWidget(boss, name, target);
|
||||
|
||||
if (extra == "Steam")
|
||||
return MetaEngine::buildEngineOptionsWidgetDynamic(boss, name, target);
|
||||
return MetaEngine::buildEngineOptionsWidget(boss, name, target);
|
||||
|
||||
// These EGA Loom settings are only relevant for the EGA
|
||||
// version, since that is the only one that has an overture.
|
||||
|
@ -581,12 +581,12 @@ GUI::OptionsContainerWidget *ScummMetaEngine::buildEngineOptionsWidgetDynamic(GU
|
|||
return new Scumm::LoomEgaGameOptionsWidget(boss, name, target);
|
||||
} else if (gameid == "monkey") {
|
||||
if (extra != "CD" && extra != "FM-TOWNS" && extra != "SEGA")
|
||||
return MetaEngine::buildEngineOptionsWidgetDynamic(boss, name, target);
|
||||
return MetaEngine::buildEngineOptionsWidget(boss, name, target);
|
||||
|
||||
return new Scumm::MI1CdGameOptionsWidget(boss, name, target);
|
||||
}
|
||||
|
||||
return MetaEngine::buildEngineOptionsWidgetDynamic(boss, name, target);
|
||||
return MetaEngine::buildEngineOptionsWidget(boss, name, target);
|
||||
}
|
||||
|
||||
static const ExtraGuiOption comiObjectLabelsOption = {
|
||||
|
|
|
@ -37,7 +37,7 @@ class ScummMetaEngine : public MetaEngine {
|
|||
SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
|
||||
|
||||
const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const override;
|
||||
GUI::OptionsContainerWidget *buildEngineOptionsWidgetDynamic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
|
||||
GUI::OptionsContainerWidget *buildEngineOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
|
||||
};
|
||||
|
||||
#endif // SCUMM_METAENGINE_H
|
||||
|
|
|
@ -176,15 +176,9 @@ EditGameDialog::EditGameDialog(const Common::String &domain)
|
|||
// 2) The engine's game settings (shown only if the engine implements one or there are custom engine options)
|
||||
//
|
||||
|
||||
if (metaEnginePlugin) {
|
||||
const MetaEngineDetection &metaEngineDetection = metaEnginePlugin->get<MetaEngineDetection>();
|
||||
metaEngineDetection.registerDefaultSettings(_domain);
|
||||
if (enginePlugin) {
|
||||
enginePlugin->get<MetaEngine>().registerDefaultSettings(_domain);
|
||||
_engineOptions = enginePlugin->get<MetaEngine>().buildEngineOptionsWidgetDynamic(tab, "GameOptions_Game.Container", _domain);
|
||||
}
|
||||
if (!_engineOptions)
|
||||
_engineOptions = metaEngineDetection.buildEngineOptionsWidgetStatic(tab, "GameOptions_Game.Container", _domain);
|
||||
if (enginePlugin) {
|
||||
enginePlugin->get<MetaEngine>().registerDefaultSettings(_domain);
|
||||
_engineOptions = enginePlugin->get<MetaEngine>().buildEngineOptionsWidget(tab, "GameOptions_Game.Container", _domain);
|
||||
|
||||
if (_engineOptions) {
|
||||
_engineOptions->setParentDialog(this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue