COMMON: more flexible gui options handling

This allows the meta engines to post process the gui options,
before they get to be used in the GUI. This allows adding or
removing options on a larger scale without having to modify
each detection entry individually. In this case, it is meant to be
used in the SCUMM engine, to allow adding render mode
gui options wothout modifying the tables.
This commit is contained in:
athrxx 2022-09-18 21:16:58 +02:00 committed by Filippos Karapetis
parent bea701bb8c
commit a84336c583
2 changed files with 34 additions and 2 deletions

View file

@ -250,7 +250,15 @@ void OptionsDialog::init() {
_guioptions.clear();
if (ConfMan.hasKey("guioptions", _domain)) {
_guioptionsString = ConfMan.get("guioptions", _domain);
_guioptions = parseGameGUIOptions(_guioptionsString);
const Plugin *plugin = nullptr;
EngineMan.findTarget(_domain, &plugin);
if (plugin) {
const MetaEngineDetection &metaEngineDetection = plugin->get<MetaEngineDetection>();
_guioptions = metaEngineDetection.parseAndCustomizeGuiOptions(_guioptionsString, _domain);
} else {
_guioptions = parseGameGUIOptions(_guioptionsString);
}
}
}
@ -259,7 +267,15 @@ void OptionsDialog::build() {
_guioptions.clear();
if (ConfMan.hasKey("guioptions", _domain)) {
_guioptionsString = ConfMan.get("guioptions", _domain);
_guioptions = parseGameGUIOptions(_guioptionsString);
const Plugin *plugin = nullptr;
EngineMan.findTarget(_domain, &plugin);
if (plugin) {
const MetaEngineDetection &metaEngineDetection = plugin->get<MetaEngineDetection>();
_guioptions = metaEngineDetection.parseAndCustomizeGuiOptions(_guioptionsString, _domain);
} else {
_guioptions = parseGameGUIOptions(_guioptionsString);
}
}
// Control options