GUI: Switch debugger to openFileOrDataFork
This commit is contained in:
parent
4b7baa4159
commit
aaced28b98
1 changed files with 8 additions and 8 deletions
|
@ -716,7 +716,8 @@ bool Debugger::cmdMd5Mac(int argc, const char **argv) {
|
|||
if (!macResMan.open(filename)) {
|
||||
debugPrintf("Resource file '%s' not found\n", filename.c_str());
|
||||
} else {
|
||||
if (!macResMan.hasResFork() && !macResMan.hasDataFork()) {
|
||||
Common::ScopedPtr<Common::SeekableReadStream> dataFork(Common::MacResManager::openFileOrDataFork(filename));
|
||||
if (!macResMan.hasResFork() && !dataFork) {
|
||||
debugPrintf("'%s' has neither data not resource fork\n", macResMan.getBaseFileName().toString().c_str());
|
||||
} else {
|
||||
// The resource fork is probably the most relevant one.
|
||||
|
@ -726,14 +727,13 @@ bool Debugger::cmdMd5Mac(int argc, const char **argv) {
|
|||
md5 += Common::String::format(" (%s %d bytes)", tail ? "last" : "first", length);
|
||||
debugPrintf("%s (resource): %s, %llu bytes\n", macResMan.getBaseFileName().toString().c_str(), md5.c_str(), (unsigned long long)macResMan.getResForkDataSize());
|
||||
}
|
||||
if (macResMan.hasDataFork()) {
|
||||
Common::SeekableReadStream *stream = macResMan.getDataFork();
|
||||
if (tail && stream->size() > length)
|
||||
stream->seek(-length, SEEK_END);
|
||||
Common::String md5 = Common::computeStreamMD5AsString(*stream, length);
|
||||
if (length != 0 && length < stream->size())
|
||||
if (dataFork) {
|
||||
if (tail && dataFork->size() > length)
|
||||
dataFork->seek(-length, SEEK_END);
|
||||
Common::String md5 = Common::computeStreamMD5AsString(*dataFork, length);
|
||||
if (length != 0 && length < dataFork->size())
|
||||
md5 += Common::String::format(" (%s %d bytes)", tail ? "last" : "first", length);
|
||||
debugPrintf("%s (data): %s, %llu bytes\n", macResMan.getBaseFileName().toString().c_str(), md5.c_str(), (unsigned long long)stream->size());
|
||||
debugPrintf("%s (data): %s, %llu bytes\n", macResMan.getBaseFileName().toString().c_str(), md5.c_str(), (unsigned long long)dataFork->size());
|
||||
}
|
||||
}
|
||||
macResMan.close();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue