[Scummvm-cvs-logs] SF.net SVN: scummvm:[49004] scummvm/trunk/common

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Tue May 11 17:38:22 CEST 2010


Revision: 49004
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49004&view=rev
Author:   mthreepwood
Date:     2010-05-11 15:38:21 +0000 (Tue, 11 May 2010)

Log Message:
-----------
Add support for getting a resource from the resource fork by name.

Modified Paths:
--------------
    scummvm/trunk/common/macresman.cpp
    scummvm/trunk/common/macresman.h

Modified: scummvm/trunk/common/macresman.cpp
===================================================================
--- scummvm/trunk/common/macresman.cpp	2010-05-11 11:44:17 UTC (rev 49003)
+++ scummvm/trunk/common/macresman.cpp	2010-05-11 15:38:21 UTC (rev 49004)
@@ -381,6 +381,20 @@
 	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);
 

Modified: scummvm/trunk/common/macresman.h
===================================================================
--- scummvm/trunk/common/macresman.h	2010-05-11 11:44:17 UTC (rev 49003)
+++ scummvm/trunk/common/macresman.h	2010-05-11 15:38:21 UTC (rev 49004)
@@ -61,6 +61,13 @@
 	 */
 	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();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list