From cca644796ef72d12a049152f4777fb819d74b3da Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 30 Dec 2003 19:08:45 +0000 Subject: [PATCH] hook up MD5 database (this is still kind of a hack, but at least it shows that the approach works :-) svn-id: r12035 --- scumm/scummvm.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 615a53d0c4a..a918c49550a 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -294,6 +294,12 @@ static const ScummGameSettings scumm_settings[] = { {NULL, NULL, 0, 0, MDT_NONE, 0, 0} }; +static int compareMD5Table(const void *a, const void *b) { + const char *key = (const char *)a; + const MD5Table *elem = (const MD5Table *)b; + return strcmp(key, elem->md5); +} + ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs) : Engine(syst), _gameId(gs.id), @@ -649,9 +655,19 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS } if (md5_file(buf, md5sum)) { + char md5str[32+1]; for (int j = 0; j < 16; j++) - printf("%02x", md5sum[j]); - printf(" %s\n", buf); + sprintf(md5str+j*2, "%02x", md5sum[j]); + md5str[32] = 0; + printf("%s %s\n", md5str, buf); + const MD5Table *elem; + elem = (const MD5Table *)bsearch(md5str, md5table, ARRAYSIZE(md5table)-1, sizeof(MD5Table), compareMD5Table); + if (elem) + printf("Match found in database: target %s, language %s, platform %s\n", + elem->target, Common::getLanguageDescription(elem->language), Common::getPlatformDescription(elem->platform)); + else + printf("Unknown MD5! Please report the details (language, platform, etc.) of this game to the ScummVM team\n"); + } #endif