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

dreammaster dreammaster at scummvm.org
Mon Feb 22 03:21:42 UTC 2021


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

Summary:
de8307bd83 AGS: Workaround for missing plugin import for Zak2


Commit: de8307bd83904aa2e05e74d3dd6e691ba1c8bd9f
    https://github.com/scummvm/scummvm/commit/de8307bd83904aa2e05e74d3dd6e691ba1c8bd9f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-02-21T19:21:32-08:00

Commit Message:
AGS: Workaround for missing plugin import for Zak2

Changed paths:
    engines/ags/detection_tables.h
    engines/ags/plugins/agsplugin.cpp
    engines/ags/shared/game/plugininfo.h


diff --git a/engines/ags/detection_tables.h b/engines/ags/detection_tables.h
index 303066ec22..a8651fa6cb 100644
--- a/engines/ags/detection_tables.h
+++ b/engines/ags/detection_tables.h
@@ -1339,7 +1339,7 @@ const PlainGameDescriptor GAME_NAMES[] = {
 	{ "wrathofthesolonoids", "Wrath of the Solonoids" },
 	{ "yoda", "Yoda" },
 	{ "yourlate", "Your late!" },
-	{ "zakmckracken", "Zak McKracken" },
+	{ "zak2", "The New Adventures of Zak McKracken" },
 	{ "zombieattack", "Zombie Attack" },
 	{ "zombiefish", "Zombie Fish" },
 	{ "zooreal", "ZooReal" },
@@ -1393,6 +1393,7 @@ const PlainGameDescriptor GAME_NAMES[] = {
 	Common::kPlatformUnknown, ADGF_UNSTABLE, GUIO0() }, PLUGIN_ARR }
 
 static const PluginVersion AGSTEAM_BLACKWELL[] = { { "agsteam", kBlackwell }, { nullptr, 0 } };
+static const PluginVersion AGS_FLASHLIGHT[] = { { "agsflashlight", 0 }, { nullptr, 0 } };
 
 const AGSGameDescription GAME_DESCRIPTIONS[] = {
 	// Pre-2.5 games that aren't supported by the current AGS engine
@@ -2854,7 +2855,7 @@ const AGSGameDescription GAME_DESCRIPTIONS[] = {
 	GAME_ENTRY("wrathofthesolonoids", "verb.exe", "0500aacb6c176d47ac0f8158f055db83", 3582078),
 	GAME_ENTRY("yoda", "Yoda.exe", "a01a9639ce30bdcd5bf82e528b51fa06", 2461339),
 	GAME_ENTRY("yourlate", "Your late.exe", "02635a77ab660023f59519c91329f7f5", 2719997),
-	GAME_ENTRY("zakmckracken", "Zak2.exe", "e88fd6a23a5e498d7b0d50e3bb914085", 8686711),
+	GAME_ENTRY_PLUGIN("zak2", "Zak2.exe", "e88fd6a23a5e498d7b0d50e3bb914085", 8686711, AGS_FLASHLIGHT),
 	GAME_ENTRY("zombiefish", "FZombie.exe", "3128b9f90e2f954ba704414ae854d10b", 4220305),
 	GAME_ENTRY("zooreal", "zoo_real.exe", "3b7cceb3e4bdb031dc5d8f290936e94b", 24184795),
 	GAME_ENTRY("zugzwang", "Zugzwang.exe", "6cddccb3744ec5c6af7c398fb7b3b11c", 17209702),
diff --git a/engines/ags/plugins/agsplugin.cpp b/engines/ags/plugins/agsplugin.cpp
index e213b2c456..c84345092b 100644
--- a/engines/ags/plugins/agsplugin.cpp
+++ b/engines/ags/plugins/agsplugin.cpp
@@ -77,6 +77,7 @@
 #include "ags/engine/util/library.h"
 #include "ags/engine/util/library_scummvm.h"
 #include "ags/ags.h"
+#include "ags/detection.h"
 #include "ags/music.h"
 
 namespace AGS3 {
@@ -904,9 +905,29 @@ int pl_register_builtin_plugin(InbuiltPluginDetails const &details) {
 }
 
 Engine::GameInitError pl_register_plugins(const std::vector<Shared::PluginInfo> &infos) {
+	// WORKAROUND: Zak2 uses AGSFlashlight, but doesn't list it as a requirement.
+	// So allow ScummVM plugins specified to be added to the list
+	std::vector<Shared::PluginInfo> neededPlugins;
+	neededPlugins = infos;
+
+	for (const ::AGS::PluginVersion *v = ::AGS::g_vm->getNeededPlugins();
+			v && v->_plugin; ++v) {
+		bool exists = false;
+		for (uint i = 0; i < neededPlugins.size() && !exists; ++i) {
+			Common::String pluginName = neededPlugins[i].Name;
+			while (pluginName.contains('.'))
+				pluginName.deleteLastChar();
+
+			exists = pluginName.equalsIgnoreCase(v->_plugin);
+		}
+
+		if (!exists)
+			neededPlugins.push_back(PluginInfo(Common::String::format("%s.dll", v->_plugin)));
+	}
+
 	numPlugins = 0;
-	for (size_t inf_index = 0; inf_index < infos.size(); ++inf_index) {
-		const Shared::PluginInfo &info = infos[inf_index];
+	for (size_t inf_index = 0; inf_index < neededPlugins.size(); ++inf_index) {
+		const Shared::PluginInfo &info = neededPlugins[inf_index];
 		String name = info.Name;
 		if (name.GetLast() == '!')
 			continue; // editor-only plugin, ignore it
diff --git a/engines/ags/shared/game/plugininfo.h b/engines/ags/shared/game/plugininfo.h
index 1ce6f27c13..07ed74aa27 100644
--- a/engines/ags/shared/game/plugininfo.h
+++ b/engines/ags/shared/game/plugininfo.h
@@ -47,8 +47,8 @@ struct PluginInfo {
 	std::shared_ptr<char> Data;
 	size_t      DataLen;
 
-	PluginInfo() : DataLen(0) {
-	}
+	PluginInfo() : DataLen(0) {}
+	PluginInfo(const String &name) : Name(name), DataLen(0) {}
 };
 
 } // namespace Shared




More information about the Scummvm-git-logs mailing list