diff --git a/base/main.cpp b/base/main.cpp index e2cb980e0c5..af5326dd495 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -298,6 +298,8 @@ static Common::Error runGame(const Plugin *plugin, OSystem &system, const Common keymapper->addGameKeymap(gameKeymaps[i]); } + system.applyBackendSettings(); + // Inform backend that the engine is about to be run system.engineInit(); @@ -353,6 +355,8 @@ static void setupGraphics(OSystem &system) { system.setShader(ConfMan.get("shader").c_str()); system.endGFXTransaction(); + system.applyBackendSettings(); + // When starting up launcher for the first time, the user might have specified // a --gui-theme option, to allow that option to be working, we need to initialize // GUI here. @@ -400,6 +404,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { // Register config manager defaults Base::registerDefaults(); + system.registerDefaultSettings(Common::ConfigManager::kApplicationDomain); // Parse the command line Common::StringMap settings; diff --git a/common/system.h b/common/system.h index e1e55481b42..288697ff1ca 100644 --- a/common/system.h +++ b/common/system.h @@ -40,6 +40,11 @@ namespace Graphics { struct Surface; } +namespace GUI { +class GuiObject; +class OptionsContainerWidget; +} + namespace Common { class EventManager; struct Rect; @@ -1622,6 +1627,36 @@ public: */ virtual Common::String getDefaultConfigFileName(); + /** + * Register the default values for the settings the backend uses into the + * configuration manager. + * + * @param target name of a config manager target + */ + virtual 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 Backend tab in the options dialog. + * Backends can build custom options dialogs. + * + * Backends that don't want to have a Backend tab in the options dialog + * can return nullptr. + * + * @param boss the widget / dialog the returned widget is a child of + * @param name the name the returned widget must use + * @param target name of a config manager target + */ + virtual GUI::OptionsContainerWidget *buildBackendOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const { return nullptr; } + + /** + * Notify the backend that the settings editable from the game tab in the + * options dialog may have changed and that they need to be applied if + * necessary. + */ + virtual void applyBackendSettings() {} + /** * Log the given message. * diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp index ffb89641d85..f332f673efc 100644 --- a/engines/dialogs.cpp +++ b/engines/dialogs.cpp @@ -327,6 +327,19 @@ ConfigDialog::ConfigDialog() : addKeyMapperControls(tab, "GlobalConfig_KeyMapper.", keymaps, gameDomain); } + // + // The backend tab (shown only if the backend implements one) + // + int backendTabId = tab->addTab(_("Backend"), "GlobalConfig_Backend"); + + _backendOptions = g_system->buildBackendOptionsWidget(tab, "GlobalConfig_Backend.Container", _domain); + + if (_backendOptions) { + _backendOptions->setParentDialog(this); + } else { + tab->removeTab(backendTabId); + } + // // The Achievements tab // diff --git a/engines/engine.cpp b/engines/engine.cpp index 197eb64c58a..073dacd0ffa 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -639,6 +639,7 @@ void Engine::openMainMenuDialog() { ttsMan->popState(); #endif + g_system->applyBackendSettings(); applyGameSettings(); syncSoundSettings(); } diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index f7a1d712283..4d534eead14 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -38,7 +38,7 @@ #include "graphics/pixelformat.h" -#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.39" +#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.40" class OSystem; diff --git a/gui/editgamedialog.cpp b/gui/editgamedialog.cpp index ae8cfd82e7b..3974620a500 100644 --- a/gui/editgamedialog.cpp +++ b/gui/editgamedialog.cpp @@ -240,6 +240,20 @@ EditGameDialog::EditGameDialog(const String &domain) addKeyMapperControls(tab, "GameOptions_KeyMapper.", keymaps, domain); } + // + // The backend tab (shown only if the backend implements one) + // + int backendTabId = tab->addTab(_("Backend"), "GameOptions_Backend"); + + g_system->registerDefaultSettings(_domain); + _backendOptions = g_system->buildBackendOptionsWidget(tab, "GameOptions_Backend.Container", _domain); + + if (_backendOptions) { + _backendOptions->setParentDialog(this); + } else { + tab->removeTab(backendTabId); + } + // // 4) The audio tab // diff --git a/gui/options.cpp b/gui/options.cpp index a99927cebf9..f9ba3e5dea2 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -168,6 +168,7 @@ void OptionsDialog::init() { _joystickDeadzoneSlider = nullptr; _joystickDeadzoneLabel = nullptr; _keymapperWidget = nullptr; + _backendOptions = nullptr; _enableGraphicSettings = false; _gfxPopUp = nullptr; _gfxPopUpDesc = nullptr; @@ -285,6 +286,11 @@ void OptionsDialog::build() { _keymapperWidget->load(); } + // Backend options + if (_backendOptions) { + _backendOptions->load(); + } + // Graphic options if (_fullscreenCheckbox) { _gfxPopUp->setSelected(0); @@ -710,6 +716,12 @@ void OptionsDialog::apply() { } } + if (_backendOptions) { + bool changes = _backendOptions->save(); + if (changes && _domain == Common::ConfigManager::kApplicationDomain) + g_system->applyBackendSettings(); + } + // Control options if (_enableControlSettings) { if (g_system->hasFeature(OSystem::kFeatureOnScreenControl)) { @@ -1815,6 +1827,20 @@ void GlobalOptionsDialog::build() { addKeyMapperControls(tab, "GlobalOptions_KeyMapper.", keymaps, Common::ConfigManager::kKeymapperDomain); } + // + // The backend tab (shown only if the backend implements one) + // + int backendTabId = tab->addTab(_("Backend"), "GlobalOptions_Backend"); + + g_system->registerDefaultSettings(_domain); + _backendOptions = g_system->buildBackendOptionsWidget(tab, "GlobalOptions_Backend.Container", _domain); + + if (_backendOptions) { + _backendOptions->setParentDialog(this); + } else { + tab->removeTab(backendTabId); + } + // // 2) The audio tab // diff --git a/gui/options.h b/gui/options.h index 93e5ce625f8..00ba6d8bf92 100644 --- a/gui/options.h +++ b/gui/options.h @@ -59,6 +59,7 @@ class CommandSender; class GuiObject; class RadiobuttonGroup; class RadiobuttonWidget; +class OptionsContainerWidget; class OptionsDialog : public Dialog { public: @@ -246,6 +247,11 @@ protected: // Common::String _guioptions; Common::String _guioptionsString; + + // + // Backend controls + // + OptionsContainerWidget *_backendOptions; }; diff --git a/gui/themes/default.inc b/gui/themes/default.inc index b72ca06dfbb..d1b05045d87 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -1666,6 +1666,11 @@ const char *defaultXML1 = "" "" "" "" +"" +"" +"" +"" +"" "" "" "" @@ -2369,6 +2374,11 @@ const char *defaultXML1 = "" "" "" "" +"" +"" +"" +"" +"" "" "" "" @@ -2689,6 +2699,11 @@ const char *defaultXML1 = "" "" "" "" +"" +"" +"" +"" +"" "" "" "" @@ -3518,6 +3533,11 @@ const char *defaultXML1 = "" "" "" "" +"" +"" +"" +"" +"" "" "" "" @@ -4226,6 +4246,11 @@ const char *defaultXML1 = "" "" "" "" +"" +"" +"" +"" +"" "" "" "" @@ -4555,6 +4580,11 @@ const char *defaultXML1 = "" "" "" "" +"" +"" +"" +"" +"" "" "" "" diff --git a/gui/themes/residualvm.zip b/gui/themes/residualvm.zip index a59b1628936..d59ffad3835 100644 Binary files a/gui/themes/residualvm.zip and b/gui/themes/residualvm.zip differ diff --git a/gui/themes/residualvm/THEMERC b/gui/themes/residualvm/THEMERC index b2ed311fcae..8e12c8b7bfa 100644 --- a/gui/themes/residualvm/THEMERC +++ b/gui/themes/residualvm/THEMERC @@ -1 +1 @@ -[SCUMMVM_STX0.8.39:ResidualVM Modern Theme:No Author] +[SCUMMVM_STX0.8.40:ResidualVM Modern Theme:No Author] diff --git a/gui/themes/residualvm/residualvm_layout.stx b/gui/themes/residualvm/residualvm_layout.stx index 853d635a483..cdc6d771c5e 100644 --- a/gui/themes/residualvm/residualvm_layout.stx +++ b/gui/themes/residualvm/residualvm_layout.stx @@ -309,6 +309,12 @@ + + + + + + @@ -1032,6 +1038,12 @@ + + + + + + @@ -1370,6 +1382,12 @@ + + + + + + diff --git a/gui/themes/residualvm/residualvm_layout_lowres.stx b/gui/themes/residualvm/residualvm_layout_lowres.stx index c90a023cf92..0c04117d8d7 100644 --- a/gui/themes/residualvm/residualvm_layout_lowres.stx +++ b/gui/themes/residualvm/residualvm_layout_lowres.stx @@ -288,6 +288,12 @@ + + + + + + @@ -1017,6 +1023,12 @@ + + + + + + @@ -1364,6 +1376,12 @@ + + + + + + diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip index 41529a85daf..150f71a67bf 100644 Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ diff --git a/gui/themes/scummclassic/THEMERC b/gui/themes/scummclassic/THEMERC index b1be37e2077..de6ecce8cfa 100644 --- a/gui/themes/scummclassic/THEMERC +++ b/gui/themes/scummclassic/THEMERC @@ -1 +1 @@ -[SCUMMVM_STX0.8.39:ScummVM Classic Theme:No Author] +[SCUMMVM_STX0.8.40:ScummVM Classic Theme:No Author] diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index 9fe13917d3f..49ac94da62a 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -293,6 +293,12 @@ + + + + + + @@ -1017,6 +1023,12 @@ + + + + + + @@ -1355,6 +1367,12 @@ + + + + + + diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx index 1f465270d70..33c3cd626a1 100644 --- a/gui/themes/scummclassic/classic_layout_lowres.stx +++ b/gui/themes/scummclassic/classic_layout_lowres.stx @@ -290,6 +290,12 @@ + + + + + + @@ -1018,6 +1024,12 @@ + + + + + + @@ -1364,6 +1376,12 @@ + + + + + + diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip index 8cc40629f8e..b9a79e63d67 100644 Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ diff --git a/gui/themes/scummmodern/THEMERC b/gui/themes/scummmodern/THEMERC index a10ae0fb173..79c0df9bd22 100644 --- a/gui/themes/scummmodern/THEMERC +++ b/gui/themes/scummmodern/THEMERC @@ -1 +1 @@ -[SCUMMVM_STX0.8.39:ScummVM Modern Theme:No Author] +[SCUMMVM_STX0.8.40:ScummVM Modern Theme:No Author] diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index 853d635a483..cdc6d771c5e 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -309,6 +309,12 @@ + + + + + + @@ -1032,6 +1038,12 @@ + + + + + + @@ -1370,6 +1382,12 @@ + + + + + + diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx index c90a023cf92..0c04117d8d7 100644 --- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx +++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx @@ -288,6 +288,12 @@ + + + + + + @@ -1017,6 +1023,12 @@ + + + + + + @@ -1364,6 +1376,12 @@ + + + + + + diff --git a/gui/themes/scummremastered.zip b/gui/themes/scummremastered.zip index 5ce71c156a8..05f47ee7629 100644 Binary files a/gui/themes/scummremastered.zip and b/gui/themes/scummremastered.zip differ diff --git a/gui/themes/scummremastered/THEMERC b/gui/themes/scummremastered/THEMERC index 7ed2d0e627a..acfc5275424 100644 --- a/gui/themes/scummremastered/THEMERC +++ b/gui/themes/scummremastered/THEMERC @@ -1 +1 @@ -[SCUMMVM_STX0.8.39:ScummVM Modern Theme Remastered:No Author] +[SCUMMVM_STX0.8.40:ScummVM Modern Theme Remastered:No Author] diff --git a/gui/themes/scummremastered/remastered_layout.stx b/gui/themes/scummremastered/remastered_layout.stx index 853d635a483..cdc6d771c5e 100644 --- a/gui/themes/scummremastered/remastered_layout.stx +++ b/gui/themes/scummremastered/remastered_layout.stx @@ -309,6 +309,12 @@ + + + + + + @@ -1032,6 +1038,12 @@ + + + + + + @@ -1370,6 +1382,12 @@ + + + + + + diff --git a/gui/themes/scummremastered/remastered_layout_lowres.stx b/gui/themes/scummremastered/remastered_layout_lowres.stx index c90a023cf92..0c04117d8d7 100644 --- a/gui/themes/scummremastered/remastered_layout_lowres.stx +++ b/gui/themes/scummremastered/remastered_layout_lowres.stx @@ -288,6 +288,12 @@ + + + + + + @@ -1017,6 +1023,12 @@ + + + + + + @@ -1364,6 +1376,12 @@ + + + + + +