diff options
author | Max Horn | 2007-02-14 21:59:57 +0000 |
---|---|---|
committer | Max Horn | 2007-02-14 21:59:57 +0000 |
commit | 62bd2a1544ef01896ad10565a2a9e96a5a873bfe (patch) | |
tree | d5a2977c9d1e53a7d892a5a313e9de4ae495884c /engines/scumm | |
parent | 80f799a2b25a5ff353dd572c5aeeb469688102c2 (diff) | |
download | scummvm-rg350-62bd2a1544ef01896ad10565a2a9e96a5a873bfe.tar.gz scummvm-rg350-62bd2a1544ef01896ad10565a2a9e96a5a873bfe.tar.bz2 scummvm-rg350-62bd2a1544ef01896ad10565a2a9e96a5a873bfe.zip |
Make use of md5_file_string
svn-id: r25593
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/file.cpp | 8 | ||||
-rw-r--r-- | engines/scumm/plugin.cpp | 13 | ||||
-rw-r--r-- | engines/scumm/plugin.h | 1 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 11 |
4 files changed, 13 insertions, 20 deletions
diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp index 63e7ee48e1..0d580a327c 100644 --- a/engines/scumm/file.cpp +++ b/engines/scumm/file.cpp @@ -1383,14 +1383,10 @@ bool ScummNESFile::generateIndex() { } bool ScummNESFile::open(const Common::String &filename, AccessMode mode) { - uint8 md5sum[16]; if (_ROMset == kROMsetNum) { - if (Common::md5_file(filename.c_str(), md5sum)) { - char md5str[32+1]; - for (int j = 0; j < 16; j++) { - sprintf(md5str + j*2, "%02x", (int)md5sum[j]); - } + char md5str[32+1]; + if (Common::md5_file_string(filename.c_str(), md5str)) { if (!strcmp(md5str, "3905799e081b80a61d4460b7b733c206")) { _ROMset = kROMsetUSA; diff --git a/engines/scumm/plugin.cpp b/engines/scumm/plugin.cpp index ce01388925..250787eaf6 100644 --- a/engines/scumm/plugin.cpp +++ b/engines/scumm/plugin.cpp @@ -971,7 +971,6 @@ static Common::String generateFilenameForDetection(const GameFilenamePattern &gf struct DetectorDesc { FilesystemNode node; Common::String md5; - uint8 md5sum[16]; const MD5Table *md5Entry; // Entry of the md5 table corresponding to this file, if any. }; @@ -1013,7 +1012,6 @@ static void detectGames(const FSList &fslist, Common::List<DetectorResult> &resu dr.game.gameid = 0; dr.language = gfp->language; dr.md5.clear(); - memset(dr.md5sum, 0, 16); dr.extra = 0; // ____ _ _ @@ -1034,19 +1032,13 @@ static void detectGames(const FSList &fslist, Common::List<DetectorResult> &resu // DetectorDesc &d = fileMD5Map[file]; if (d.md5.empty()) { - uint8 md5sum[16]; - if (Common::md5_file(d.node, md5sum, kMD5FileSizeLimit)) { - char md5str[32+1]; - for (int j = 0; j < 16; j++) { - sprintf(md5str + j*2, "%02x", (int)md5sum[j]); - } + char md5str[32+1]; + if (Common::md5_file_string(d.node, md5str, kMD5FileSizeLimit)) { d.md5 = md5str; - memcpy(d.md5sum, md5sum, 16); d.md5Entry = findInMD5Table(md5str); dr.md5 = d.md5; - memcpy(dr.md5sum, d.md5sum, 16); if (d.md5Entry) { // Exact match found @@ -1117,7 +1109,6 @@ static void detectGames(const FSList &fslist, Common::List<DetectorResult> &resu // the gfp record. We then try to decide for each whether it could be // appropriate or not. dr.md5 = d.md5; - memcpy(dr.md5sum, d.md5sum, 16); for (g = gameVariantsTable; g->gameid; ++g) { // Skip over entries with a different gameid. if (g->gameid[0] == 0 || scumm_stricmp(gfp->gameid, g->gameid)) diff --git a/engines/scumm/plugin.h b/engines/scumm/plugin.h index 905b785315..3b0ddabd54 100644 --- a/engines/scumm/plugin.h +++ b/engines/scumm/plugin.h @@ -116,7 +116,6 @@ struct DetectorResult { GameSettings game; Common::Language language; Common::String md5; - uint8 md5sum[16]; const char *extra; }; diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 64bdf42f0f..8d07538638 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -119,8 +119,15 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) } _res = new ResourceManager(this); - // Copy MD5 checksum - memcpy(_gameMD5, dr.md5sum, 16); + // Convert MD5 checksum back into a digest + for (int i = 0; i < 16; ++i) { + char tmpStr[3] = "00"; + uint tmpVal; + tmpStr[0] = dr.md5[2*i]; + tmpStr[1] = dr.md5[2*i+1]; + sscanf(tmpStr, "%x", &tmpVal); + _gameMD5[i] = (byte)tmpVal; + } _fileHandle = 0; |