aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2010-06-06 13:04:24 +0000
committerFilippos Karapetis2010-06-06 13:04:24 +0000
commit43c353d9308515e0ce4d73773e50810f9e89ae47 (patch)
treee21c35e4ef8a3221628b5a1690114390a55b6746
parentb90ca013a814fd1023254543217c554382a3bd67 (diff)
downloadscummvm-rg350-43c353d9308515e0ce4d73773e50810f9e89ae47.tar.gz
scummvm-rg350-43c353d9308515e0ce4d73773e50810f9e89ae47.tar.bz2
scummvm-rg350-43c353d9308515e0ce4d73773e50810f9e89ae47.zip
Now opening all files via getVolumeFile()
svn-id: r49451
-rw-r--r--engines/sci/resource.cpp20
-rw-r--r--engines/sci/resource.h2
-rw-r--r--engines/sci/resource_audio.cpp7
3 files changed, 10 insertions, 19 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index b17117a1cd..f22c4d75fe 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -299,10 +299,15 @@ bool ResourceManager::loadFromPatchFile(Resource *res) {
return loadPatch(res, &file);
}
-Common::File *ResourceManager::getVolumeFile(const char *filename) {
+Common::SeekableReadStream *ResourceManager::getVolumeFile(ResourceSource *source) {
Common::List<Common::File *>::iterator it = _volumeFiles.begin();
Common::File *file;
+ if (source->resourceFile)
+ return source->resourceFile->createReadStream();
+
+ const char *filename = source->location_name.c_str();
+
// check if file is already opened
while (it != _volumeFiles.end()) {
file = *it;
@@ -353,13 +358,7 @@ void ResourceManager::loadResource(Resource *res) {
return;
}
- Common::SeekableReadStream *fileStream;
-
- // Either loading from volume or patch loading failed
- if (res->_source->resourceFile)
- fileStream = res->_source->resourceFile->createReadStream();
- else
- fileStream = getVolumeFile(res->_source->location_name.c_str());
+ Common::SeekableReadStream *fileStream = getVolumeFile(res->_source);
if (!fileStream) {
warning("Failed to open %s", res->_source->location_name.c_str());
@@ -1604,10 +1603,7 @@ ResourceCompression ResourceManager::getViewCompression() {
if (res->_source->source_type != kSourceVolume)
continue;
- if (res->_source->resourceFile)
- fileStream = res->_source->resourceFile->createReadStream();
- else
- fileStream = getVolumeFile(res->_source->location_name.c_str());
+ fileStream = getVolumeFile(res->_source);
if (!fileStream)
continue;
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index bc08154fed..4c7068c580 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -393,7 +393,7 @@ protected:
*/
const char *versionDescription(ResVersion version) const;
- Common::File *getVolumeFile(const char *filename);
+ Common::SeekableReadStream *getVolumeFile(ResourceSource *source);
void loadResource(Resource *res);
bool loadPatch(Resource *res, Common::SeekableReadStream *file);
bool loadFromPatchFile(Resource *res);
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index ebc549c772..57efbdcb38 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -33,12 +33,7 @@
namespace Sci {
void ResourceManager::checkIfAudioVolumeIsCompressed(ResourceSource *source) {
- Common::SeekableReadStream *fileStream;
-
- if (source->resourceFile)
- fileStream = source->resourceFile->createReadStream();
- else
- fileStream = getVolumeFile(source->location_name.c_str());
+ Common::SeekableReadStream *fileStream = getVolumeFile(source);
if (!fileStream) {
warning("Failed to open %s", source->location_name.c_str());