aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorTorbjörn Andersson2014-09-01 21:19:48 +0200
committerTorbjörn Andersson2014-09-01 21:19:48 +0200
commit84548847a13de7366875894243e9e5d5a46a4aec (patch)
tree73aafe08d1e60cae3e76e2c06364f2b7b350e33f /gui
parentf1fae5373130c2c0986476f53a193f3ba2d760ab (diff)
downloadscummvm-rg350-84548847a13de7366875894243e9e5d5a46a4aec.tar.gz
scummvm-rg350-84548847a13de7366875894243e9e5d5a46a4aec.tar.bz2
scummvm-rg350-84548847a13de7366875894243e9e5d5a46a4aec.zip
DEBUGGER: Add "md5mac" command to get MD5 sum of Mac resource fork.
Diffstat (limited to 'gui')
-rw-r--r--gui/debugger.cpp27
-rw-r--r--gui/debugger.h1
2 files changed, 28 insertions, 0 deletions
diff --git a/gui/debugger.cpp b/gui/debugger.cpp
index ff365b0fad..e0b2db1f50 100644
--- a/gui/debugger.cpp
+++ b/gui/debugger.cpp
@@ -30,6 +30,7 @@
#ifndef DISABLE_MD5
#include "common/md5.h"
#include "common/archive.h"
+#include "common/macresman.h"
#include "common/stream.h"
#endif
@@ -69,6 +70,7 @@ Debugger::Debugger() {
registerCmd("openlog", WRAP_METHOD(Debugger, cmdOpenLog));
#ifndef DISABLE_MD5
registerCmd("md5", WRAP_METHOD(Debugger, cmdMd5));
+ registerCmd("md5mac", WRAP_METHOD(Debugger, cmdMd5Mac));
#endif
registerCmd("debuglevel", WRAP_METHOD(Debugger, cmdDebugLevel));
@@ -536,6 +538,31 @@ bool Debugger::cmdMd5(int argc, const char **argv) {
}
return true;
}
+
+bool Debugger::cmdMd5Mac(int argc, const char **argv) {
+ if (argc < 2) {
+ debugPrintf("md5mac <filename>\n");
+ } else {
+ // Assume that spaces are part of a single filename.
+ Common::String filename = argv[1];
+ for (int i = 2; i < argc; i++) {
+ filename = filename + " " + argv[i];
+ }
+ Common::MacResManager macResMan;
+ if (!macResMan.open(filename)) {
+ debugPrintf("Resource file '%s' not found\n", filename.c_str());
+ } else {
+ Common::String md5 = macResMan.computeResForkMD5AsString(0);
+ if (md5.empty()) {
+ debugPrintf("'%s' has no resource fork\n", filename.c_str());
+ } else {
+ debugPrintf("%s %s\n", md5.c_str(), macResMan.getBaseFileName().c_str());
+ }
+ macResMan.close();
+ }
+ }
+ return true;
+}
#endif
bool Debugger::cmdDebugLevel(int argc, const char **argv) {
diff --git a/gui/debugger.h b/gui/debugger.h
index 3a829506d9..4539ba9efb 100644
--- a/gui/debugger.h
+++ b/gui/debugger.h
@@ -215,6 +215,7 @@ protected:
bool cmdOpenLog(int argc, const char **argv);
#ifndef DISABLE_MD5
bool cmdMd5(int argc, const char **argv);
+ bool cmdMd5Mac(int argc, const char **argv);
#endif
bool cmdDebugLevel(int argc, const char **argv);
bool cmdDebugFlagsList(int argc, const char **argv);