Patch #1814831: "Unify the way to report unknown versions of games"
svn-id: r29293
This commit is contained in:
parent
3b005ab88f
commit
ef23e9b0af
2 changed files with 44 additions and 15 deletions
|
@ -301,6 +301,45 @@ PluginError detectGameForEngineCreation(
|
||||||
return kNoGameDataFoundError;
|
return kNoGameDataFoundError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reportUnknown(StringMap &filesMD5, HashMap<String, int32, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> &filesSize) {
|
||||||
|
// TODO: This message should be cleaned up / made more specific.
|
||||||
|
// For example, we should specify at least which engine triggered this.
|
||||||
|
//
|
||||||
|
// Might also be helpful to display the full path (for when this is used
|
||||||
|
// from the mass detector).
|
||||||
|
printf("Your game version appears to be unknown. Please, report the following\n");
|
||||||
|
printf("data to the ScummVM team along with name of the game you tried to add\n");
|
||||||
|
printf("and its version/language/etc.:\n");
|
||||||
|
|
||||||
|
for (StringMap::const_iterator file = filesMD5.begin(); file != filesMD5.end(); ++file)
|
||||||
|
printf(" \"%s\", \"%s\", %d\n", file->_key.c_str(), file->_value.c_str(), filesSize[file->_key]);
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void reportUnknown(StringList &files, int md5Bytes) {
|
||||||
|
StringMap filesMD5;
|
||||||
|
HashMap<String, int32, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> filesSize;
|
||||||
|
|
||||||
|
char md5str[32+1];
|
||||||
|
File testFile;
|
||||||
|
|
||||||
|
// Fill the data structures for the requested files
|
||||||
|
for (StringList::iterator file = files.begin(); file != files.end(); file++) {
|
||||||
|
|
||||||
|
if (testFile.open(*file)) {
|
||||||
|
filesSize[*file] = (int32)testFile.size();
|
||||||
|
|
||||||
|
if (md5_file_string(testFile, md5str, md5Bytes))
|
||||||
|
filesMD5[*file] = md5str;
|
||||||
|
|
||||||
|
testFile.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reportUnknown(filesMD5, filesSize);
|
||||||
|
}
|
||||||
|
|
||||||
static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams ¶ms, Language language, Platform platform) {
|
static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams ¶ms, Language language, Platform platform) {
|
||||||
typedef HashMap<String, bool, CaseSensitiveString_Hash, CaseSensitiveString_EqualTo> StringSet;
|
typedef HashMap<String, bool, CaseSensitiveString_Hash, CaseSensitiveString_EqualTo> StringSet;
|
||||||
StringSet filesList;
|
StringSet filesList;
|
||||||
|
@ -460,21 +499,8 @@ static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams &p
|
||||||
if (!matched.empty())
|
if (!matched.empty())
|
||||||
return matched;
|
return matched;
|
||||||
|
|
||||||
if (!filesMD5.empty()) {
|
if (!filesMD5.empty())
|
||||||
// TODO: This message should be cleaned up / made more specific.
|
reportUnknown(filesMD5, filesSize);
|
||||||
// For example, we should specify at least which engine triggered this.
|
|
||||||
//
|
|
||||||
// Might also be helpful to display the full path (for when this is used
|
|
||||||
// from the mass detector).
|
|
||||||
printf("Your game version appears to be unknown. Please, report the following\n");
|
|
||||||
printf("data to the ScummVM team along with name of the game you tried to add\n");
|
|
||||||
printf("and its version/language/etc.:\n");
|
|
||||||
|
|
||||||
for (StringMap::const_iterator file = filesMD5.begin(); file != filesMD5.end(); ++file)
|
|
||||||
printf(" \"%s\", \"%s\", %d\n", file->_key.c_str(), file->_value.c_str(), filesSize[file->_key]);
|
|
||||||
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filename based fallback
|
// Filename based fallback
|
||||||
if (params.fileBasedFallback != 0) {
|
if (params.fileBasedFallback != 0) {
|
||||||
|
|
|
@ -240,6 +240,9 @@ EncapsulatedADGameDesc detectBestMatchingGame(const Common::ADParams ¶ms);
|
||||||
// Only used by ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_FUNC
|
// Only used by ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_FUNC
|
||||||
PluginError detectGameForEngineCreation(const Common::ADParams ¶ms);
|
PluginError detectGameForEngineCreation(const Common::ADParams ¶ms);
|
||||||
|
|
||||||
|
// Helper function to announce an unknown version of the game (useful for
|
||||||
|
// fallback detection functions).
|
||||||
|
void reportUnknown(StringList &files, int md5Bytes);
|
||||||
|
|
||||||
// FIXME: It would probably be good to merge detectBestMatchingGame
|
// FIXME: It would probably be good to merge detectBestMatchingGame
|
||||||
// and detectGameForEngineCreation into a single function. Right now, the
|
// and detectGameForEngineCreation into a single function. Right now, the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue