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

sev- noreply at scummvm.org
Mon Jan 9 17:57:34 UTC 2023


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:
d3f9ddcb44 AD: Move canPlayUnknownVariants() override to a flag.


Commit: d3f9ddcb44bdc37b26eef4cca96f4b852e5925fb
    https://github.com/scummvm/scummvm/commit/d3f9ddcb44bdc37b26eef4cca96f4b852e5925fb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-01-09T18:56:50+01:00

Commit Message:
AD: Move canPlayUnknownVariants() override to a flag.

Changed paths:
    engines/advancedDetector.cpp
    engines/advancedDetector.h
    engines/ags/detection.cpp
    engines/ags/detection.h
    engines/director/detection.cpp
    engines/mtropolis/detection.cpp


diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index 23d5aebdd7f..117c81090bb 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -264,7 +264,7 @@ DetectedGames AdvancedMetaEngineDetection::detectGames(const Common::FSList &fsl
 	for (uint i = 0; i < matches.size(); i++) {
 		DetectedGame game = toDetectedGame(matches[i]);
 
-		if (game.hasUnknownFiles && !canPlayUnknownVariants()) {
+		if (game.hasUnknownFiles && !(_flags & kADFlagCanPlayUnknownVariants)) {
 			game.canBeAdded = false;
 		}
 
@@ -387,7 +387,7 @@ Common::Error AdvancedMetaEngineDetection::createInstance(OSystem *syst, Engine
 
 	ADDetectedGame agdDesc;
 	for (uint i = 0; i < matches.size(); i++) {
-		if (matches[i].desc->gameId == gameid && (!matches[i].hasUnknownFiles || canPlayUnknownVariants())) {
+		if (matches[i].desc->gameId == gameid && (!matches[i].hasUnknownFiles || (_flags & kADFlagCanPlayUnknownVariants))) {
 			agdDesc = matches[i];
 			break;
 		}
diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h
index 46bbd73a36c..b41cc257ddd 100644
--- a/engines/advancedDetector.h
+++ b/engines/advancedDetector.h
@@ -242,7 +242,7 @@ enum ADFlags {
 	 * extracted from the entries.
 	 */
 	 kADFlagMatchFullPaths = (1 << 1),
-	 
+
 	/**
 	 * If set, the engine's fallback detection results are used instead of the
 	 * partial matches found in the detection table.
@@ -251,7 +251,14 @@ enum ADFlags {
 	 * should always be used. If fallback detection fails, then partial matches
 	 * are still used.
 	 */
-	 kADFlagPreferFallbackDetection = (1 << 2)
+	 kADFlagPreferFallbackDetection = (1 << 2),
+
+	 /**
+	  * Indicates engine's ability to play a variant of a game with unknown files.
+	  * This will leave the detection entries with partial matches in the list
+	  * of detected games.
+	  */
+	kADFlagCanPlayUnknownVariants = (1 << 3),
 };
 
 
@@ -423,12 +430,6 @@ protected:
 	 */
 	virtual ADDetectedGames detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra, uint32 skipADFlags = 0, bool skipIncomplete = false);
 
-	/**
-	 * @return True if variant of a game with unknown files can be played with the engine and false otherwise.
-	 * By default this is false.
-	 */
-	virtual bool canPlayUnknownVariants() const { return false; }
-
 	/**
 	 * Iterate over all @ref ADFileBasedFallback records inside @p fileBasedFallback
 	 * and return the record (or rather, the ADGameDescription
diff --git a/engines/ags/detection.cpp b/engines/ags/detection.cpp
index fa13446a0af..0424c837538 100644
--- a/engines/ags/detection.cpp
+++ b/engines/ags/detection.cpp
@@ -73,6 +73,7 @@ const DebugChannelDef AGSMetaEngineDetection::debugFlagList[] = {
 
 AGSMetaEngineDetection::AGSMetaEngineDetection() : AdvancedMetaEngineDetection(AGS::GAME_DESCRIPTIONS,
 	        sizeof(AGS::AGSGameDescription), AGS::GAME_NAMES) {
+	_flags = kADFlagCanPlayUnknownVariants;
 }
 
 DetectedGames AGSMetaEngineDetection::detectGames(const Common::FSList &fslist, uint32 skipADFlags, bool skipIncomplete) {
diff --git a/engines/ags/detection.h b/engines/ags/detection.h
index 77e596ba5bf..1e005b670be 100644
--- a/engines/ags/detection.h
+++ b/engines/ags/detection.h
@@ -91,10 +91,6 @@ public:
 	DetectedGames detectGames(const Common::FSList &fslist, uint32 skipADFlags, bool skipIncomplete) override;
 
 	ADDetectedGame fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist, ADDetectedGameExtraInfo **extra = nullptr) const override;
-
-	bool canPlayUnknownVariants() const override {
-		return true;
-	}
 };
 
 #endif
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index e23fc2998bc..379942cfe7f 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -80,7 +80,7 @@ public:
 	DirectorMetaEngineDetection() : AdvancedMetaEngineDetection(Director::gameDescriptions, sizeof(Director::DirectorGameDescription), directorGames) {
 		_maxScanDepth = 5;
 		_directoryGlobs = Director::directoryGlobs;
-		_flags = kADFlagMatchFullPaths;
+		_flags = kADFlagMatchFullPaths | kADFlagCanPlayUnknownVariants;
 
 		// initialize customTarget hashmap here
 		for (int i = 0; customTargetList[i].name != nullptr; i++)
@@ -103,8 +103,6 @@ public:
 		return debugFlagList;
 	}
 
-	bool canPlayUnknownVariants() const override { return true; }
-
 	ADDetectedGame fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist, ADDetectedGameExtraInfo **extraInfo) const override;
 };
 
diff --git a/engines/mtropolis/detection.cpp b/engines/mtropolis/detection.cpp
index c963ce5714d..54c19bbf7c9 100644
--- a/engines/mtropolis/detection.cpp
+++ b/engines/mtropolis/detection.cpp
@@ -56,6 +56,7 @@ public:
 		_guiOptions = GUIO3(GAMEOPTION_DYNAMIC_MIDI, GAMEOPTION_LAUNCH_DEBUG, GAMEOPTION_ENABLE_SHORT_TRANSITIONS);
 		_maxScanDepth = 3;
 		_directoryGlobs = directoryGlobs;
+		_flags = kADFlagCanPlayUnknownVariants;
 	}
 
 	const char *getName() const override {
@@ -69,8 +70,6 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "mTropolis (C) mFactory/Quark";
 	}
-
-	bool canPlayUnknownVariants() const override { return true; }
 };
 
 REGISTER_PLUGIN_STATIC(MTROPOLIS_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, MTropolisMetaEngineDetection);




More information about the Scummvm-git-logs mailing list