[Scummvm-git-logs] scummvm master -> b246dbdfb6ca0b213925021d2811550519df3924

criezy criezy at scummvm.org
Sun Nov 22 16:35:19 UTC 2020


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c80e1c6b49 NULL: Fix compilation without GNU C extensions
11724f9df1 GUI: Add a tab for backend-specific options
b246dbdfb6 ANDROID: Add a backend-specific options widget


Commit: c80e1c6b49db2bdac85e7b74851b2a7206f107d8
    https://github.com/scummvm/scummvm/commit/c80e1c6b49db2bdac85e7b74851b2a7206f107d8
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-11-22T16:35:03Z

Commit Message:
NULL: Fix compilation without GNU C extensions

Changed paths:
    backends/platform/null/null.cpp


diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp
index 9bfc4c8e54..2dd11c68fa 100644
--- a/backends/platform/null/null.cpp
+++ b/backends/platform/null/null.cpp
@@ -25,6 +25,10 @@
 #include <sys/time.h>
 #include <unistd.h>
 #include <signal.h>
+// sighandler_t is a GNU extension exposed when _GNU_SOURCE is defined
+#ifndef _GNU_SOURCE
+typedef void (*sighandler_t)(int);
+#endif
 #elif defined(WIN32)
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>


Commit: 11724f9df12ff0134cf47832f7278d75327988a0
    https://github.com/scummvm/scummvm/commit/11724f9df12ff0134cf47832f7278d75327988a0
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2020-11-22T16:35:03Z

Commit Message:
GUI: Add a tab for backend-specific options

Changed paths:
    base/main.cpp
    common/system.h
    engines/dialogs.cpp
    engines/engine.cpp
    gui/ThemeEngine.h
    gui/editgamedialog.cpp
    gui/options.cpp
    gui/options.h
    gui/themes/default.inc
    gui/themes/residualvm.zip
    gui/themes/residualvm/THEMERC
    gui/themes/residualvm/residualvm_layout.stx
    gui/themes/residualvm/residualvm_layout_lowres.stx
    gui/themes/scummclassic.zip
    gui/themes/scummclassic/THEMERC
    gui/themes/scummclassic/classic_layout.stx
    gui/themes/scummclassic/classic_layout_lowres.stx
    gui/themes/scummmodern.zip
    gui/themes/scummmodern/THEMERC
    gui/themes/scummmodern/scummmodern_layout.stx
    gui/themes/scummmodern/scummmodern_layout_lowres.stx
    gui/themes/scummremastered.zip
    gui/themes/scummremastered/THEMERC
    gui/themes/scummremastered/remastered_layout.stx
    gui/themes/scummremastered/remastered_layout_lowres.stx


diff --git a/base/main.cpp b/base/main.cpp
index e2cb980e0c..af5326dd49 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 e1e55481b4..288697ff1c 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 ffb89641d8..f332f673ef 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 197eb64c58..073dacd0ff 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 f7a1d71228..4d534eead1 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 ae8cfd82e7..3974620a50 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 a99927cebf..f9ba3e5dea 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 93e5ce625f..00ba6d8bf9 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 b72ca06dfb..d1b05045d8 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -1666,6 +1666,11 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<widget name='Container'/>"
 "</layout>"
 "</dialog>"
+"<dialog name='GlobalOptions_Backend' overlays='Dialog.GlobalOptions.TabWidget'>"
+"<layout type='vertical' padding='0,0,0,0'>"
+"<widget name='Container'/>"
+"</layout>"
+"</dialog>"
 "<dialog name='GlobalOptions_Graphics' overlays='Dialog.GlobalOptions.TabWidget'>"
 "<layout type='vertical' padding='0,0,0,0'>"
 "<widget name='Container'/>"
@@ -2369,6 +2374,11 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<widget name='Container'/>"
 "</layout>"
 "</dialog>"
+"<dialog name='GameOptions_Backend' overlays='Dialog.GameOptions.TabWidget'>"
+"<layout type='vertical' padding='0,0,0,0'>"
+"<widget name='Container'/>"
+"</layout>"
+"</dialog>"
 "<dialog name='GameOptions_Achievements' overlays='Dialog.GameOptions.TabWidget'>"
 "<layout type='vertical' padding='0,0,0,0'>"
 "<widget name='Container'/>"
@@ -2689,6 +2699,11 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<widget name='Container'/>"
 "</layout>"
 "</dialog>"
+"<dialog name='GlobalConfig_Backend' overlays='Dialog.GlobalConfig.TabWidget'>"
+"<layout type='vertical' padding='0,0,0,0'>"
+"<widget name='Container'/>"
+"</layout>"
+"</dialog>"
 "<dialog name='GlobalConfig_Achievements' overlays='Dialog.GlobalConfig.TabWidget'>"
 "<layout type='vertical' padding='0,0,0,0'>"
 "<widget name='Container'/>"
@@ -3518,6 +3533,11 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<widget name='Container'/>"
 "</layout>"
 "</dialog>"
+"<dialog name='GlobalOptions_Backend' overlays='Dialog.GlobalOptions.TabWidget'>"
+"<layout type='vertical' padding='0,0,0,0'>"
+"<widget name='Container'/>"
+"</layout>"
+"</dialog>"
 "<dialog name='GlobalOptions_Graphics' overlays='Dialog.GlobalOptions.TabWidget'>"
 "<layout type='vertical' padding='0,0,0,0'>"
 "<widget name='Container'/>"
@@ -4226,6 +4246,11 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<widget name='Container'/>"
 "</layout>"
 "</dialog>"
+"<dialog name='GameOptions_Backend' overlays='Dialog.GameOptions.TabWidget'>"
+"<layout type='vertical' padding='0,0,0,0'>"
+"<widget name='Container'/>"
+"</layout>"
+"</dialog>"
 "<dialog name='GameOptions_Achievements' overlays='Dialog.GameOptions.TabWidget'>"
 "<layout type='vertical' padding='0,0,0,0'>"
 "<widget name='Container'/>"
@@ -4555,6 +4580,11 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<widget name='Container'/>"
 "</layout>"
 "</dialog>"
+"<dialog name='GlobalConfig_Backend' overlays='Dialog.GlobalConfig.TabWidget'>"
+"<layout type='vertical' padding='0,0,0,0'>"
+"<widget name='Container'/>"
+"</layout>"
+"</dialog>"
 "<dialog name='GlobalConfig_Achievements' overlays='Dialog.GlobalConfig.TabWidget'>"
 "<layout type='vertical' padding='0,0,0,0'>"
 "<widget name='Container'/>"
diff --git a/gui/themes/residualvm.zip b/gui/themes/residualvm.zip
index a59b162893..d59ffad383 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 b2ed311fca..8e12c8b7bf 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 853d635a48..cdc6d771c5 100644
--- a/gui/themes/residualvm/residualvm_layout.stx
+++ b/gui/themes/residualvm/residualvm_layout.stx
@@ -309,6 +309,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GlobalOptions_Backend' overlays = 'Dialog.GlobalOptions.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GlobalOptions_Graphics' overlays = 'Dialog.GlobalOptions.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
@@ -1032,6 +1038,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GameOptions_Backend' overlays = 'Dialog.GameOptions.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GameOptions_Achievements' overlays = 'Dialog.GameOptions.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
@@ -1370,6 +1382,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GlobalConfig_Backend' overlays = 'Dialog.GlobalConfig.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GlobalConfig_Achievements' overlays = 'Dialog.GlobalConfig.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
diff --git a/gui/themes/residualvm/residualvm_layout_lowres.stx b/gui/themes/residualvm/residualvm_layout_lowres.stx
index c90a023cf9..0c04117d8d 100644
--- a/gui/themes/residualvm/residualvm_layout_lowres.stx
+++ b/gui/themes/residualvm/residualvm_layout_lowres.stx
@@ -288,6 +288,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GlobalOptions_Backend' overlays = 'Dialog.GlobalOptions.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GlobalOptions_Graphics' overlays = 'Dialog.GlobalOptions.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
@@ -1017,6 +1023,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GameOptions_Backend' overlays = 'Dialog.GameOptions.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GameOptions_Achievements' overlays = 'Dialog.GameOptions.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
@@ -1364,6 +1376,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GlobalConfig_Backend' overlays = 'Dialog.GlobalConfig.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GlobalConfig_Achievements' overlays = 'Dialog.GlobalConfig.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index 41529a85da..150f71a67b 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 b1be37e207..de6ecce8cf 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 9fe13917d3..49ac94da62 100644
--- a/gui/themes/scummclassic/classic_layout.stx
+++ b/gui/themes/scummclassic/classic_layout.stx
@@ -293,6 +293,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GlobalOptions_Backend' overlays = 'Dialog.GlobalOptions.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GlobalOptions_Graphics' overlays = 'Dialog.GlobalOptions.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
@@ -1017,6 +1023,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GameOptions_Backend' overlays = 'Dialog.GameOptions.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GameOptions_Achievements' overlays = 'Dialog.GameOptions.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
@@ -1355,6 +1367,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GlobalConfig_Backend' overlays = 'Dialog.GlobalConfig.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GlobalConfig_Achievements' overlays = 'Dialog.GlobalConfig.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx
index 1f465270d7..33c3cd626a 100644
--- a/gui/themes/scummclassic/classic_layout_lowres.stx
+++ b/gui/themes/scummclassic/classic_layout_lowres.stx
@@ -290,6 +290,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GlobalOptions_Backend' overlays = 'Dialog.GlobalOptions.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GlobalOptions_Graphics' overlays = 'Dialog.GlobalOptions.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
@@ -1018,6 +1024,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GameOptions_Backend' overlays = 'Dialog.GameOptions.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GameOptions_Achievements' overlays = 'Dialog.GameOptions.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
@@ -1364,6 +1376,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GlobalConfig_Backend' overlays = 'Dialog.GlobalConfig.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GlobalConfig_Achievements' overlays = 'Dialog.GlobalConfig.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index 8cc40629f8..b9a79e63d6 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 a10ae0fb17..79c0df9bd2 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 853d635a48..cdc6d771c5 100644
--- a/gui/themes/scummmodern/scummmodern_layout.stx
+++ b/gui/themes/scummmodern/scummmodern_layout.stx
@@ -309,6 +309,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GlobalOptions_Backend' overlays = 'Dialog.GlobalOptions.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GlobalOptions_Graphics' overlays = 'Dialog.GlobalOptions.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
@@ -1032,6 +1038,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GameOptions_Backend' overlays = 'Dialog.GameOptions.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GameOptions_Achievements' overlays = 'Dialog.GameOptions.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
@@ -1370,6 +1382,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GlobalConfig_Backend' overlays = 'Dialog.GlobalConfig.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GlobalConfig_Achievements' overlays = 'Dialog.GlobalConfig.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
index c90a023cf9..0c04117d8d 100644
--- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx
+++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
@@ -288,6 +288,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GlobalOptions_Backend' overlays = 'Dialog.GlobalOptions.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GlobalOptions_Graphics' overlays = 'Dialog.GlobalOptions.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
@@ -1017,6 +1023,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GameOptions_Backend' overlays = 'Dialog.GameOptions.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GameOptions_Achievements' overlays = 'Dialog.GameOptions.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
@@ -1364,6 +1376,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GlobalConfig_Backend' overlays = 'Dialog.GlobalConfig.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GlobalConfig_Achievements' overlays = 'Dialog.GlobalConfig.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
diff --git a/gui/themes/scummremastered.zip b/gui/themes/scummremastered.zip
index 5ce71c156a..05f47ee762 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 7ed2d0e627..acfc527542 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 853d635a48..cdc6d771c5 100644
--- a/gui/themes/scummremastered/remastered_layout.stx
+++ b/gui/themes/scummremastered/remastered_layout.stx
@@ -309,6 +309,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GlobalOptions_Backend' overlays = 'Dialog.GlobalOptions.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GlobalOptions_Graphics' overlays = 'Dialog.GlobalOptions.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
@@ -1032,6 +1038,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GameOptions_Backend' overlays = 'Dialog.GameOptions.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GameOptions_Achievements' overlays = 'Dialog.GameOptions.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
@@ -1370,6 +1382,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GlobalConfig_Backend' overlays = 'Dialog.GlobalConfig.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GlobalConfig_Achievements' overlays = 'Dialog.GlobalConfig.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
diff --git a/gui/themes/scummremastered/remastered_layout_lowres.stx b/gui/themes/scummremastered/remastered_layout_lowres.stx
index c90a023cf9..0c04117d8d 100644
--- a/gui/themes/scummremastered/remastered_layout_lowres.stx
+++ b/gui/themes/scummremastered/remastered_layout_lowres.stx
@@ -288,6 +288,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GlobalOptions_Backend' overlays = 'Dialog.GlobalOptions.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GlobalOptions_Graphics' overlays = 'Dialog.GlobalOptions.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
@@ -1017,6 +1023,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GameOptions_Backend' overlays = 'Dialog.GameOptions.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GameOptions_Achievements' overlays = 'Dialog.GameOptions.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>
@@ -1364,6 +1376,12 @@
 		</layout>
 	</dialog>
 
+	<dialog name = 'GlobalConfig_Backend' overlays = 'Dialog.GlobalConfig.TabWidget'>
+		<layout type = 'vertical' padding = '0, 0, 0, 0'>
+			<widget name = 'Container'/>
+		</layout>
+	</dialog>
+
 	<dialog name = 'GlobalConfig_Achievements' overlays = 'Dialog.GlobalConfig.TabWidget'>
 		<layout type = 'vertical' padding = '0, 0, 0, 0'>
 			<widget name = 'Container'/>


Commit: b246dbdfb6ca0b213925021d2811550519df3924
    https://github.com/scummvm/scummvm/commit/b246dbdfb6ca0b213925021d2811550519df3924
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2020-11-22T16:35:03Z

Commit Message:
ANDROID: Add a backend-specific options widget

Changed paths:
  A backends/platform/android/options.cpp
    backends/platform/android/android.cpp
    backends/platform/android/android.h
    backends/platform/android/module.mk


diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 4f732eacfb..953af09226 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -343,8 +343,6 @@ void OSystem_Android::initBackend() {
 	ConfMan.registerDefault("fullscreen", true);
 	ConfMan.registerDefault("aspect_ratio", true);
 	ConfMan.registerDefault("filtering", false);
-	ConfMan.registerDefault("touchpad_mouse_mode", true);
-	ConfMan.registerDefault("onscreen_control", true);
 	ConfMan.registerDefault("autosave_period", 0);
 
 	// explicitly set this, since fullscreen cannot be changed from GUI
@@ -370,16 +368,6 @@ void OSystem_Android::initBackend() {
 	//       is the one returned by getDefaultStretchMode() (backends/graphics/opengl-graphics.cpp)
 	//       which currently is STRETCH_FIT
 
-	if (!ConfMan.hasKey("touchpad_mouse_mode")) {
-		ConfMan.setBool("touchpad_mouse_mode", true);
-	}
-	_touchpad_mode = ConfMan.getBool("touchpad_mouse_mode");
-
-	if (!ConfMan.hasKey("onscreen_control")) {
-		ConfMan.setBool("onscreen_control", true);
-	}
-	JNI::showKeyboardControl(ConfMan.getBool("onscreen_control"));
-
 	if (!ConfMan.hasKey("autosave_period")) {
 		ConfMan.setInt("autosave_period", 0);
 	}
@@ -456,8 +444,6 @@ bool OSystem_Android::hasFeature(Feature f) {
 		return false;
 	if (f == kFeatureVirtualKeyboard ||
 			f == kFeatureOpenUrl ||
-			f == kFeatureTouchpadMode ||
-			f == kFeatureOnScreenControl ||
 			f == kFeatureClipboardSupport) {
 		return true;
 	}
@@ -472,14 +458,6 @@ void OSystem_Android::setFeatureState(Feature f, bool enable) {
 		_virtkeybd_on = enable;
 		JNI::showVirtualKeyboard(enable);
 		break;
-	case kFeatureTouchpadMode:
-		ConfMan.setBool("touchpad_mouse_mode", enable);
-		_touchpad_mode = enable;
-		break;
-	case kFeatureOnScreenControl:
-		ConfMan.setBool("onscreen_control", enable);
-		JNI::showKeyboardControl(enable);
-		break;
 	default:
 		ModularGraphicsBackend::setFeatureState(f, enable);
 		break;
@@ -490,10 +468,6 @@ bool OSystem_Android::getFeatureState(Feature f) {
 	switch (f) {
 	case kFeatureVirtualKeyboard:
 		return _virtkeybd_on;
-	case kFeatureTouchpadMode:
-		return ConfMan.getBool("touchpad_mouse_mode");
-	case kFeatureOnScreenControl:
-		return ConfMan.getBool("onscreen_control");
 	default:
 		return ModularGraphicsBackend::getFeatureState(f);
 	}
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index 61d6474144..2bf4f042ec 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -119,6 +119,10 @@ public:
 	virtual Common::KeymapArray getGlobalKeymaps() override;
 	virtual Common::KeymapperDefaultBindings *getKeymapperDefaultBindings() override;
 
+	virtual void registerDefaultSettings(const Common::String &target) const override;
+	virtual GUI::OptionsContainerWidget *buildBackendOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
+	virtual void applyBackendSettings() override;
+
 	virtual uint32 getMillis(bool skipRecord = false) override;
 	virtual void delayMillis(uint msecs) override;
 
diff --git a/backends/platform/android/module.mk b/backends/platform/android/module.mk
index d8cf64756c..1f7164d0d1 100644
--- a/backends/platform/android/module.mk
+++ b/backends/platform/android/module.mk
@@ -6,6 +6,7 @@ MODULE_OBJS := \
 	android.o \
 	graphics.o \
 	events.o \
+	options.o \
 	snprintf.o
 
 # We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
diff --git a/backends/platform/android/options.cpp b/backends/platform/android/options.cpp
new file mode 100644
index 0000000000..315335b9da
--- /dev/null
+++ b/backends/platform/android/options.cpp
@@ -0,0 +1,111 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+// Allow use of stuff in <time.h>
+#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
+
+// Disable printf override in common/forbidden.h to avoid
+// clashes with log.h from the Android SDK.
+// That header file uses
+//   __attribute__ ((format(printf, 3, 4)))
+// which gets messed up by our override mechanism; this could
+// be avoided by either changing the Android SDK to use the equally
+// legal and valid
+//   __attribute__ ((format(printf, 3, 4)))
+// or by refining our printf override to use a varadic macro
+// (which then wouldn't be portable, though).
+// Anyway, for now we just disable the printf override globally
+// for the Android port
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+
+#include "backends/platform/android/android.h"
+#include "backends/platform/android/jni-android.h"
+
+#include "gui/ThemeEval.h"
+#include "gui/widget.h"
+
+#include "common/translation.h"
+
+class AndroidOptionsWidget final : public GUI::OptionsContainerWidget {
+public:
+	explicit AndroidOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain);
+	~AndroidOptionsWidget() override;
+
+	// OptionsContainerWidget API
+	void load() override;
+	bool save() override;
+
+private:
+	// OptionsContainerWidget API
+	void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
+
+	GUI::CheckboxWidget *_onscreenCheckbox;
+	GUI::CheckboxWidget *_touchpadCheckbox;
+};
+
+AndroidOptionsWidget::AndroidOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain) :
+		OptionsContainerWidget(boss, name, "AndroidOptionsDialog", false, domain) {
+
+	_onscreenCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "AndroidOptionsDialog.OnScreenControl", _("Show On-screen control"));
+	_touchpadCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "AndroidOptionsDialog.TouchpadMode", _("Touchpad mouse mode"));
+}
+
+AndroidOptionsWidget::~AndroidOptionsWidget() {
+}
+
+void AndroidOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const {
+	layouts.addDialog(layoutName, overlayedLayout)
+	        .addLayout(GUI::ThemeLayout::kLayoutVertical)
+	            .addPadding(16, 16, 16, 16)
+	            .addWidget("OnScreenControl", "Checkbox")
+	            .addWidget("TouchpadMode", "Checkbox")
+	        .closeLayout()
+	    .closeDialog();
+}
+
+void AndroidOptionsWidget::load() {
+	_onscreenCheckbox->setState(ConfMan.getBool("onscreen_control", _domain));
+	_touchpadCheckbox->setState(ConfMan.getBool("touchpad_mouse_mode", _domain));
+}
+
+bool AndroidOptionsWidget::save() {
+	ConfMan.setBool("onscreen_control", _onscreenCheckbox->getState(), _domain);
+	ConfMan.setBool("touchpad_mouse_mode", _touchpadCheckbox->getState(), _domain);
+
+	return true;
+}
+
+
+
+GUI::OptionsContainerWidget *OSystem_Android::buildBackendOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
+	return new AndroidOptionsWidget(boss, name, target);
+}
+
+void OSystem_Android::registerDefaultSettings(const Common::String &target) const {
+	ConfMan.registerDefault("onscreen_control", true);
+	ConfMan.registerDefault("touchpad_mouse_mode", true);
+}
+
+void OSystem_Android::applyBackendSettings() {
+	JNI::showKeyboardControl(ConfMan.getBool("onscreen_control"));
+	_touchpad_mode = ConfMan.getBool("touchpad_mouse_mode");
+}




More information about the Scummvm-git-logs mailing list