[Scummvm-git-logs] scummvm master -> 5ce451f7c46a7da0481ff30d89778130418e5b99

sev- noreply at scummvm.org
Fri Nov 17 19:28:44 UTC 2023


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

Summary:
c8d2c4dad1 GUI: Fix filenames for dumped dialogs
43733cbcf3 GUI: Add system to automatically iterate through all resolutions
97a9ed6e8d OPENGLSDL: add way to force update the window to required resolution
5ce451f7c4 GUI: Remove unnecesary parameters and increase code readabilty in dialog dumper


Commit: c8d2c4dad15d09e5ccd397606d083c31992c0c9c
    https://github.com/scummvm/scummvm/commit/c8d2c4dad15d09e5ccd397606d083c31992c0c9c
Author: Rana prathap (fusionbomb2004 at gmail.com)
Date: 2023-11-17T20:28:39+01:00

Commit Message:
GUI: Fix filenames for dumped dialogs

Changed paths:
    base/main.cpp
    gui/dump-all-dialogs.cpp


diff --git a/base/main.cpp b/base/main.cpp
index 563057628b6..ecd223b4d47 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -710,9 +710,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
 	CloudMan.syncSaves();
 #endif
 
-#if 0
 	GUI::dumpAllDialogs();
-#endif
 
 // Print out CPU extension info
 // Separate block to keep the stack clean
diff --git a/gui/dump-all-dialogs.cpp b/gui/dump-all-dialogs.cpp
index 9aa496c7342..82c1db34a24 100644
--- a/gui/dump-all-dialogs.cpp
+++ b/gui/dump-all-dialogs.cpp
@@ -92,50 +92,50 @@ void dumpDialogs(const Common::String &message, int res, const Common::String &l
 
 	// MessageDialog
 	GUI::MessageDialog messageDialog(message);
-	handleSimpleDialog(messageDialog, "messageDialog-", surf);
+	handleSimpleDialog(messageDialog, "messageDialog-" + filename, surf);
 	// AboutDialog
 	GUI::AboutDialog aboutDialog;
-	handleSimpleDialog(aboutDialog, "aboutDialog-", surf);
+	handleSimpleDialog(aboutDialog, "aboutDialog-" + filename, surf);
 
 #if defined(USE_CLOUD) && defined(USE_LIBCURL)
 	// CloudConnectingWizard
 	GUI::CloudConnectionWizard cloudConnectingWizard;
-	handleSimpleDialog(cloudConnectingWizard, "cloudConnectingWizard-", surf);
+	handleSimpleDialog(cloudConnectingWizard, "cloudConnectingWizard-" + filename, surf);
 
 	// RemoteBrowserDialog
 	GUI::RemoteBrowserDialog remoteBrowserDialog(_("Select directory with game data"));
-	handleSimpleDialog(remoteBrowserDialog, "remoteBrowserDialog-", surf);
+	handleSimpleDialog(remoteBrowserDialog, "remoteBrowserDialog-" + filename, surf);
 
 	// DownloadIconPacksDialog
 	GUI::DownloadPacksDialog downloadIconPacksDialog(_("icon packs"), "LIST", "gui-icons*.dat");
-	handleSimpleDialog(downloadIconPacksDialog, "downloadIconPacksDialog-", surf);
+	handleSimpleDialog(downloadIconPacksDialog, "downloadIconPacksDialog-" + filename, surf);
 
 	// DownloadShaderPacksDialog
 	GUI::DownloadPacksDialog downloadShaderPacksDialog(_("shader packs"), "LIST-SHADERS", "shaders*.dat");
-	handleSimpleDialog(downloadShaderPacksDialog, "downloadShaderPacksDialog-", surf);
+	handleSimpleDialog(downloadShaderPacksDialog, "downloadShaderPacksDialog-" + filename, surf);
 #endif
 
 #ifdef USE_FLUIDSYNTH
 	// FluidSynthSettingsDialog
 	GUI::FluidSynthSettingsDialog fluidSynthSettingsDialog;
-	handleSimpleDialog(fluidSynthSettingsDialog, "fluidSynthSettings-", surf);
+	handleSimpleDialog(fluidSynthSettingsDialog, "fluidSynthSettings-" + filename, surf);
 #endif
 
 	// ThemeBrowserDialog
 	GUI::ThemeBrowser themeBrowser;
-	handleSimpleDialog(themeBrowser, "themeBrowser-", surf);
+	handleSimpleDialog(themeBrowser, "themeBrowser-" + filename, surf);
 
 	// BrowserDialog
 	GUI::BrowserDialog browserDialog(_("Select directory with game data"), true);
-	handleSimpleDialog(browserDialog, "browserDialog-", surf);
+	handleSimpleDialog(browserDialog, "browserDialog-" + filename, surf);
 
 	// ChooserDialog
 	GUI::ChooserDialog chooserDialog(_("Pick the game:"));
-	handleSimpleDialog(chooserDialog, "chooserDialog-", surf);
+	handleSimpleDialog(chooserDialog, "chooserDialog-" + filename, surf);
 
 	// MassAddDialog
 	GUI::MassAddDialog massAddDialog(Common::FSNode("."));
-	handleSimpleDialog(massAddDialog, "massAddDialog-", surf);
+	handleSimpleDialog(massAddDialog, "massAddDialog-" + filename, surf);
 
 	// LauncherDialog
 #if 0


Commit: 43733cbcf3938f12a3642279a39b77f7eea948e0
    https://github.com/scummvm/scummvm/commit/43733cbcf3938f12a3642279a39b77f7eea948e0
Author: Rana prathap (fusionbomb2004 at gmail.com)
Date: 2023-11-17T20:28:39+01:00

Commit Message:
GUI: Add system to automatically iterate through all resolutions

Changed paths:
    gui/dump-all-dialogs.cpp


diff --git a/gui/dump-all-dialogs.cpp b/gui/dump-all-dialogs.cpp
index 82c1db34a24..7ee57aa7e1d 100644
--- a/gui/dump-all-dialogs.cpp
+++ b/gui/dump-all-dialogs.cpp
@@ -70,23 +70,16 @@ void handleSimpleDialog(GUI::Dialog &dialog, const Common::String &filename,Grap
 	dialog.close();
 }
 
-void dumpDialogs(const Common::String &message, int res, const Common::String &lang) {
+void dumpDialogs(const Common::String &message, int width, int height, const Common::String &lang) {
 #ifdef USE_TRANSLATION
 	// Update GUI language
 	TransMan.setLanguage(lang);
 #endif
 
-	// Update resolution
-	ConfMan.setInt("last_window_width", res, Common::ConfigManager::kApplicationDomain);
-	ConfMan.setInt("last_window_height", 600, Common::ConfigManager::kApplicationDomain);
-	g_system->beginGFXTransaction();
-		g_system->initSize(res, 600);
-	g_system->endGFXTransaction();
-
 	Graphics::Surface surf;
 	surf.create(g_system->getOverlayWidth(), g_system->getOverlayHeight(), g_system->getOverlayFormat());
 
-	Common::String filename = Common::String::format("%d-%s.png", res, lang.c_str());
+	Common::String filename = Common::String::format("%d-%d-%s.png", width, height, lang.c_str());
 
 	// Skipping Tooltips as not required
 
@@ -155,17 +148,37 @@ void dumpAllDialogs(const Common::String &message) {
 	int original_window_width = ConfMan.getInt("last_window_width", Common::ConfigManager::kApplicationDomain);
 	int original_window_height = ConfMan.getInt("last_window_height", Common::ConfigManager::kApplicationDomain);
 	Common::List<Common::String> list = Common::getLanguageList();
-
+	const int res[] = {320, 200,
+					   320, 240,
+					   640, 400,
+					   640, 480,
+					   800, 600,
+					   0};
+
+	ConfMan.setBool("force_resize", true, Common::ConfigManager::kApplicationDomain);
 	Common::FSNode dumpDir("snapshots");
+
 	if (!dumpDir.isDirectory())
 		dumpDir.createDirectory();
 
-	// Iterate through all languages available
-	for (Common::String lang : list) {
-		// Iterating through the resolutions doesn't work so you have to manually change it here.
-		// TODO: Find a way to iterate through the resolutions using code.
-		Common::Array<int> res_to_test = {800, 640, 320};
-		dumpDialogs(message, res_to_test[0], lang);
+	// Iterate through all resolutions available
+	for (const int *r = res; *r; r += 2) {
+		int w = r[0];
+		int h = r[1];
+
+		// Update resolution
+		ConfMan.setInt("last_window_width", w, Common::ConfigManager::kApplicationDomain);
+		ConfMan.setInt("last_window_height", h, Common::ConfigManager::kApplicationDomain);
+		g_system->beginGFXTransaction();
+			g_system->initSize(w, h);
+		g_system->endGFXTransaction();
+
+		// Iterate through all langauges
+		for (Common::String lang : list) {
+
+			dumpDialogs(message, w, h, lang);
+		}
+
 	}
 
 #ifdef USE_TRANSLATION
@@ -177,6 +190,7 @@ void dumpAllDialogs(const Common::String &message) {
 	g_system->beginGFXTransaction();
 		g_system->initSize(original_window_width, original_window_height);
 	g_system->endGFXTransaction();
+	ConfMan.removeKey("force_resize", Common::ConfigManager::kApplicationDomain);
 }
 
 } // End of namespace GUI


Commit: 97a9ed6e8d1bf34740ed245d62fcc8edd65ac891
    https://github.com/scummvm/scummvm/commit/97a9ed6e8d1bf34740ed245d62fcc8edd65ac891
Author: Rana prathap (fusionbomb2004 at gmail.com)
Date: 2023-11-17T20:28:39+01:00

Commit Message:
OPENGLSDL: add way to force update the window to required resolution

Changed paths:
    backends/graphics/openglsdl/openglsdl-graphics.cpp
    base/main.cpp


diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index bebd7b9ff21..b5a78517608 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -279,6 +279,10 @@ void OpenGLSdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFor
 		_graphicsScale = 2;
 	}
 
+	if (ConfMan.getBool("force_resize", Common::ConfigManager::kApplicationDomain)) {
+		notifyResize(w, h);
+	}
+
 	return OpenGLGraphicsManager::initSize(w, h, format);
 }
 
@@ -306,8 +310,18 @@ void OpenGLSdlGraphicsManager::notifyResize(const int width, const int height) {
 	int currentWidth, currentHeight;
 	getWindowSizeFromSdl(&currentWidth, &currentHeight);
 	float dpiScale = _window->getSdlDpiScalingFactor();
+
+	if (ConfMan.getBool("force_resize", Common::ConfigManager::kApplicationDomain)) {
+		currentWidth = width;
+		currentHeight = height;
+	}
+	
 	debug(3, "req: %d x %d  cur: %d x %d, scale: %f", width, height, currentWidth, currentHeight, dpiScale);
 
+	if (ConfMan.getBool("force_resize", Common::ConfigManager::kApplicationDomain)) {
+		createOrUpdateWindow(currentWidth, currentHeight, 0);
+	}
+
 	handleResize(currentWidth, currentHeight);
 
 	// Remember window size in windowed mode
diff --git a/base/main.cpp b/base/main.cpp
index ecd223b4d47..563057628b6 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -710,7 +710,9 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
 	CloudMan.syncSaves();
 #endif
 
+#if 0
 	GUI::dumpAllDialogs();
+#endif
 
 // Print out CPU extension info
 // Separate block to keep the stack clean


Commit: 5ce451f7c46a7da0481ff30d89778130418e5b99
    https://github.com/scummvm/scummvm/commit/5ce451f7c46a7da0481ff30d89778130418e5b99
Author: Rana prathap (fusionbomb2004 at gmail.com)
Date: 2023-11-17T20:28:39+01:00

Commit Message:
GUI: Remove unnecesary parameters and increase code readabilty in dialog dumper

Changed paths:
    gui/dump-all-dialogs.cpp


diff --git a/gui/dump-all-dialogs.cpp b/gui/dump-all-dialogs.cpp
index 7ee57aa7e1d..962c9a51987 100644
--- a/gui/dump-all-dialogs.cpp
+++ b/gui/dump-all-dialogs.cpp
@@ -70,7 +70,7 @@ void handleSimpleDialog(GUI::Dialog &dialog, const Common::String &filename,Grap
 	dialog.close();
 }
 
-void dumpDialogs(const Common::String &message, int width, int height, const Common::String &lang) {
+void dumpDialogs(const Common::String &message, const Common::String &lang) {
 #ifdef USE_TRANSLATION
 	// Update GUI language
 	TransMan.setLanguage(lang);
@@ -79,56 +79,56 @@ void dumpDialogs(const Common::String &message, int width, int height, const Com
 	Graphics::Surface surf;
 	surf.create(g_system->getOverlayWidth(), g_system->getOverlayHeight(), g_system->getOverlayFormat());
 
-	Common::String filename = Common::String::format("%d-%d-%s.png", width, height, lang.c_str());
+	Common::String suffix = Common::String::format("-%dx%d-%s.png", g_system->getOverlayWidth(), g_system->getOverlayHeight(), lang.c_str());
 
 	// Skipping Tooltips as not required
 
 	// MessageDialog
 	GUI::MessageDialog messageDialog(message);
-	handleSimpleDialog(messageDialog, "messageDialog-" + filename, surf);
+	handleSimpleDialog(messageDialog, "messageDialog" + suffix, surf);
 	// AboutDialog
 	GUI::AboutDialog aboutDialog;
-	handleSimpleDialog(aboutDialog, "aboutDialog-" + filename, surf);
+	handleSimpleDialog(aboutDialog, "aboutDialog" + suffix, surf);
 
 #if defined(USE_CLOUD) && defined(USE_LIBCURL)
 	// CloudConnectingWizard
 	GUI::CloudConnectionWizard cloudConnectingWizard;
-	handleSimpleDialog(cloudConnectingWizard, "cloudConnectingWizard-" + filename, surf);
+	handleSimpleDialog(cloudConnectingWizard, "cloudConnectingWizard" + suffix, surf);
 
 	// RemoteBrowserDialog
 	GUI::RemoteBrowserDialog remoteBrowserDialog(_("Select directory with game data"));
-	handleSimpleDialog(remoteBrowserDialog, "remoteBrowserDialog-" + filename, surf);
+	handleSimpleDialog(remoteBrowserDialog, "remoteBrowserDialog" + suffix, surf);
 
 	// DownloadIconPacksDialog
 	GUI::DownloadPacksDialog downloadIconPacksDialog(_("icon packs"), "LIST", "gui-icons*.dat");
-	handleSimpleDialog(downloadIconPacksDialog, "downloadIconPacksDialog-" + filename, surf);
+	handleSimpleDialog(downloadIconPacksDialog, "downloadIconPacksDialog" + suffix, surf);
 
 	// DownloadShaderPacksDialog
 	GUI::DownloadPacksDialog downloadShaderPacksDialog(_("shader packs"), "LIST-SHADERS", "shaders*.dat");
-	handleSimpleDialog(downloadShaderPacksDialog, "downloadShaderPacksDialog-" + filename, surf);
+	handleSimpleDialog(downloadShaderPacksDialog, "downloadShaderPacksDialog" + suffix, surf);
 #endif
 
 #ifdef USE_FLUIDSYNTH
 	// FluidSynthSettingsDialog
 	GUI::FluidSynthSettingsDialog fluidSynthSettingsDialog;
-	handleSimpleDialog(fluidSynthSettingsDialog, "fluidSynthSettings-" + filename, surf);
+	handleSimpleDialog(fluidSynthSettingsDialog, "fluidSynthSettings-" + suffix, surf);
 #endif
 
 	// ThemeBrowserDialog
 	GUI::ThemeBrowser themeBrowser;
-	handleSimpleDialog(themeBrowser, "themeBrowser-" + filename, surf);
+	handleSimpleDialog(themeBrowser, "themeBrowser-" + suffix, surf);
 
 	// BrowserDialog
 	GUI::BrowserDialog browserDialog(_("Select directory with game data"), true);
-	handleSimpleDialog(browserDialog, "browserDialog-" + filename, surf);
+	handleSimpleDialog(browserDialog, "browserDialog-" + suffix, surf);
 
 	// ChooserDialog
 	GUI::ChooserDialog chooserDialog(_("Pick the game:"));
-	handleSimpleDialog(chooserDialog, "chooserDialog-" + filename, surf);
+	handleSimpleDialog(chooserDialog, "chooserDialog-" + suffix, surf);
 
 	// MassAddDialog
 	GUI::MassAddDialog massAddDialog(Common::FSNode("."));
-	handleSimpleDialog(massAddDialog, "massAddDialog-" + filename, surf);
+	handleSimpleDialog(massAddDialog, "massAddDialog-" + suffix, surf);
 
 	// LauncherDialog
 #if 0
@@ -155,6 +155,7 @@ void dumpAllDialogs(const Common::String &message) {
 					   800, 600,
 					   0};
 
+	// HACK: Pass info to backend to force window resize
 	ConfMan.setBool("force_resize", true, Common::ConfigManager::kApplicationDomain);
 	Common::FSNode dumpDir("snapshots");
 
@@ -167,16 +168,16 @@ void dumpAllDialogs(const Common::String &message) {
 		int h = r[1];
 
 		// Update resolution
-		ConfMan.setInt("last_window_width", w, Common::ConfigManager::kApplicationDomain);
+		ConfMan.setInt("last_window_width" , w, Common::ConfigManager::kApplicationDomain);
 		ConfMan.setInt("last_window_height", h, Common::ConfigManager::kApplicationDomain);
 		g_system->beginGFXTransaction();
 			g_system->initSize(w, h);
 		g_system->endGFXTransaction();
 
 		// Iterate through all langauges
-		for (Common::String lang : list) {
+		for (Common::String &lang : list) {
 
-			dumpDialogs(message, w, h, lang);
+			dumpDialogs(message, lang);
 		}
 
 	}
@@ -190,6 +191,10 @@ void dumpAllDialogs(const Common::String &message) {
 	g_system->beginGFXTransaction();
 		g_system->initSize(original_window_width, original_window_height);
 	g_system->endGFXTransaction();
+
+	// Clean up the temporary flag.
+	// Since we are still within the same method where we added,
+	// there is no need to flush config to the disk
 	ConfMan.removeKey("force_resize", Common::ConfigManager::kApplicationDomain);
 }
 




More information about the Scummvm-git-logs mailing list