[Scummvm-cvs-logs] SF.net SVN: scummvm:[49827] scummvm/trunk/engines/sci

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Jun 15 14:16:43 CEST 2010


Revision: 49827
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49827&view=rev
Author:   fingolfin
Date:     2010-06-15 12:16:42 +0000 (Tue, 15 Jun 2010)

Log Message:
-----------
SCI: Merge ResourceManager::checkIfAudioVolumeIsCompressed into AudioVolumeResourceSource constructor

Modified Paths:
--------------
    scummvm/trunk/engines/sci/resource.cpp
    scummvm/trunk/engines/sci/resource.h
    scummvm/trunk/engines/sci/resource_audio.cpp

Modified: scummvm/trunk/engines/sci/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource.cpp	2010-06-15 12:16:17 UTC (rev 49826)
+++ scummvm/trunk/engines/sci/resource.cpp	2010-06-15 12:16:42 UTC (rev 49827)
@@ -210,14 +210,6 @@
 ResourceSource *ResourceManager::addSource(ResourceSource *newsrc) {
 	assert(newsrc);
 
-	if (newsrc->getSourceType() == kSourceAudioVolume) {
-		// TODO: Move this call into the AudioVolumeResourceSource constructor.
-		// Need to verify if this is safe, though; in particular, whether this
-		// method may be called before the new AudioVolumeResourceSource has been
-		// added to the _sources lists.
-		checkIfAudioVolumeIsCompressed(newsrc);
-	}
-
 	_sources.push_back(newsrc);
 	return newsrc;
 }

Modified: scummvm/trunk/engines/sci/resource.h
===================================================================
--- scummvm/trunk/engines/sci/resource.h	2010-06-15 12:16:17 UTC (rev 49826)
+++ scummvm/trunk/engines/sci/resource.h	2010-06-15 12:16:42 UTC (rev 49827)
@@ -367,13 +367,6 @@
 	ResourceSource *addInternalMap(const Common::String &name, int resNr);
 
 	/**
-	 * Checks if an audio volume got compressed by our tool. If that is the
-	 * case, set _audioCompressionType and read in the offset translation
-	 * table for later usage.
-	 */
-	void checkIfAudioVolumeIsCompressed(ResourceSource *source);
-
-	/**
 	 * Scans newly registered resource sources for resources, earliest addition first.
 	 * @param detected_version Pointer to the detected version number,
 	 *					 used during startup. May be NULL.

Modified: scummvm/trunk/engines/sci/resource_audio.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource_audio.cpp	2010-06-15 12:16:17 UTC (rev 49826)
+++ scummvm/trunk/engines/sci/resource_audio.cpp	2010-06-15 12:16:42 UTC (rev 49827)
@@ -35,13 +35,19 @@
 
 AudioVolumeResourceSource::AudioVolumeResourceSource(const Common::String &name, ResourceSource *map, int volNum)
 	: VolumeResourceSource(name, map, volNum, kSourceAudioVolume) {
-}
 
-void ResourceManager::checkIfAudioVolumeIsCompressed(ResourceSource *source) {
-	Common::SeekableReadStream *fileStream = getVolumeFile(source);
+	ResourceManager *resMan = g_sci->getResMan();
 
+	/*
+	 * Check if this audio volume got compressed by our tool. If that is the
+	 * case, set _audioCompressionType and read in the offset translation
+	 * table for later usage.
+	 */
+
+	Common::SeekableReadStream *fileStream = resMan->getVolumeFile(this);
+
 	if (!fileStream) {
-		warning("Failed to open %s", source->getLocationName().c_str());
+		warning("Failed to open %s", getLocationName().c_str());
 		return;
 	}
 
@@ -52,13 +58,13 @@
 	case MKID_BE('OGG '):
 	case MKID_BE('FLAC'):
 		// Detected a compressed audio volume
-		source->_audioCompressionType = compressionType;
+		_audioCompressionType = compressionType;
 		// Now read the whole offset mapping table for later usage
 		int32 recordCount = fileStream->readUint32LE();
 		if (!recordCount)
 			error("compressed audio volume doesn't contain any entries!");
 		int32 *offsetMapping = new int32[(recordCount + 1) * 2];
-		source->_audioCompressionOffsetMapping = offsetMapping;
+		_audioCompressionOffsetMapping = offsetMapping;
 		for (int recordNo = 0; recordNo < recordCount; recordNo++) {
 			*offsetMapping++ = fileStream->readUint32LE();
 			*offsetMapping++ = fileStream->readUint32LE();
@@ -68,7 +74,7 @@
 		*offsetMapping++ = fileStream->size();
 	}
 
-	if (source->_resourceFile)
+	if (_resourceFile)
 		delete fileStream;
 }
 


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