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:
parent
bea701bb8c
commit
a84336c583
2 changed files with 34 additions and 2 deletions
|
@ -26,6 +26,7 @@
|
|||
#include "common/scummsys.h"
|
||||
#include "common/error.h"
|
||||
#include "common/array.h"
|
||||
#include "common/gui_options.h"
|
||||
|
||||
#include "engines/game.h"
|
||||
#include "engines/savestate.h"
|
||||
|
@ -180,6 +181,21 @@ public:
|
|||
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
|
||||
* result and add/remove other options as needed.
|
||||
*
|
||||
* @param optionsString Options string that from the config manager.
|
||||
* @param domain Domain of the current target.
|
||||
*
|
||||
* @return The fully processed options string that is usable by the GUI.
|
||||
*
|
||||
*/
|
||||
virtual Common::String parseAndCustomizeGuiOptions(const Common::String &optionsString, const Common::String &domain) const {
|
||||
return parseGameGUIOptions(optionsString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of engine specified debug channels
|
||||
*
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue