aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/resource.cpp8
-rw-r--r--engines/sci/resource.h7
-rw-r--r--engines/sci/resource_audio.cpp20
3 files changed, 13 insertions, 22 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 108cfa5f63..fcff177262 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -210,14 +210,6 @@ ResourceSource *ResourceManager::addExternalMap(const Common::FSNode *mapFile, i
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;
}
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index de40f73306..0d76a4e4a9 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -367,13 +367,6 @@ protected:
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.
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index 25e73242ef..4f38fe15d1 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -35,13 +35,19 @@ namespace Sci {
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 @@ void ResourceManager::checkIfAudioVolumeIsCompressed(ResourceSource *source) {
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 @@ void ResourceManager::checkIfAudioVolumeIsCompressed(ResourceSource *source) {
*offsetMapping++ = fileStream->size();
}
- if (source->_resourceFile)
+ if (_resourceFile)
delete fileStream;
}