[Scummvm-git-logs] scummvm master -> 008f4c6f8db45a52c7d7935ac549f6833ee9b788
sev-
sev at scummvm.org
Thu Feb 6 20:42:32 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
008f4c6f8d COMMON: Added dumper method to MacResMan
Commit: 008f4c6f8db45a52c7d7935ac549f6833ee9b788
https://github.com/scummvm/scummvm/commit/008f4c6f8db45a52c7d7935ac549f6833ee9b788
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-02-06T21:42:01+01:00
Commit Message:
COMMON: Added dumper method to MacResMan
Changed paths:
common/macresman.cpp
common/macresman.h
diff --git a/common/macresman.cpp b/common/macresman.cpp
index 29d3dde..aa4f536 100644
--- a/common/macresman.cpp
+++ b/common/macresman.cpp
@@ -719,4 +719,37 @@ String MacResManager::disassembleAppleDoubleName(String name, bool *isAppleDoubl
return name;
}
+void MacResManager::dumpRaw() {
+ byte *data = nullptr;
+ int dataSize = 0;
+ Common::DumpFile out;
+
+ for (int i = 0; i < _resMap.numTypes; i++) {
+ for (int j = 0; j < _resTypes[i].items; j++) {
+ _stream->seek(_dataOffset + _resLists[i][j].dataOffset);
+ uint32 len = _stream->readUint32BE();
+
+ if (dataSize < len) {
+ free(data);
+ data = (byte *)malloc(len);
+ dataSize = len;
+ }
+
+ Common::String filename = Common::String::format("./dumps/%s-%s-%d", _baseFileName.c_str(), tag2str(_resTypes[i].id), j);
+ _stream->read(data, len);
+
+ if (!out.open(filename)) {
+ warning("MacResManager::dumpRaw(): Can not open dump file %s", filename.c_str());
+ return;
+ }
+
+ out.write(data, len);
+
+ out.flush();
+ out.close();
+
+ }
+ }
+}
+
} // End of namespace Common
diff --git a/common/macresman.h b/common/macresman.h
index 703f3a1..ce3e7a8 100644
--- a/common/macresman.h
+++ b/common/macresman.h
@@ -181,6 +181,11 @@ public:
*/
bool loadFromMacBinary(SeekableReadStream &stream);
+ /**
+ * Dump contents of the archive to ./dumps directory
+ */
+ void dumpRaw();
+
private:
SeekableReadStream *_stream;
String _baseFileName;
More information about the Scummvm-git-logs
mailing list