diff options
author | Max Horn | 2005-01-05 01:26:57 +0000 |
---|---|---|
committer | Max Horn | 2005-01-05 01:26:57 +0000 |
commit | 56656f002f1163181b0eb62888f59558e9169e35 (patch) | |
tree | 23f4176048f46813d1441339678f43b0ae7120be /scumm | |
parent | 434d59a5d679c501e87875f81463abeb0d79a28c (diff) | |
download | scummvm-rg350-56656f002f1163181b0eb62888f59558e9169e35.tar.gz scummvm-rg350-56656f002f1163181b0eb62888f59558e9169e35.tar.bz2 scummvm-rg350-56656f002f1163181b0eb62888f59558e9169e35.zip |
When computing a games MD5, only use the first 1 MB of the file (this should only affect the special mac container formats, and ensures we do not try to compute the MD5 of a 500 MB file each time the game is run)
svn-id: r16432
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/scumm.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 196c504848..399f084b6f 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -89,6 +89,12 @@ struct ScummGameSettings { }; +enum { + // We only compute the MD5 of the first megabyte of our data files. + kMD5FileSizeLimit = 1024 * 1024 +}; + + static const ScummGameSettings scumm_settings[] = { /* Scumm Version 1 */ /* Scumm Version 2 */ @@ -453,7 +459,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS elem = (const MD5Table *)bsearch(md5str, md5table, ARRAYSIZE(md5table)-1, sizeof(MD5Table), compareMD5Table); if (!elem) - printf("Unknown MD5! Please report the details (language, platform, etc.) of this game to the ScummVM team\n"); + printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str); // Add default file directories. if (((_features & GF_AMIGA) || (_features & GF_ATARI_ST)) && (_version <= 4)) { @@ -2587,7 +2593,7 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) { for (StringSet::const_iterator iter = fileSet.begin(); iter != fileSet.end(); ++iter) { uint8 md5sum[16]; const char *name = iter->_key.c_str(); - if (md5_file(name, md5sum)) { + if (md5_file(name, md5sum, 0, kMD5FileSizeLimit)) { char md5str[32+1]; for (int j = 0; j < 16; j++) { sprintf(md5str + j*2, "%02x", (int)md5sum[j]); @@ -2667,7 +2673,7 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) { strcat(detectName, ".000"); } - if (md5_file(detectName, md5sum, ConfMan.get("path").c_str())) { + if (md5_file(detectName, md5sum, ConfMan.get("path").c_str(), kMD5FileSizeLimit)) { for (int j = 0; j < 16; j++) { sprintf(gameMD5 + j*2, "%02x", (int)md5sum[j]); } |