aboutsummaryrefslogtreecommitdiff
path: root/common/macresman.cpp
diff options
context:
space:
mode:
authorYotam Barnoy2010-10-31 11:08:43 +0000
committerYotam Barnoy2010-10-31 11:08:43 +0000
commit94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1 (patch)
tree3df2a4ae7967c56d464729669fc06ce4e93dff36 /common/macresman.cpp
parent8df4278ba8cfbf71228e1927f9db635a9a30a57f (diff)
parentdca3c8d8bfc6c4db38cf8e8291818dd472041d4e (diff)
downloadscummvm-rg350-94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1.tar.gz
scummvm-rg350-94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1.tar.bz2
scummvm-rg350-94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1.zip
Updated with latest from trunk
svn-id: r53976
Diffstat (limited to 'common/macresman.cpp')
-rw-r--r--common/macresman.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/common/macresman.cpp b/common/macresman.cpp
index eb6a5939b6..641702b5ec 100644
--- a/common/macresman.cpp
+++ b/common/macresman.cpp
@@ -110,6 +110,7 @@ bool MacResManager::open(Common::String filename) {
_baseFileName = filename;
return true;
}
+
delete macResForkRawStream;
#endif
@@ -169,6 +170,7 @@ bool MacResManager::open(Common::FSNode path, Common::String filename) {
_baseFileName = filename;
return true;
}
+
delete macResForkRawStream;
#endif
@@ -466,6 +468,28 @@ Common::SeekableReadStream *MacResManager::getResource(const Common::String &fil
return 0;
}
+Common::SeekableReadStream *MacResManager::getResource(uint32 typeID, const Common::String &filename) {
+ for (uint32 i = 0; i < _resMap.numTypes; i++) {
+ if (_resTypes[i].id != typeID)
+ continue;
+
+ for (uint32 j = 0; j < _resTypes[i].items; j++) {
+ if (_resLists[i][j].nameOffset != -1 && filename.equalsIgnoreCase(_resLists[i][j].name)) {
+ _stream->seek(_dataOffset + _resLists[i][j].dataOffset);
+ uint32 len = _stream->readUint32BE();
+
+ // Ignore resources with 0 length
+ if (!len)
+ return 0;
+
+ return _stream->readStream(len);
+ }
+ }
+ }
+
+ return 0;
+}
+
void MacResManager::readMap() {
_stream->seek(_mapOffset + 22);