diff options
| author | Le Philousophe | 2019-10-20 17:40:36 +0200 | 
|---|---|---|
| committer | Le Philousophe | 2019-11-16 20:42:50 +0100 | 
| commit | 8254524d9ed8c33cb1a5c22a65c281372fac4c69 (patch) | |
| tree | e6523c4df37a481ba7080b862434ed47b0b1a132 /engines/cryomni3d/detection.cpp | |
| parent | 3906d716daf3c634d84b8eff6ede31367516fb3f (diff) | |
| download | scummvm-rg350-8254524d9ed8c33cb1a5c22a65c281372fac4c69.tar.gz scummvm-rg350-8254524d9ed8c33cb1a5c22a65c281372fac4c69.tar.bz2 scummvm-rg350-8254524d9ed8c33cb1a5c22a65c281372fac4c69.zip | |
CRYOMNI3D: Rewrite path handling to be more agnostic to installation
That simplifies fallback detection too
Diffstat (limited to 'engines/cryomni3d/detection.cpp')
| -rw-r--r-- | engines/cryomni3d/detection.cpp | 149 | 
1 files changed, 3 insertions, 146 deletions
| diff --git a/engines/cryomni3d/detection.cpp b/engines/cryomni3d/detection.cpp index 11c78ba303..1a47b0d6cb 100644 --- a/engines/cryomni3d/detection.cpp +++ b/engines/cryomni3d/detection.cpp @@ -45,24 +45,6 @@ struct CryOmni3DGameDescription {  	uint32 features;  }; -/** - * The fallback game descriptor used by the meta engine's fallbackDetector. - * Contents of this struct are overwritten by the fallbackDetector. - */ -static CryOmni3DGameDescription s_fallbackDesc = { -	{ -		"", -		"", -		AD_ENTRY1(0, 0), // This should always be AD_ENTRY1(0, 0) in the fallback descriptor -		Common::UNK_LANG, -		Common::kPlatformUnknown, -		ADGF_UNSTABLE, -		GUIO0() -	}, -	0, -	0 -}; -  const char *CryOmni3DEngine::getGameId() const {  	return _gameDescription->desc.gameId;  } @@ -104,28 +86,13 @@ class CryOmni3DMetaEngine : public AdvancedMetaEngine {  public:  	CryOmni3DMetaEngine() : AdvancedMetaEngine(CryOmni3D::gameDescriptions,  		        sizeof(CryOmni3DGameDescription), cryomni3DGames, optionsList) { -		_maxScanDepth = 1; +		_directoryGlobs = directoryGlobs; +		_maxScanDepth = 5;  	}  	ADDetectedGame fallbackDetect(const FileMap &allFiles,  	                              const Common::FSList &fslist) const override { - -		ADDetectedGame game; - -		SearchMan.addDirectory("CryOmni3DMetaEngine::fallbackDetect", fslist.begin()->getParent()); -		debug("Adding to SearchMan: %s", fslist.begin()->getParent().getPath().c_str()); - -		// Detect Versailles -		game = fallbackDetectVersailles(fslist.begin()->getParent()); -		if (game.desc) { -			SearchMan.remove("CryOmni3DMetaEngine::fallbackDetect"); -			return game; -		} - -		SearchMan.remove("CryOmni3DMetaEngine::fallbackDetect"); - -		// Fallback to standard fallback detection -		return detectGameFilebased(allFiles, fslist, CryOmni3D::fileBased); +		return detectGameFilebased(allFiles, fslist, fileBased);  	}  	const char *getEngineId() const { @@ -145,118 +112,8 @@ public:  	virtual SaveStateList listSaves(const char *target) const;  	virtual int getMaximumSaveSlot() const { return 999; }  	virtual void removeSaveState(const char *target, int slot) const; - -	bool addUnknownFile(const Common::FSNode &node, ADDetectedGame &game) const; - -	ADDetectedGame fallbackDetectVersailles(const Common::FSNode &root) const;  }; -bool CryOmni3DMetaEngine::addUnknownFile(const Common::FSNode &node, ADDetectedGame &game) const { -	Common::File testFile; -	FileProperties fileProps; - -	if (!testFile.open(node)) { -		return false; -	} - -	fileProps.size = (int32)testFile.size(); -	fileProps.md5 = Common::computeStreamMD5AsString(testFile, _md5Bytes); - -	game.hasUnknownFiles = true; -	game.matchedFiles[node.getName()] = fileProps; - -	return true; -} - -ADDetectedGame CryOmni3DMetaEngine::fallbackDetectVersailles(const Common::FSNode &root) const { -	debug("Checking for OBJETS/VS1.HLZ"); -	if (!root.getChild("OBJETS").getChild("VS1.HLZ").exists()) { -		debug("not found"); -		return ADDetectedGame(); -	} -	debug("found !"); - -	Common::FSNode node; -	const ADGameDescription *gameDesc = &s_fallbackDesc.desc; -	ADDetectedGame game(gameDesc); - -	s_fallbackDesc.desc.gameId = "versailles"; -	s_fallbackDesc.desc.extra = "fallback"; -	s_fallbackDesc.desc.language = Common::UNK_LANG; -	s_fallbackDesc.desc.flags = ADGF_UNSTABLE; -	s_fallbackDesc.desc.platform = Common::kPlatformUnknown; -	s_fallbackDesc.desc.guiOptions = GUI_OPTIONS_VERSAILLES; - -	s_fallbackDesc.gameType = GType_VERSAILLES; - -	// Sounds good, determine platform -	node = root.getChild("VERSAILL.PGM"); -	if (node.exists()) { -		addUnknownFile(node, game); - -		s_fallbackDesc.desc.platform = Common::kPlatformDOS; -	} -	node = root.getChild("VERSAILL.EXE"); -	if (node.exists()) { -		addUnknownFile(node, game); - -		s_fallbackDesc.desc.platform = Common::kPlatformWindows; -	} -	node = root.getChild("PROGRAM.Z"); -	if (node.exists()) { -		addUnknownFile(node, game); - -		s_fallbackDesc.desc.platform = Common::kPlatformWindows; -	} -	node = root.getChild("Versailles"); -	if (node.exists()) { -		addUnknownFile(node, game); - -		s_fallbackDesc.desc.platform = Common::kPlatformMacintosh; -	} - -	// Determine language -	// Use fonts set C as helvet12 contains more characters than fruitL -	uint8 fontsSet = GF_VERSAILLES_FONTS_SET_B; -	node = root.getChild("GTO").getChild("DIALOG1.GTO"); -	if (node.getChild("DIALOG1.GTO").exists()) { -		s_fallbackDesc.desc.language = Common::FR_FRA; -	} else if (node.getChild("DIALOG1.ALM").exists()) { -		s_fallbackDesc.desc.language = Common::DE_DEU; -	} else if (node.getChild("DIALOG1.GB").exists()) { -		s_fallbackDesc.desc.language = Common::EN_ANY; -	} else if (node.getChild("DIALOG1.SP").exists()) { -		s_fallbackDesc.desc.language = Common::ES_ESP; -	} else if (node.getChild("DIALOG1.ITA").exists()) { -		s_fallbackDesc.desc.language = Common::IT_ITA; -		fontsSet = GF_VERSAILLES_FONTS_SET_C; -	} - -	// Determine game flags -	s_fallbackDesc.features = 0; -	node = root.getChild("FONTS").getChild("FONT01.CRF"); -	if (node.exists()) { -		// Add file to report to let developers set appropriate game flags -		addUnknownFile(node, game); - -		s_fallbackDesc.features |= GF_VERSAILLES_FONTS_NUMERIC; -	} else { -		s_fallbackDesc.features |= fontsSet; -	} - -	node = root.getChild("DIAL").getChild("VOIX").getChild("ALI001__.WAV"); -	if (node.exists()) { -		// Add file to report to let developers set appropriate game flags -		addUnknownFile(node, game); - -		s_fallbackDesc.features |= GF_VERSAILLES_AUDIOPADDING_YES; -	} else { -		s_fallbackDesc.features |= GF_VERSAILLES_AUDIOPADDING_NO; -	} - -	return game; -} -  bool CryOmni3DMetaEngine::hasFeature(MetaEngineFeature f) const {  	return  	    (f == kSupportsListSaves) | 
