diff options
author | Matthew Hoops | 2010-05-11 15:38:21 +0000 |
---|---|---|
committer | Matthew Hoops | 2010-05-11 15:38:21 +0000 |
commit | 59476e44b9d72349fb094a665759729bef1c95b2 (patch) | |
tree | 54dfcc89f6171f7780dbc0de5dbc3cbb7435f0a7 | |
parent | a9a56d50f0a534faac550e7a429848bcfda25ef3 (diff) | |
download | scummvm-rg350-59476e44b9d72349fb094a665759729bef1c95b2.tar.gz scummvm-rg350-59476e44b9d72349fb094a665759729bef1c95b2.tar.bz2 scummvm-rg350-59476e44b9d72349fb094a665759729bef1c95b2.zip |
Add support for getting a resource from the resource fork by name.
svn-id: r49004
-rw-r--r-- | common/macresman.cpp | 14 | ||||
-rw-r--r-- | common/macresman.h | 7 |
2 files changed, 21 insertions, 0 deletions
diff --git a/common/macresman.cpp b/common/macresman.cpp index f36f8b2fe3..fd17944fa9 100644 --- a/common/macresman.cpp +++ b/common/macresman.cpp @@ -381,6 +381,20 @@ Common::SeekableReadStream *MacResManager::getResource(uint32 typeID, uint16 res return _stream->readStream(len); } +Common::SeekableReadStream *MacResManager::getResource(Common::String filename) { + for (uint32 i = 0; i < _resMap.numTypes; i++) { + 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(); + return _stream->readStream(len); + } + } + } + + return 0; +} + void MacResManager::readMap() { _stream->seek(_mapOffset + 22); diff --git a/common/macresman.h b/common/macresman.h index 4afd2eebab..5cd39cae26 100644 --- a/common/macresman.h +++ b/common/macresman.h @@ -61,6 +61,13 @@ public: */ Common::SeekableReadStream *getResource(uint32 typeID, uint16 resID); + /** + * Read resource from the Mac Binary file + * @param filename filename of the resource + * @return Pointer to a SeekableReadStream with loaded resource + */ + Common::SeekableReadStream *getResource(Common::String filename); + Common::SeekableReadStream *getDataFork(); Common::String getResName(uint32 typeID, uint16 resID); uint32 getResForkSize(); |