mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 08:25:35 +00:00
COMMON: Resync cache prefix with file md5 prefix
This commit is contained in:
parent
58bb2e81d3
commit
5fd3c9b9b7
@ -537,7 +537,7 @@ static MD5Properties gameFileToMD5Props(const ADGameFileDescription *fileEntry,
|
||||
static bool getFilePropertiesIntern(uint md5Bytes, const AdvancedMetaEngine::FileMap &allFiles, MD5Properties md5prop, const Common::String &fname, FileProperties &fileProps);
|
||||
|
||||
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);
|
||||
Common::String hashname = Common::String::format("%s:%s:%d", md5PropToCachePrefix(md5prop), fname.c_str(), _md5Bytes);
|
||||
|
||||
if (MD5Man.contains(hashname)) {
|
||||
fileProps.md5 = MD5Man.getMD5(hashname);
|
||||
@ -635,7 +635,7 @@ ADDetectedGames AdvancedMetaEngineDetection::detectGame(const Common::FSNode &pa
|
||||
for (fileDesc = g->filesDescriptions; fileDesc->fileName; fileDesc++) {
|
||||
MD5Properties md5prop = gameFileToMD5Props(fileDesc, g->flags);
|
||||
Common::String fname = fileDesc->fileName;
|
||||
Common::String key = Common::String::format("%c:%s", md5PropToCacheChar(md5prop), fname.c_str());
|
||||
Common::String key = Common::String::format("%s:%s", md5PropToCachePrefix(md5prop), fname.c_str());
|
||||
|
||||
if (filesProps.contains(key))
|
||||
continue;
|
||||
@ -683,7 +683,7 @@ ADDetectedGames AdvancedMetaEngineDetection::detectGame(const Common::FSNode &pa
|
||||
for (fileDesc = game.desc->filesDescriptions; fileDesc->fileName; fileDesc++) {
|
||||
Common::String tstr = fileDesc->fileName;
|
||||
MD5Properties md5prop = gameFileToMD5Props(fileDesc, g->flags);
|
||||
Common::String key = Common::String::format("%c:%s", md5PropToCacheChar(md5prop), tstr.c_str());
|
||||
Common::String key = Common::String::format("%s:%s", md5PropToCachePrefix(md5prop), tstr.c_str());
|
||||
|
||||
if (!filesProps.contains(key) || filesProps[key].size == -1) {
|
||||
allFilesPresent = false;
|
||||
|
@ -165,31 +165,31 @@ Common::U32String DetectionResults::generateUnknownGameReport(bool translate, ui
|
||||
return ::generateUnknownGameReport(_detectedGames, translate, false, wordwrapAt);
|
||||
}
|
||||
|
||||
char md5PropToCacheChar(MD5Properties flags) {
|
||||
const char *md5PropToCachePrefix(MD5Properties flags) {
|
||||
switch (flags & kMD5MacMask) {
|
||||
case kMD5MacDataFork: {
|
||||
if (flags & kMD5Tail)
|
||||
return 'd';
|
||||
return 'z';
|
||||
return "dt";
|
||||
return "d";
|
||||
}
|
||||
|
||||
case kMD5MacResOrDataFork: {
|
||||
if (flags & kMD5Tail)
|
||||
return 'e';
|
||||
return 'm';
|
||||
return "mt";
|
||||
return "m";
|
||||
}
|
||||
|
||||
case kMD5MacResFork: {
|
||||
if (flags & kMD5Tail)
|
||||
return 'x';
|
||||
return 'r';
|
||||
return "rt";
|
||||
return "r";
|
||||
}
|
||||
|
||||
default: {
|
||||
if (flags & kMD5Tail)
|
||||
return 't';
|
||||
return "ft";
|
||||
|
||||
return 'f';
|
||||
return "f";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +240,7 @@ Common::U32String generateUnknownGameReport(const DetectedGames &detectedGames,
|
||||
|
||||
// Consolidate matched files across all engines and detection entries
|
||||
for (FilePropertiesMap::const_iterator it = game.matchedFiles.begin(); it != game.matchedFiles.end(); it++) {
|
||||
Common::String key = Common::String::format("%c:%s", md5PropToCacheChar(it->_value.md5prop), it->_key.c_str());
|
||||
Common::String key = Common::String::format("%s:%s", md5PropToCachePrefix(it->_value.md5prop), it->_key.c_str());
|
||||
matchedFiles.setVal(key, it->_value);
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ enum MD5Properties {
|
||||
kMD5MacMask = kMD5MacResFork | kMD5MacDataFork, // Mask for mac type
|
||||
};
|
||||
|
||||
char md5PropToCacheChar(MD5Properties val);
|
||||
const char *md5PropToCachePrefix(MD5Properties val);
|
||||
|
||||
/**
|
||||
* A record describing the properties of a file. Used on the existing
|
||||
|
Loading…
x
Reference in New Issue
Block a user