aboutsummaryrefslogtreecommitdiff
path: root/engines/advancedDetector.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2010-05-10 18:23:54 +0000
committerMatthew Hoops2010-05-10 18:23:54 +0000
commitb9813063ad3cfca5f7ff7a731eccca0bb32159e0 (patch)
tree1a64e130c5184a22ef4251b2b00c44d7903ddfd7 /engines/advancedDetector.cpp
parentbe0885e9d1edd6963a3060a41fa3b705c84c41f1 (diff)
downloadscummvm-rg350-b9813063ad3cfca5f7ff7a731eccca0bb32159e0.tar.gz
scummvm-rg350-b9813063ad3cfca5f7ff7a731eccca0bb32159e0.tar.bz2
scummvm-rg350-b9813063ad3cfca5f7ff7a731eccca0bb32159e0.zip
Add support to the MacResManager and AdvancedDetector to take the md5 of a resource fork. This introduces a new flag, ADGF_MACRESFORK, which when set will take the md5 and size from the resource fork instead of the data fork.
svn-id: r48997
Diffstat (limited to 'engines/advancedDetector.cpp')
-rw-r--r--engines/advancedDetector.cpp41
1 files changed, 28 insertions, 13 deletions
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index a957c5a3ed..b149b43ad7 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -29,6 +29,7 @@
#include "common/util.h"
#include "common/hash-str.h"
#include "common/file.h"
+#include "common/macresman.h"
#include "common/md5.h"
#include "common/config-manager.h"
@@ -374,24 +375,38 @@ static ADGameDescList detectGame(const Common::FSList &fslist, const ADParams &p
for (fileDesc = g->filesDescriptions; fileDesc->fileName; fileDesc++) {
Common::String fname = fileDesc->fileName;
- if (allFiles.contains(fname) && !filesSizeMD5.contains(fname)) {
- debug(3, "+ %s", fname.c_str());
+ SizeMD5 tmp;
- SizeMD5 tmp;
- Common::File testFile;
-
- if (testFile.open(allFiles[fname])) {
- tmp.size = (int32)testFile.size();
- if (!md5_file_string(testFile, tmp.md5, params.md5Bytes))
+ if (g->flags & ADGF_MACRESFORK) {
+ Common::MacResManager *macResMan = new Common::MacResManager();
+
+ if (macResMan->open(parent, fname)) {
+ if (!macResMan->getResForkMD5(tmp.md5, params.md5Bytes))
tmp.md5[0] = 0;
- } else {
- tmp.size = -1;
- tmp.md5[0] = 0;
+ tmp.size = macResMan->getResForkSize();
+ debug(3, "> '%s': '%s'", fname.c_str(), tmp.md5);
+ filesSizeMD5[fname] = tmp;
}
- debug(3, "> '%s': '%s'", fname.c_str(), tmp.md5);
+ delete macResMan;
+ } else {
+ if (allFiles.contains(fname) && !filesSizeMD5.contains(fname)) {
+ debug(3, "+ %s", fname.c_str());
+
+ Common::File testFile;
- filesSizeMD5[fname] = tmp;
+ if (testFile.open(allFiles[fname])) {
+ tmp.size = (int32)testFile.size();
+ if (!md5_file_string(testFile, tmp.md5, params.md5Bytes))
+ tmp.md5[0] = 0;
+ } else {
+ tmp.size = -1;
+ tmp.md5[0] = 0;
+ }
+
+ debug(3, "> '%s': '%s'", fname.c_str(), tmp.md5);
+ filesSizeMD5[fname] = tmp;
+ }
}
}
}