BASE: Add dumpAllDetectionEntries() to commandLine
- Add virtual function dumpDetectionEntries() to MetaEngine - Glk, Sky and SCUMM do not have proper definitions for dumpDetectionEntries() - Add md5PropToGameFile() to extract prefixes for md5s - AdvancedDetector writes content of DAT file to STDOUT
This commit is contained in:
parent
5f3e062f97
commit
bb20579bee
7 changed files with 70 additions and 2 deletions
|
@ -1424,12 +1424,11 @@ static void listAudioDevices() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Dump MD5s from detection entries into STDOUT */
|
/** Dump MD5s from detection entries into STDOUT */
|
||||||
/** WIP: Current only creates a metaengine instance for each engine */
|
|
||||||
static void dumpAllDetectionEntries() {
|
static void dumpAllDetectionEntries() {
|
||||||
// We need to create one file for each engine
|
|
||||||
const PluginList &plugins = EngineMan.getPlugins();
|
const PluginList &plugins = EngineMan.getPlugins();
|
||||||
for (PluginList::const_iterator iter = plugins.begin(); iter != plugins.end(); iter++) {
|
for (PluginList::const_iterator iter = plugins.begin(); iter != plugins.end(); iter++) {
|
||||||
const MetaEngineDetection &metaEngine = (*iter)->get<MetaEngineDetection>();
|
const MetaEngineDetection &metaEngine = (*iter)->get<MetaEngineDetection>();
|
||||||
|
metaEngine.dumpDetectionEntries();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -545,6 +545,32 @@ static MD5Properties gameFileToMD5Props(const ADGameFileDescription *fileEntry,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *md5PropToGameFile(MD5Properties flags) {
|
||||||
|
switch (flags & kMD5MacMask) {
|
||||||
|
case kMD5MacDataFork: {
|
||||||
|
if (flags & kMD5Tail)
|
||||||
|
return "dt";
|
||||||
|
return "d";
|
||||||
|
}
|
||||||
|
|
||||||
|
case kMD5MacResOrDataFork: {
|
||||||
|
if (flags & kMD5Tail)
|
||||||
|
return "mt";
|
||||||
|
return "m";
|
||||||
|
}
|
||||||
|
|
||||||
|
case kMD5MacResFork: {
|
||||||
|
if (flags & kMD5Tail)
|
||||||
|
return "rt";
|
||||||
|
return "r";
|
||||||
|
}
|
||||||
|
|
||||||
|
default: {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static bool getFilePropertiesIntern(uint md5Bytes, const AdvancedMetaEngine::FileMap &allFiles, MD5Properties md5prop, const Common::String &fname, FileProperties &fileProps);
|
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 {
|
bool AdvancedMetaEngineDetection::getFileProperties(const FileMap &allFiles, MD5Properties md5prop, const Common::String &fname, FileProperties &fileProps) const {
|
||||||
|
@ -626,6 +652,38 @@ static bool getFilePropertiesIntern(uint md5Bytes, const AdvancedMetaEngine::Fil
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AdvancedMetaEngineDetection::dumpDetectionEntries() const {
|
||||||
|
const byte *descPtr;
|
||||||
|
|
||||||
|
debug("scummvm (");
|
||||||
|
// debug("version %s", commitHash);
|
||||||
|
// debug("date %s", date);
|
||||||
|
debug("\tauthor scummvm");
|
||||||
|
debug(")\n");
|
||||||
|
for (descPtr = _gameDescriptors; ((const ADGameDescription *)descPtr)->gameId != nullptr; descPtr += _descItemSize) {
|
||||||
|
auto g = ((const ADGameDescription *)descPtr);
|
||||||
|
auto gameid = g->gameId;
|
||||||
|
|
||||||
|
debug("game (");
|
||||||
|
debug("\tname %s", gameid);
|
||||||
|
// debug("\tsourcefile %s"); // Not necessary for now
|
||||||
|
// debug("\tromof %s"); // Not sure where i get this from
|
||||||
|
for (auto fileDesc = g->filesDescriptions; fileDesc->fileName; fileDesc++) {
|
||||||
|
Common::String fname = fileDesc->fileName;
|
||||||
|
int64 fsize = fileDesc->fileSize;
|
||||||
|
Common::String md5 = fileDesc->md5;
|
||||||
|
MD5Properties md5prop = gameFileToMD5Props(fileDesc, g->flags);
|
||||||
|
auto md5Prefix = Common::String(md5PropToGameFile(md5prop));
|
||||||
|
Common::String key = fname.c_str();
|
||||||
|
if (md5Prefix != "")
|
||||||
|
key = Common::String::format("%s:%s", md5Prefix.c_str(), fname.c_str());
|
||||||
|
|
||||||
|
debug("\trom ( name %s size %ld md5-%d %s )", fname.c_str(), fsize, _md5Bytes, key.c_str());
|
||||||
|
}
|
||||||
|
debug(")\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ADDetectedGames AdvancedMetaEngineDetection::detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra, uint32 skipADFlags, bool skipIncomplete) {
|
ADDetectedGames AdvancedMetaEngineDetection::detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra, uint32 skipADFlags, bool skipIncomplete) {
|
||||||
FilePropertiesMap filesProps;
|
FilePropertiesMap filesProps;
|
||||||
ADDetectedGames matched;
|
ADDetectedGames matched;
|
||||||
|
|
|
@ -403,6 +403,8 @@ public:
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dumpDetectionEntries() const override final;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* A hashmap of files and their MD5 checksums.
|
* A hashmap of files and their MD5 checksums.
|
||||||
|
|
|
@ -69,6 +69,8 @@ public:
|
||||||
void detectClashes() const;
|
void detectClashes() const;
|
||||||
|
|
||||||
uint getMD5Bytes() const override;
|
uint getMD5Bytes() const override;
|
||||||
|
|
||||||
|
void dumpDetectionEntries() const override final {}
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Glk {
|
namespace Glk {
|
||||||
|
|
|
@ -170,6 +170,9 @@ public:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns formatted data from game descriptor for dumping into a file */
|
||||||
|
virtual void dumpDetectionEntries() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default version of this method will just parse the options string from
|
* The default version of this method will just parse the options string from
|
||||||
* the config manager. However it also allows the meta engine to post process
|
* the config manager. However it also allows the meta engine to post process
|
||||||
|
|
|
@ -96,6 +96,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::String parseAndCustomizeGuiOptions(const Common::String &optionsString, const Common::String &domain) const override;
|
Common::String parseAndCustomizeGuiOptions(const Common::String &optionsString, const Common::String &domain) const override;
|
||||||
|
|
||||||
|
void dumpDetectionEntries() const override final {}
|
||||||
};
|
};
|
||||||
|
|
||||||
PlainGameList ScummMetaEngineDetection::getSupportedGames() const {
|
PlainGameList ScummMetaEngineDetection::getSupportedGames() const {
|
||||||
|
|
|
@ -73,6 +73,8 @@ public:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dumpDetectionEntries() const override final {}
|
||||||
|
|
||||||
int getGameVariantCount() const override {
|
int getGameVariantCount() const override {
|
||||||
int entries = 0;
|
int entries = 0;
|
||||||
for (const SkyVersion *sv = skyVersions; sv->dinnerTableEntries; ++sv)
|
for (const SkyVersion *sv = skyVersions; sv->dinnerTableEntries; ++sv)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue