[Scummvm-git-logs] scummvm master -> 2caa5beb1fb5c7d570b0fa6f804e756f3c2034e5

criezy noreply at scummvm.org
Fri Jun 16 21:52:12 UTC 2023


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:
a448f99a0f AGS: Implement ags_app_open_url plugin
c05887d3a4 AGS: Implement GAMEOPTION_NO_SAVE_THUMBNAIL
2caa5beb1f AGS: Update Whispers of a Machine entries


Commit: a448f99a0f5e3409b41a4d1db899c238084a46ba
    https://github.com/scummvm/scummvm/commit/a448f99a0f5e3409b41a4d1db899c238084a46ba
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-06-16T22:47:25+01:00

Commit Message:
AGS: Implement ags_app_open_url plugin

Changed paths:
    engines/ags/plugins/ags_app_open_url/ags_app_open_url.cpp


diff --git a/engines/ags/plugins/ags_app_open_url/ags_app_open_url.cpp b/engines/ags/plugins/ags_app_open_url/ags_app_open_url.cpp
index 78644b5de88..532503cb4d4 100644
--- a/engines/ags/plugins/ags_app_open_url/ags_app_open_url.cpp
+++ b/engines/ags/plugins/ags_app_open_url/ags_app_open_url.cpp
@@ -19,7 +19,19 @@
  *
  */
 
+// See https://github.com/ericoporto/agsappopenurl for original plugin source code
+
 #include "ags/plugins/ags_app_open_url/ags_app_open_url.h"
+#include "common/system.h"
+
+#define MAX_URL_SIZE 2048
+
+#define FAIL_LOG_AND_EXIT(X) \
+	do { \
+		_engine->PrintDebugConsole(X); \
+		params._result = 0; \
+		return;  \
+	} while (0)
 
 namespace AGS3 {
 namespace Plugins {
@@ -36,7 +48,58 @@ void AGSAppOpenURL::AGS_EngineStartup(IAGSEngine *engine) {
 }
 
 void AGSAppOpenURL::AppOpenURL(ScriptMethodParams &params) {
-	warning("AGSAppOpenURL::AppOpenURL() is not implemented");
+	PARAMS2(int, iags_protocol, const char *, iags_url);
+
+	enum AgsUrlProtocol {
+		eAgsUrlProt_https = 0,
+		eAgsUrlProt_http
+	};
+
+	if (!g_system->hasFeature(OSystem::kFeatureOpenUrl)) {
+		FAIL_LOG_AND_EXIT("AppOpenURL: open URL not supported on current platform.");
+	}
+
+	if (iags_url == nullptr || iags_url[0] == 0) {
+		FAIL_LOG_AND_EXIT("AppOpenURL: empty URL received.");
+	}
+
+	const char *found = (const char *)memchr(iags_url, '\0', MAX_URL_SIZE);
+	if (!found) {
+		FAIL_LOG_AND_EXIT("AppOpenURL: URL is too big.");
+	}
+
+	Common::String url_str(iags_url);
+	for (char c : {' ' , '\n', '\r', '\t'}) {
+		size_t pos;
+		while ((pos = url_str.rfind(c)) != Common::String::npos) {
+			url_str.deleteChar(pos);
+		}
+	}
+	if (url_str.empty()) {
+		FAIL_LOG_AND_EXIT("AppOpenURL: URL is empty after clean up.");
+	}
+
+	if (url_str[0] == ':' || (url_str.rfind("://") != Common::String::npos))  {
+		FAIL_LOG_AND_EXIT("AppOpenURL: URL includes protocol specifiers.");
+	}
+
+	switch (iags_protocol) {
+	case eAgsUrlProt_http:
+		url_str = "http://" + url_str;
+		break;
+	case eAgsUrlProt_https:
+	default:
+		url_str = "https://" + url_str;
+		break;
+	}
+
+
+	if (!g_system->openUrl(url_str)) {
+		FAIL_LOG_AND_EXIT("AppOpenURL: Fail to open URL.");
+	}
+
+	_engine->PrintDebugConsole("AppOpenURL: success opening url");
+	params._result = 1;
 }
 
 } // namespace AGSAppOpenURL


Commit: c05887d3a4790da98b90db350909127cbc8160a8
    https://github.com/scummvm/scummvm/commit/c05887d3a4790da98b90db350909127cbc8160a8
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-06-16T22:47:37+01:00

Commit Message:
AGS: Implement GAMEOPTION_NO_SAVE_THUMBNAIL

Added game option flag to disable screenshot/thumbnail creation
on save

Changed paths:
    engines/ags/ags.cpp
    engines/ags/detection.h
    engines/ags/engine/ac/game.cpp
    engines/ags/globals.h


diff --git a/engines/ags/ags.cpp b/engines/ags/ags.cpp
index f54d55195c5..362a1becf67 100644
--- a/engines/ags/ags.cpp
+++ b/engines/ags/ags.cpp
@@ -168,6 +168,8 @@ Common::Error AGSEngine::run() {
 	if (ConfMan.hasKey("display_fps"))
 		_G(display_fps) = ConfMan.getBool("display_fps") ? AGS3::kFPS_Forced : AGS3::kFPS_Hide;
 
+	_G(saveThumbnail) = !(Common::checkGameGUIOption(GAMEOPTION_NO_SAVE_THUMBNAIL, ConfMan.get("guioptions")));
+
 	AGS3::ConfigTree startup_opts;
 	int res = AGS3::main_process_cmdline(startup_opts, ARGC, ARGV);
 	if (res != 0)
diff --git a/engines/ags/detection.h b/engines/ags/detection.h
index 1e005b670be..4f1c35f0b0f 100644
--- a/engines/ags/detection.h
+++ b/engines/ags/detection.h
@@ -57,6 +57,8 @@ extern const AGSGameDescription GAME_DESCRIPTIONS[];
 enum AGSSteamVersion { kAGSteam = 0, kWadjetEye = 1 };
 enum AGSSpriteFontVersion { kAGSSpriteFont = 0, kClifftopGames = 1 };
 
+#define GAMEOPTION_NO_SAVE_THUMBNAIL GUIO_GAMEOPTIONS1
+
 } // namespace AGS
 
 
diff --git a/engines/ags/engine/ac/game.cpp b/engines/ags/engine/ac/game.cpp
index e73ba194179..d9b8b6950a3 100644
--- a/engines/ags/engine/ac/game.cpp
+++ b/engines/ags/engine/ac/game.cpp
@@ -883,10 +883,10 @@ void save_game(int slotn, const char *descript) {
 	std::unique_ptr<Bitmap> screenShot;
 
 	// WORKAROUND: AGS originally only creates savegames if the game flags
-	// that it supports it. But we want it all the time for ScummVM GMM
-	if (/*_GP(game).options[OPT_SAVESCREENSHOT] != 0*/ true)
-		if (ConfMan.get("gameid") != "whispersofamachine")
-			screenShot.reset(create_savegame_screenshot());
+	// that it supports it. But we want it all the time for ScummVM GMM,
+	// unless explicitly disabled through gameflag
+	if ((/*_GP(game).options[OPT_SAVESCREENSHOT] != 0*/ true) && _G(saveThumbnail))
+		screenShot.reset(create_savegame_screenshot());
 
 	std::unique_ptr<Stream> out(StartSavegame(nametouse, descript, screenShot.get()));
 	if (out == nullptr) {
diff --git a/engines/ags/globals.h b/engines/ags/globals.h
index 9d9f72ac86c..bbfe52c49f9 100644
--- a/engines/ags/globals.h
+++ b/engines/ags/globals.h
@@ -1092,6 +1092,9 @@ public:
 	std::set<String> _tellInfoKeys;
 	int _loadSaveGameOnStartup = -1;
 
+	// ScummVM GUIO-controlled flag to save a screenshot
+	// when saving (used for saves thumbnails)
+	bool _saveThumbnail = true;
 #if 0
 	//! AGS_PLATFORM_DEFINES_PSP_VARS
 	int _psp_rotation = 0;


Commit: 2caa5beb1fb5c7d570b0fa6f804e756f3c2034e5
    https://github.com/scummvm/scummvm/commit/2caa5beb1fb5c7d570b0fa6f804e756f3c2034e5
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-06-16T22:47:37+01:00

Commit Message:
AGS: Update Whispers of a Machine entries

Make use of newly created GAMEOPTION_NO_SAVE_THUMBNAIL flag

Changed paths:
    engines/ags/detection_tables.h


diff --git a/engines/ags/detection_tables.h b/engines/ags/detection_tables.h
index 5ddd1af9e05..8b6356fb697 100644
--- a/engines/ags/detection_tables.h
+++ b/engines/ags/detection_tables.h
@@ -4190,8 +4190,8 @@ const AGSGameDescription GAME_DESCRIPTIONS[] = {
 	GAME_ENTRY_EN_STEAM("waitingfortheloop", "waitingfortheloop.exe", "0241777c2537fc5d077c05cde10bfa9f", 51472537),
 	GAME_ENTRY_EN("waitingfortheloop", "waitingfortheloop.exe", "0241777c2537fc5d077c05cde10bfa9f", 51273604),
 	GAME_ENTRY("welcometosunnymunarvagir", "alpha4.ags", "392dbdd0697ae32af4cfe5212f9213c5", 23000263),
-	GAME_ENTRY_PLUGIN_STEAM_NOLAUNCHLOAD("whispersofamachine", "whispers.exe", "b4962a0a9c9c33954e185a137125f527", 159084291, AGSSPRITEFONT_CLIFFTOP),  // Multilang
-	GAME_ENTRY_PLUGIN_GOG_NOLAUNCHLOAD("whispersofamachine", "whispers.exe", "b8416ff5242d6540980f922f03a01a5f", 159085573, AGSSPRITEFONT_CLIFFTOP),
+	DETECTION_ENTRY_GUIO("whispersofamachine", "whispers.exe", "b4962a0a9c9c33954e185a137125f527", 159084291, Common::UNK_LANG, "Steam", GUIO3(GUIO_NOLANG, GUIO_NOLAUNCHLOAD, GAMEOPTION_NO_SAVE_THUMBNAIL), AGSSPRITEFONT_CLIFFTOP, ADGF_NO_FLAGS),  // Multilang
+	DETECTION_ENTRY_GUIO("whispersofamachine", "whispers.exe", "b8416ff5242d6540980f922f03a01a5f", 159085573, Common::UNK_LANG, "GOG.com", GUIO3(GUIO_NOLANG, GUIO_NOLAUNCHLOAD, GAMEOPTION_NO_SAVE_THUMBNAIL), AGSSPRITEFONT_CLIFFTOP, ADGF_NO_FLAGS),
 	GAME_ENTRY_EN_STEAM("wolfterritory", "wolf.exe", "78dd4ca028ee0156b6a093d6d780aa65", 3957156),
 	GAME_ENTRY_EN_STEAM("yetilastescape", "Big-run.exe", "1e003cdad70709b5bd3d0d957f637e58", 31372723),
 	GAME_ENTRY_STEAM("zniwadventure", "ctgame.exe", "8a2d48ee8d92bad3c5cacd8b883c5871", 100036465),  // Win Eng-Pol




More information about the Scummvm-git-logs mailing list