[Scummvm-git-logs] scummvm master -> 798a569d6246c8a09eb8ff31be0fa0f8b7f237f1

sev- noreply at scummvm.org
Sat Oct 22 16:38:42 UTC 2022


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

Summary:
aaf82d7ca6 SWORD1: Switch to AdvancedMetaEngineDetection
798a569d62 SWORD1: Add multiple game variants to the detection table


Commit: aaf82d7ca6bd814484e591512d0a96cfdd06b927
    https://github.com/scummvm/scummvm/commit/aaf82d7ca6bd814484e591512d0a96cfdd06b927
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2022-10-22T18:38:38+02:00

Commit Message:
SWORD1: Switch to AdvancedMetaEngineDetection

Changed paths:
  A engines/sword1/detection.h
  A engines/sword1/detection_tables.h
  A engines/sword1/obsolete.h
    engines/sword1/console.cpp
    engines/sword1/detection.cpp
    engines/sword1/metaengine.cpp
    engines/sword1/sword1.cpp
    engines/sword1/sword1.h


diff --git a/engines/sword1/console.cpp b/engines/sword1/console.cpp
index 7646711bf2f..8b406c74f1c 100644
--- a/engines/sword1/console.cpp
+++ b/engines/sword1/console.cpp
@@ -29,7 +29,7 @@ namespace Sword1 {
 
 SwordConsole::SwordConsole(SwordEngine *vm) : GUI::Debugger(), _vm(vm) {
 	assert(_vm);
-	if (scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1mac") == 0 || scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1macdemo") == 0)
+	if (_vm->isMac())
 		registerCmd("speechEndianness",    WRAP_METHOD(SwordConsole, Cmd_SpeechEndianness));
 }
 
diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp
index 25731454ce4..74c52839673 100644
--- a/engines/sword1/detection.cpp
+++ b/engines/sword1/detection.cpp
@@ -24,54 +24,36 @@
 #include "common/fs.h"
 #include "common/gui_options.h"
 
-#include "engines/metaengine.h"
+#include "engines/advancedDetector.h"
+#include "engines/obsolete.h"
 
-/* Broken Sword */
-static const PlainGameDescriptor sword1FullSettings =
-	{"sword1", "Broken Sword: The Shadow of the Templars"};
-static const PlainGameDescriptor sword1DemoSettings =
-	{"sword1demo", "Broken Sword: The Shadow of the Templars (Demo)"};
-static const PlainGameDescriptor sword1MacFullSettings =
-	{"sword1mac", "Broken Sword: The Shadow of the Templars (Mac)"};
-static const PlainGameDescriptor sword1MacDemoSettings =
-	{"sword1macdemo", "Broken Sword: The Shadow of the Templars (Mac demo)"};
-static const PlainGameDescriptor sword1PSXSettings =
-	{"sword1psx", "Broken Sword: The Shadow of the Templars (PlayStation)"};
-static const PlainGameDescriptor sword1PSXDemoSettings =
-	{"sword1psxdemo", "Broken Sword: The Shadow of the Templars (PlayStation demo)"};
+#include "sword1/detection.h"
+#include "sword1/obsolete.h" // Obsolete ID table.
 
+static const PlainGameDescriptor swordGames[] = {
+	{"sword1", "Broken Sword: The Shadow of the Templars"},
+	{nullptr, nullptr}
+};
 
-// check these subdirectories (if present)
-static const char *const g_dirNames[] = { "clusters", "music", "speech", "english", "italian"};
-
-#define NUM_COMMON_FILES_TO_CHECK 1
-#define NUM_PC_FILES_TO_CHECK 3
-#define NUM_MAC_FILES_TO_CHECK 4
-#define NUM_DEMO_FILES_TO_CHECK 1
-#define NUM_MAC_DEMO_FILES_TO_CHECK 1
-#define NUM_PSX_FILES_TO_CHECK 1
-#define NUM_PSX_DEMO_FILES_TO_CHECK 2
+#include "sword1/detection_tables.h"
 
-#define NUM_FILES_TO_CHECK NUM_COMMON_FILES_TO_CHECK + NUM_PC_FILES_TO_CHECK + NUM_MAC_FILES_TO_CHECK + NUM_PSX_FILES_TO_CHECK + NUM_DEMO_FILES_TO_CHECK + NUM_MAC_DEMO_FILES_TO_CHECK + NUM_PSX_DEMO_FILES_TO_CHECK
-static const char *const g_filesToCheck[NUM_FILES_TO_CHECK] = { // these files have to be found
-	"swordres.rif", // Mac, PC and PSX version
-	"general.clu", // PC and PSX version
-	"compacts.clu", // PC and PSX version
-	"scripts.clu", // PC and PSX version
-	"general.clm", // Mac version only
-	"compacts.clm", // Mac version only
-	"scripts.clm", // Mac version only
-	"paris2.clm", // Mac version (full game only)
-	"1m14a.wav", // this one should only exist in the demo version
-	"scripts.clm", // Mac version both demo and full game
-	"train.plx", // PSX version only
-	"speech.dat", // PSX version only
-	"tunes.dat", // PSX version only
-	// the engine needs several more files to work, but checking these should be sufficient
+static const char *const directoryGlobs[] = {
+	"clusters",
+	nullptr
 };
 
-class SwordMetaEngineDetection : public MetaEngineDetection {
+class SwordMetaEngineDetection : public AdvancedMetaEngineDetection {
 public:
+	SwordMetaEngineDetection() : AdvancedMetaEngineDetection(Sword1::gameDescriptions, sizeof(Sword1::SwordGameDescription), swordGames) {
+		_guiOptions = GUIO2(GUIO_NOMIDI, GUIO_NOASPECT);
+		_maxScanDepth = 2;
+		_directoryGlobs = directoryGlobs;
+	}
+
+	PlainGameDescriptor findGame(const char *gameId) const override {
+		return Engines::findGameID(gameId, _gameIds, obsoleteGameIDsTable);
+	}
+
 	const char *getName() const override {
 		return "sword1";
 	}
@@ -79,142 +61,10 @@ public:
 	const char *getEngineName() const override {
 		return "Broken Sword: The Shadow of the Templars";
 	}
+
 	const char *getOriginalCopyright() const override {
 		return "Broken Sword: The Shadow of the Templars (C) Revolution";
 	}
-
-	PlainGameList getSupportedGames() const override;
-	PlainGameDescriptor findGame(const char *gameId) const override;
-	DetectedGames detectGames(const Common::FSList &fslist, uint32 /*skipADFlags*/, bool /*skipIncomplete*/) override;
 };
 
-PlainGameList SwordMetaEngineDetection::getSupportedGames() const {
-	PlainGameList games;
-	games.push_back(sword1FullSettings);
-	games.push_back(sword1DemoSettings);
-	games.push_back(sword1MacFullSettings);
-	games.push_back(sword1MacDemoSettings);
-	games.push_back(sword1PSXSettings);
-	games.push_back(sword1PSXDemoSettings);
-	return games;
-}
-
-PlainGameDescriptor SwordMetaEngineDetection::findGame(const char *gameId) const {
-	if (0 == scumm_stricmp(gameId, sword1FullSettings.gameId))
-		return sword1FullSettings;
-	if (0 == scumm_stricmp(gameId, sword1DemoSettings.gameId))
-		return sword1DemoSettings;
-	if (0 == scumm_stricmp(gameId, sword1MacFullSettings.gameId))
-		return sword1MacFullSettings;
-	if (0 == scumm_stricmp(gameId, sword1MacDemoSettings.gameId))
-		return sword1MacDemoSettings;
-	if (0 == scumm_stricmp(gameId, sword1PSXSettings.gameId))
-		return sword1PSXSettings;
-	if (0 == scumm_stricmp(gameId, sword1PSXDemoSettings.gameId))
-		return sword1PSXDemoSettings;
-	return PlainGameDescriptor::empty();
-}
-
-void Sword1CheckDirectory(const Common::FSList &fslist, bool *filesFound) {
-	for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
-		if (!file->isDirectory()) {
-			for (int cnt = 0; cnt < NUM_FILES_TO_CHECK; cnt++)
-				if (scumm_stricmp(file->getName().c_str(), g_filesToCheck[cnt]) == 0)
-					filesFound[cnt] = true;
-		} else {
-			for (int cnt = 0; cnt < ARRAYSIZE(g_dirNames); cnt++)
-				if (scumm_stricmp(file->getName().c_str(), g_dirNames[cnt]) == 0) {
-					Common::FSList fslist2;
-					if (file->getChildren(fslist2, Common::FSNode::kListFilesOnly))
-						Sword1CheckDirectory(fslist2, filesFound);
-				}
-		}
-	}
-}
-
-DetectedGames SwordMetaEngineDetection::detectGames(const Common::FSList &fslist, uint32 /*skipADFlags*/, bool /*skipIncomplete*/) {
-	int i, j;
-	DetectedGames detectedGames;
-	bool filesFound[NUM_FILES_TO_CHECK];
-	for (i = 0; i < NUM_FILES_TO_CHECK; i++)
-		filesFound[i] = false;
-
-	// The required game data files can be located in the game directory, or in
-	// a subdirectory called "clusters". In the latter case, we don't want to
-	// detect the game in that subdirectory, as this will detect the game twice
-	// when mass add is searching inside a directory. In this case, the first
-	// result (the game directory) will be correct, but the second result (the
-	// clusters subdirectory) will be wrong, as the optional speech, music and
-	// video data files will be ignored. Note that this fix will skip the game
-	// data files if the user has placed them inside a "clusters" subdirectory,
-	// or if he/she points ScummVM directly to the "clusters" directory of the
-	// game CD. Fixes bug #5274.
-	if (!fslist.empty()) {
-		Common::String directory = fslist[0].getParent().getName();
-		if (directory.hasPrefixIgnoreCase("clusters") && directory.size() <= 9)
-			return detectedGames;
-	}
-
-	Sword1CheckDirectory(fslist, filesFound);
-	bool mainFilesFound = true;
-	bool pcFilesFound = true;
-	bool macFilesFound = true;
-	bool demoFilesFound = true;
-	bool macDemoFilesFound = true;
-	bool psxFilesFound = true;
-	bool psxDemoFilesFound = true;
-	for (i = 0; i < NUM_COMMON_FILES_TO_CHECK; i++)
-		if (!filesFound[i])
-			mainFilesFound = false;
-	for (j = 0; j < NUM_PC_FILES_TO_CHECK; i++, j++)
-		if (!filesFound[i])
-			pcFilesFound = false;
-	for (j = 0; j < NUM_MAC_FILES_TO_CHECK; i++, j++)
-		if (!filesFound[i])
-			macFilesFound = false;
-	for (j = 0; j < NUM_DEMO_FILES_TO_CHECK; i++, j++)
-		if (!filesFound[i])
-			demoFilesFound = false;
-	for (j = 0; j < NUM_MAC_DEMO_FILES_TO_CHECK; i++, j++)
-		if (!filesFound[i])
-			macDemoFilesFound = false;
-	for (j = 0; j < NUM_PSX_FILES_TO_CHECK; i++, j++)
-		if (!filesFound[i])
-			psxFilesFound = false;
-	for (j = 0; j < NUM_PSX_DEMO_FILES_TO_CHECK; i++, j++)
-		if (!filesFound[i] || psxFilesFound)
-			psxDemoFilesFound = false;
-
-	DetectedGame game;
-	if (mainFilesFound && pcFilesFound && demoFilesFound)
-		game = DetectedGame(getName(), sword1DemoSettings);
-	else if (mainFilesFound && pcFilesFound && psxFilesFound)
-		game = DetectedGame(getName(), sword1PSXSettings);
-	else if (mainFilesFound && pcFilesFound && psxDemoFilesFound)
-		game = DetectedGame(getName(), sword1PSXDemoSettings);
-	else if (mainFilesFound && pcFilesFound && !psxFilesFound)
-		game = DetectedGame(getName(), sword1FullSettings);
-	else if (mainFilesFound && macFilesFound)
-		game = DetectedGame(getName(), sword1MacFullSettings);
-	else if (mainFilesFound && macDemoFilesFound)
-		game = DetectedGame(getName(), sword1MacDemoSettings);
-	else
-		return detectedGames;
-
-	game.setGUIOptions(GUIO2(GUIO_NOMIDI, GUIO_NOASPECT));
-
-	game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::EN_ANY));
-	game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::DE_DEU));
-	game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::FR_FRA));
-	game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::IT_ITA));
-	game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::ES_ESP));
-	game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::PT_BRA));
-	game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::CS_CZE));
-	game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::HE_ISR));
-
-	detectedGames.push_back(game);
-
-	return detectedGames;
-}
-
 REGISTER_PLUGIN_STATIC(SWORD1_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, SwordMetaEngineDetection);
diff --git a/engines/sword1/detection.h b/engines/sword1/detection.h
new file mode 100644
index 00000000000..59b8b1cd228
--- /dev/null
+++ b/engines/sword1/detection.h
@@ -0,0 +1,41 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef SWORD1_DETECTION_H
+#define SWORD1_DETECTION_H
+
+#include "engines/advancedDetector.h"
+
+namespace Sword1 {
+
+enum {
+	GF_DEMO	       = 1 << 0,
+};
+
+struct SwordGameDescription {
+	ADGameDescription desc;
+
+	uint32 features;
+};
+
+} // End of namespace Sword1
+
+#endif // SWORD1_DETECTION_H
diff --git a/engines/sword1/detection_tables.h b/engines/sword1/detection_tables.h
new file mode 100644
index 00000000000..b07e77f93b8
--- /dev/null
+++ b/engines/sword1/detection_tables.h
@@ -0,0 +1,85 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+namespace Sword1 {
+
+static const SwordGameDescription gameDescriptions[] = {
+	{
+		{
+			"sword1",
+			"Demo",
+			AD_ENTRY2s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200156,
+			           "swordres.rif", "bc01bc995f23e46bb076f66ba5c516c4", 58388),
+			Common::EN_ANY,
+			Common::kPlatformWindows,
+			ADGF_DEMO,
+			GUIO0()
+		},
+		GF_DEMO
+	},
+
+	{
+		{
+			"sword1",
+			"Demo",
+			AD_ENTRY2s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "swordres.rif", "3786c6850e51ecbadb65bbedb5395664", 59788),
+			Common::ES_ESP,
+			Common::kPlatformWindows,
+			ADGF_DEMO,
+			GUIO0()
+		},
+		GF_DEMO
+	},
+
+	{
+		{
+			"sword1",
+			"Demo",
+			AD_ENTRY2s("compacts.clm", "3a77d3cd0ca6c91a4f4e94459b1da773", 200852,
+			           "swordres.rif", "6b579d7cd94756f5c1e362a9b61f94a3", 59788),
+			Common::EN_ANY,
+			Common::kPlatformMacintosh,
+			ADGF_DEMO,
+			GUIO0()
+		},
+		GF_DEMO
+	},
+
+	{
+		{
+			"sword1",
+			"Demo",
+			AD_ENTRY2s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "swordres.rif", "5bd8928071b91830be6fbcdb7f59786d", 59788),
+			Common::EN_ANY,
+			Common::kPlatformPSX,
+			ADGF_DEMO,
+			GUIO0()
+		},
+		GF_DEMO
+	},
+
+	{ AD_TABLE_END_MARKER, 0 }
+};
+
+} // End of namespace Sword1
diff --git a/engines/sword1/metaengine.cpp b/engines/sword1/metaengine.cpp
index 190a026f4d1..c393eb9930f 100644
--- a/engines/sword1/metaengine.cpp
+++ b/engines/sword1/metaengine.cpp
@@ -19,8 +19,13 @@
  *
  */
 
+#include "engines/advancedDetector.h"
+#include "engines/obsolete.h"
+
 #include "sword1/sword1.h"
 #include "sword1/control.h"
+#include "sword1/detection.h"
+#include "sword1/obsolete.h"
 
 #include "common/savefile.h"
 #include "common/system.h"
@@ -28,9 +33,7 @@
 #include "graphics/thumbnail.h"
 #include "graphics/surface.h"
 
-#include "engines/metaengine.h"
-
-class SwordMetaEngine : public MetaEngine {
+class SwordMetaEngine : public AdvancedMetaEngine {
 public:
 	const char *getName() const override {
 		return "sword1";
@@ -43,7 +46,12 @@ public:
 	void removeSaveState(const char *target, int slot) const override;
 	SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
 
-	Common::Error createInstance(OSystem *syst, Engine **engine) override;
+	Common::Error createInstance(OSystem *syst, Engine **engine) override {
+		Engines::upgradeTargetIfNecessary(obsoleteGameIDsTable);
+		return AdvancedMetaEngine::createInstance(syst, engine);
+	}
+	Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
+
 	Common::String getSavegameFile(int saveGameIdx, const char *target) const override {
 		if (saveGameIdx == kSavegameFilePattern)
 			return Common::String::format("sword1.###");
@@ -70,9 +78,9 @@ bool Sword1::SwordEngine::hasFeature(EngineFeature f) const {
 	    (f == kSupportsLoadingDuringRuntime);
 }
 
-Common::Error SwordMetaEngine::createInstance(OSystem *syst, Engine **engine) {
-	assert(engine);
-	*engine = new Sword1::SwordEngine(syst);
+Common::Error SwordMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+	const Sword1::SwordGameDescription *gd = (const Sword1::SwordGameDescription *)desc;
+	*engine = new Sword1::SwordEngine(syst, gd);
 	return Common::kNoError;
 }
 
diff --git a/engines/sword1/obsolete.h b/engines/sword1/obsolete.h
new file mode 100644
index 00000000000..7ef6c5f3039
--- /dev/null
+++ b/engines/sword1/obsolete.h
@@ -0,0 +1,34 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef SWORD1_OBSOLETE_H
+#define SWORD1_OBSOLETE_H
+
+static const Engines::ObsoleteGameID obsoleteGameIDsTable[] = {
+	{"sword1demo", "sword1", Common::kPlatformWindows},
+	{"sword1mac", "sword1", Common::kPlatformMacintosh},
+	{"sword1macdemo", "sword1", Common::kPlatformMacintosh},
+	{"sword1psx", "sword1", Common::kPlatformPSX},
+	{"sword1psxdemo", "sword1", Common::kPlatformPSX},
+	{0, 0, Common::kPlatformUnknown}
+};
+
+#endif // SWORD1_OBSOLETE_H
diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp
index ebb6a9d8782..f72e0319b05 100644
--- a/engines/sword1/sword1.cpp
+++ b/engines/sword1/sword1.cpp
@@ -21,6 +21,7 @@
 
 #include "sword1/sword1.h"
 
+#include "sword1/detection.h"
 #include "sword1/resman.h"
 #include "sword1/objectman.h"
 #include "sword1/mouse.h"
@@ -43,15 +44,11 @@ namespace Sword1 {
 
 SystemVars SwordEngine::_systemVars;
 
-SwordEngine::SwordEngine(OSystem *syst)
+SwordEngine::SwordEngine(OSystem *syst, const SwordGameDescription *gameDesc)
 	: Engine(syst) {
 
-	if (!scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1demo") ||
-	        !scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1psxdemo") ||
-	        !scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1macdemo"))
-		_features = GF_DEMO;
-	else
-		_features = 0;
+	_features = gameDesc->features;
+	_systemVars.platform = gameDesc->desc.platform;
 
 	// Add default file directories
 	const Common::FSNode gameDataDir(ConfMan.get("path"));
@@ -94,15 +91,6 @@ Common::Error SwordEngine::init() {
 
 	initGraphics(640, 480);
 
-	if (0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1mac") ||
-	        0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1macdemo"))
-		_systemVars.platform = Common::kPlatformMacintosh;
-	else if (0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1psx") ||
-	         0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1psxdemo"))
-		_systemVars.platform = Common::kPlatformPSX;
-	else
-		_systemVars.platform = Common::kPlatformWindows;
-
 	checkCdFiles();
 
 	debug(5, "Starting resource manager");
diff --git a/engines/sword1/sword1.h b/engines/sword1/sword1.h
index 7bc2a264584..cf3ce1f880e 100644
--- a/engines/sword1/sword1.h
+++ b/engines/sword1/sword1.h
@@ -29,6 +29,7 @@
 #include "common/util.h"
 #include "sword1/sworddefs.h"
 #include "sword1/console.h"
+#include "sword1/detection.h"
 
 /**
  * This is the namespace of the Sword1 engine.
@@ -40,10 +41,6 @@
  */
 namespace Sword1 {
 
-enum {
-	GF_DEMO = 1 << 0
-};
-
 enum ControlPanelMode {
 	CP_NORMAL = 0,
 	CP_DEATHSCREEN,
@@ -82,7 +79,7 @@ struct SystemVars {
 class SwordEngine : public Engine {
 	friend class SwordConsole;
 public:
-	SwordEngine(OSystem *syst);
+	SwordEngine(OSystem *syst, const SwordGameDescription *gameDesc);
 	~SwordEngine() override;
 	static SystemVars _systemVars;
 	void reinitialize();


Commit: 798a569d6246c8a09eb8ff31be0fa0f8b7f237f1
    https://github.com/scummvm/scummvm/commit/798a569d6246c8a09eb8ff31be0fa0f8b7f237f1
Author: Lothar Serra Mari (mail at serra.me)
Date: 2022-10-22T18:38:38+02:00

Commit Message:
SWORD1: Add multiple game variants to the detection table

Changed paths:
    engines/sword1/detection.cpp
    engines/sword1/detection_tables.h


diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp
index 74c52839673..c3ab54fa907 100644
--- a/engines/sword1/detection.cpp
+++ b/engines/sword1/detection.cpp
@@ -39,6 +39,11 @@ static const PlainGameDescriptor swordGames[] = {
 
 static const char *const directoryGlobs[] = {
 	"clusters",
+	"music",
+	"smackshi",
+	"english",
+	"italian",
+	"speech",
 	nullptr
 };
 
diff --git a/engines/sword1/detection_tables.h b/engines/sword1/detection_tables.h
index b07e77f93b8..f4ba3beed30 100644
--- a/engines/sword1/detection_tables.h
+++ b/engines/sword1/detection_tables.h
@@ -55,8 +55,23 @@ static const SwordGameDescription gameDescriptions[] = {
 		{
 			"sword1",
 			"Demo",
-			AD_ENTRY2s("compacts.clm", "3a77d3cd0ca6c91a4f4e94459b1da773", 200852,
-			           "swordres.rif", "6b579d7cd94756f5c1e362a9b61f94a3", 59788),
+			AD_ENTRY2s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200156,
+			           "swordres.rif", "babe2ab6c352bdeb0fc256a94c934bb8", 58388),
+			Common::PT_BRA,
+			Common::kPlatformWindows,
+			ADGF_DEMO,
+			GUIO0()
+		},
+		GF_DEMO
+	},
+
+	{
+		{
+			"sword1",
+			"Demo",
+			AD_ENTRY3s("compacts.clm", "3a77d3cd0ca6c91a4f4e94459b1da773", 200852,
+			           "speech.clu",   "36919b35067bf56b68ad538732a618c2", 45528200,
+			           "intro.smk",    "d82a7869ace8fcecaa519c04c4bfc483", 13233268),
 			Common::EN_ANY,
 			Common::kPlatformMacintosh,
 			ADGF_DEMO,
@@ -69,8 +84,9 @@ static const SwordGameDescription gameDescriptions[] = {
 		{
 			"sword1",
 			"Demo",
-			AD_ENTRY2s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
-			           "swordres.rif", "5bd8928071b91830be6fbcdb7f59786d", 59788),
+			AD_ENTRY3s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "swordres.rif", "5bd8928071b91830be6fbcdb7f59786d", 59788,
+			           "speech.dat",   "4b4123155288d2c17da2c97b8b72ee6e", 14598144),
 			Common::EN_ANY,
 			Common::kPlatformPSX,
 			ADGF_DEMO,
@@ -79,6 +95,370 @@ static const SwordGameDescription gameDescriptions[] = {
 		GF_DEMO
 	},
 
+	{
+		{
+			"sword1",
+			"Demo",
+			AD_ENTRY3s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "swordres.rif", "5bd8928071b91830be6fbcdb7f59786d", 59788,
+			           "speech.dat",   "a8b0813e172f008714eb1a6d715115ab", 14014464),
+			Common::IT_ITA,
+			Common::kPlatformPSX,
+			ADGF_DEMO,
+			GUIO0()
+		},
+		GF_DEMO
+	},
+
+	{
+		{
+			"sword1",
+			"",
+			AD_ENTRY3s("text.clu",     "76f93f5feecc8915435105478f3c6615", 3193923,
+			           "history.smk",  "c3f85299b685d49a01ed8a2ab51f0cb5", 3374148,
+			           "intro.smk",    "6689aa8f84cb0387b292481d2a2428b4", 13076700),
+			Common::EN_USA,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"",
+			AD_ENTRY3s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "swordres.rif", "d21d6321ee2dbb2d7d7ca2d2a940c34a", 58916,
+			           "intro.smk",    "d82a7869ace8fcecaa519c04c4bfc483", 13233268),
+			Common::EN_GRB,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"Rerelease",
+			AD_ENTRY3s("text.clu",     "76f93f5feecc8915435105478f3c6615", 3193159,
+			           "intro.txt",    "c1215c3a92cf7e14104a8ddfda458bb1", 198,
+			           "1m2.wav",      "6b43257c8b22decfc7f289da7b653d57", 846792),
+			Common::EN_GRB,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"GoG.com",
+			AD_ENTRY3s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "swordres.rif", "5463362dc77b6efc36e46ac84998bd2f", 59788,
+			           "1m2.ogg",      "f51b159c89b0c59217ccda6795da3e15", 137715),
+			Common::EN_ANY,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"",
+			AD_ENTRY2s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "swordres.rif", "c7df52094d590b568a4ed35b70390d9e", 58916),
+			Common::FR_FRA,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"",
+			AD_ENTRY2s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "swordres.rif", "b0ae5a47aba74dc0acb3442d4c84b225", 58916),
+			Common::DE_DEU,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"",
+			AD_ENTRY3s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "swordres.rif", "08d4942cf7c904182a31a1d5333244f3", 59788,
+			           "intro.smk",    "95071cd6c12c10c9a30f45a70384cf05", 13448344),
+			Common::ES_ESP,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"",
+			AD_ENTRY3s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "swordres.rif", "08d4942cf7c904182a31a1d5333244f3", 59788,
+			           "intro.smk",    "a8c6a8770cb4b2669f4263ece8830985", 13293740),
+			Common::ES_ESP,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"",
+			AD_ENTRY2s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "swordres.rif", "239bdd76c405bad0f804a8ae5df4adb0", 59788),
+			Common::IT_ITA,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"English speech",
+			AD_ENTRY2s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "swordres.rif", "34c111f224e75050a523dc758c71d54e", 60612),
+			Common::PT_PRT,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"English speech",
+			AD_ENTRY2s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "swordres.rif", "ba6f881c3ace6408880c8e07cd8a1dfe", 59788),
+			Common::HE_ISR,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"English speech",
+			AD_ENTRY2s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "swordres.rif", "88c0793a4fa908083b00f6677c545f78", 58916),
+			Common::PL_POL,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"English speech",
+			AD_ENTRY3s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "finale.txt",   "2d415af7012c2d76b5cc4e67548bc836", 246,
+			           "intro.txt",    "0ceae1bbd3da45b9a0452118a13bd8ae", 169),
+			Common::HU_HUN,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"English speech",
+			AD_ENTRY3s("finale.txt",   "c88bb433473fe9171bca4471ebf82f9b", 238,
+			           "history.txt",  "e973f8667d3729de1ed2c313ce524990", 1098,
+			           "intro.txt",    "b9c6d2b274ea093feeecd50d0736f679", 188),
+			Common::CS_CZE,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"Akella",
+			AD_ENTRY2s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "swordres.rif", "e7021abec62dd774010d1f432ef9f03a", 58916),
+			Common::RU_RUS,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"Mediahauz",
+			AD_ENTRY2s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "swordres.rif", "7a6e896064c8d2ee266e961549487204", 58916),
+			Common::RU_RUS,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"",
+			AD_ENTRY3s("compacts.clm", "3a77d3cd0ca6c91a4f4e94459b1da773", 200852,
+			           "paris2.clm",   "6e096da5dc806b3b554fa371f6e0d749", 23981648,
+			           "credits.smk",  "eacbc81d3ef88628d3710abbbcdc9aa0", 17300736),
+			Common::EN_USA,
+			Common::kPlatformMacintosh,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"",
+			AD_ENTRY3s("compacts.clm", "3a77d3cd0ca6c91a4f4e94459b1da773", 200852,
+			           "swordres.rif", "6b579d7cd94756f5c1e362a9b61f94a3", 59788,
+			           "credits.smk",  "9a3fe9cb76bc7ca8a9987c173befb90d", 16315740),
+			Common::EN_GRB,
+			Common::kPlatformMacintosh,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"",
+			AD_ENTRY2s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "credits.dat",  "2ec14f1f262cdd2c87dd95acced9e2f6", 3312),
+			Common::EN_USA,
+			Common::kPlatformPSX,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"",
+			AD_ENTRY2s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "credits.dat",  "69349710eef6b653ed2c02643ed6c4a0", 2799),
+			Common::EN_GRB,
+			Common::kPlatformPSX,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"",
+			AD_ENTRY2s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "credits.dat",  "0b119d49f27260e6115504c135b9bb19", 2382),
+			Common::FR_FRA,
+			Common::kPlatformPSX,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"",
+			AD_ENTRY2s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "credits.dat",  "c4f84aaa17f80fb549a5c8a867a9836a", 2382),
+			Common::DE_DEU,
+			Common::kPlatformPSX,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"",
+			AD_ENTRY3s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "credits.dat",  "949806fa3eaa4ff3a6c19ee4b5caa9f5", 2823,
+			           "speech.dat",   "73348cb38e6ddd444100806c45febb18", 187961344),
+			Common::IT_ITA,
+			Common::kPlatformPSX,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+	{
+		{
+			"sword1",
+			"",
+			AD_ENTRY3s("compacts.clu", "7128bc4e99701d99c22e5841051671d3", 200852,
+			           "credits.dat",  "cd97e8f5006d91914904b3bfdb0ff588", 2412,
+			           "speech.dat",   "be1f9c4fd157711c2a0f6e020352334d", 182177792),
+			Common::ES_ESP,
+			Common::kPlatformPSX,
+			ADGF_NO_FLAGS,
+			GUIO0()
+		},
+		0
+	},
+
+
 	{ AD_TABLE_END_MARKER, 0 }
 };
 




More information about the Scummvm-git-logs mailing list