mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
ENGINES: Change getFileProperties to receive MD5Properties as argument
This commit is contained in:
parent
a2233a2166
commit
275379c3d2
@ -520,8 +520,7 @@ static MD5Properties gameFlagsToDefaultMD5Props(uint32 flags) {
|
||||
|
||||
static bool getFilePropertiesIntern(uint md5Bytes, const AdvancedMetaEngine::FileMap &allFiles, MD5Properties md5prop, const Common::String &fname, FileProperties &fileProps);
|
||||
|
||||
bool AdvancedMetaEngineDetection::getFileProperties(const FileMap &allFiles, const ADGameDescription &game, const Common::String &fname, FileProperties &fileProps) const {
|
||||
MD5Properties md5prop = gameFlagsToDefaultMD5Props(game.flags);
|
||||
bool AdvancedMetaEngineDetection::getFileProperties(const FileMap &allFiles, MD5Properties md5prop, const Common::String &fname, FileProperties &fileProps) const {
|
||||
Common::String hashname = Common::String::format("%c:%s:%d", md5PropToCacheChar(md5prop), fname.c_str(), _md5Bytes);
|
||||
|
||||
if (MD5Man.contains(hashname)) {
|
||||
@ -540,8 +539,7 @@ bool AdvancedMetaEngineDetection::getFileProperties(const FileMap &allFiles, con
|
||||
return res;
|
||||
}
|
||||
|
||||
bool AdvancedMetaEngine::getFilePropertiesExtern(uint md5Bytes, const FileMap &allFiles, const ADGameDescription &game, const Common::String &fname, FileProperties &fileProps) const {
|
||||
MD5Properties md5prop = gameFlagsToDefaultMD5Props(game.flags);
|
||||
bool AdvancedMetaEngine::getFilePropertiesExtern(uint md5Bytes, const FileMap &allFiles, MD5Properties md5prop, const Common::String &fname, FileProperties &fileProps) const {
|
||||
return getFilePropertiesIntern(md5Bytes, allFiles, md5prop, fname, fileProps);
|
||||
}
|
||||
|
||||
@ -627,7 +625,7 @@ ADDetectedGames AdvancedMetaEngineDetection::detectGame(const Common::FSNode &pa
|
||||
continue;
|
||||
|
||||
FileProperties tmp;
|
||||
if (getFileProperties(allFiles, *g, fname, tmp)) {
|
||||
if (getFileProperties(allFiles, md5prop, fname, tmp)) {
|
||||
debugC(3, kDebugGlobalDetection, "> '%s': '%s' %ld", key.c_str(), tmp.md5.c_str(), long(tmp.size));
|
||||
}
|
||||
|
||||
@ -772,6 +770,7 @@ ADDetectedGame AdvancedMetaEngineDetection::detectGameFilebased(const FileMap &a
|
||||
debugC(4, kDebugGlobalDetection, "Matched: %s", agdesc->gameId);
|
||||
|
||||
if (numMatchedFiles > maxNumMatchedFiles) {
|
||||
MD5Properties md5prop = gameFlagsToDefaultMD5Props(agdesc->flags);
|
||||
maxNumMatchedFiles = numMatchedFiles;
|
||||
|
||||
debugC(4, kDebugGlobalDetection, "and overridden");
|
||||
@ -782,7 +781,7 @@ ADDetectedGame AdvancedMetaEngineDetection::detectGameFilebased(const FileMap &a
|
||||
for (filenames = ptr->filenames; *filenames; ++filenames) {
|
||||
FileProperties tmp;
|
||||
|
||||
if (getFileProperties(allFiles, *agdesc, *filenames, tmp))
|
||||
if (getFileProperties(allFiles, md5prop, *filenames, tmp))
|
||||
game.matchedFiles[*filenames] = tmp;
|
||||
}
|
||||
|
||||
|
@ -440,7 +440,7 @@ protected:
|
||||
void composeFileHashMap(FileMap &allFiles, const Common::FSList &fslist, int depth, const Common::String &parentName = Common::String()) const;
|
||||
|
||||
/** Get the properties (size and MD5) of this file. */
|
||||
bool getFileProperties(const FileMap &allFiles, const ADGameDescription &game, const Common::String &fname, FileProperties &fileProps) const;
|
||||
bool getFileProperties(const FileMap &allFiles, MD5Properties md5prop, const Common::String &fname, FileProperties &fileProps) const;
|
||||
|
||||
/** Convert an AD game description into the shared game description format. */
|
||||
virtual DetectedGame toDetectedGame(const ADDetectedGame &adGame, ADDetectedGameExtraInfo *extraInfo = nullptr) const;
|
||||
@ -509,7 +509,7 @@ public:
|
||||
*
|
||||
* Based on @ref MetaEngine::getFileProperties.
|
||||
*/
|
||||
bool getFilePropertiesExtern(uint md5Bytes, const FileMap &allFiles, const ADGameDescription &game, const Common::String &fname, FileProperties &fileProps) const;
|
||||
bool getFilePropertiesExtern(uint md5Bytes, const FileMap &allFiles, MD5Properties md5prop, const Common::String &fname, FileProperties &fileProps) const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
@ -287,7 +287,7 @@ ADDetectedGame DirectorMetaEngineDetection::fallbackDetect(const FileMap &allFil
|
||||
ADDetectedGame game(&desc->desc);
|
||||
|
||||
FileProperties tmp;
|
||||
if (getFileProperties(allFiles, desc->desc, file->getName(), tmp)) {
|
||||
if (getFileProperties(allFiles, kMD5Tail, file->getName(), tmp)) {
|
||||
game.hasUnknownFiles = true;
|
||||
game.matchedFiles[file->getName()] = tmp;
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ ADDetectedGame SludgeMetaEngineDetection::fallbackDetect(const FileMap &allFiles
|
||||
game.desc = &s_fallbackDesc.desc;
|
||||
|
||||
FileProperties tmp;
|
||||
if (getFileProperties(allFiles, s_fallbackDesc.desc, fileName, tmp)) {
|
||||
if (getFileProperties(allFiles, kMD5Head, fileName, tmp)) {
|
||||
game.hasUnknownFiles = true;
|
||||
game.matchedFiles[fileName] = tmp;
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ public:
|
||||
if (!file->getName().hasSuffixIgnoreCase(".dcp")) continue;
|
||||
|
||||
FileProperties tmp;
|
||||
if (AdvancedMetaEngine::getFilePropertiesExtern(md5Bytes, allFiles, s_fallbackDesc, file->getName(), tmp)) {
|
||||
if (AdvancedMetaEngine::getFilePropertiesExtern(md5Bytes, allFiles, kMD5Head, file->getName(), tmp)) {
|
||||
game.hasUnknownFiles = true;
|
||||
game.matchedFiles[file->getName()] = tmp;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user