mirror of
https://github.com/libretro/scummvm.git
synced 2024-11-27 11:20:40 +00:00
Renamed Archive::openFile to createReadStreamForMember
svn-id: r36021
This commit is contained in:
parent
9861afd8fd
commit
14c5bbbccf
@ -252,7 +252,7 @@ bool VirtualKeyboardParser::parserCallback_layout(ParserNode *node) {
|
||||
|
||||
_mode->bitmapName = node->values["bitmap"];
|
||||
|
||||
SeekableReadStream *file = _keyboard->_fileArchive->openFile(_mode->bitmapName);
|
||||
SeekableReadStream *file = _keyboard->_fileArchive->createReadStreamForMember(_mode->bitmapName);
|
||||
if (!file)
|
||||
return parserError("Bitmap '%s' not found", _mode->bitmapName.c_str());
|
||||
|
||||
|
@ -103,7 +103,7 @@ bool VirtualKeyboard::loadKeyboardPack(String packName) {
|
||||
#ifdef USE_ZLIB
|
||||
_fileArchive = new ZipArchive(vkDir.getChild(packName + ".zip"));
|
||||
if (_fileArchive->hasFile(packName + ".xml")) {
|
||||
if (!_parser->loadStream(_fileArchive->openFile(packName + ".xml")))
|
||||
if (!_parser->loadStream(_fileArchive->createReadStreamForMember(packName + ".xml")))
|
||||
return false;
|
||||
} else {
|
||||
warning("Could not find %s.xml file in %s.zip keyboard pack", packName.c_str(), packName.c_str());
|
||||
|
@ -39,7 +39,7 @@ String GenericArchiveMember::getName() const {
|
||||
}
|
||||
|
||||
SeekableReadStream *GenericArchiveMember::createReadStream() const {
|
||||
return _parent->openFile(_name);
|
||||
return _parent->createReadStreamForMember(_name);
|
||||
}
|
||||
|
||||
|
||||
@ -136,23 +136,23 @@ ArchiveMemberPtr FSDirectory::getMember(const String &name) {
|
||||
return ArchiveMemberPtr(new FSNode(node));
|
||||
}
|
||||
|
||||
SeekableReadStream *FSDirectory::openFile(const String &name) const {
|
||||
SeekableReadStream *FSDirectory::createReadStreamForMember(const String &name) const {
|
||||
if (name.empty() || !_node.isDirectory())
|
||||
return 0;
|
||||
|
||||
FSNode node = lookupCache(_fileCache, name);
|
||||
|
||||
if (!node.exists()) {
|
||||
warning("FSDirectory::openFile: FSNode does not exist");
|
||||
warning("FSDirectory::createReadStreamForMember: FSNode does not exist");
|
||||
return 0;
|
||||
} else if (node.isDirectory()) {
|
||||
warning("FSDirectory::openFile: FSNode is a directory");
|
||||
warning("FSDirectory::createReadStreamForMember: FSNode is a directory");
|
||||
return 0;
|
||||
}
|
||||
|
||||
SeekableReadStream *stream = node.createReadStream();
|
||||
if (!stream)
|
||||
warning("FSDirectory::openFile: Can't create stream for file '%s'", name.c_str());
|
||||
warning("FSDirectory::createReadStreamForMember: Can't create stream for file '%s'", name.c_str());
|
||||
|
||||
return stream;
|
||||
}
|
||||
@ -434,14 +434,14 @@ ArchiveMemberPtr SearchSet::getMember(const String &name) {
|
||||
return ArchiveMemberPtr();
|
||||
}
|
||||
|
||||
SeekableReadStream *SearchSet::openFile(const String &name) const {
|
||||
SeekableReadStream *SearchSet::createReadStreamForMember(const String &name) const {
|
||||
if (name.empty())
|
||||
return 0;
|
||||
|
||||
ArchiveNodeList::iterator it = _list.begin();
|
||||
for ( ; it != _list.end(); ++it) {
|
||||
if (it->_arc->hasFile(name))
|
||||
return it->_arc->openFile(name);
|
||||
return it->_arc->createReadStreamForMember(name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
|
||||
/**
|
||||
* Add all the names present in the Archive which match pattern to
|
||||
* list. Returned names can be used as parameters to openFile.
|
||||
* list. Returned names can be used as parameters to createReadStreamForMember.
|
||||
* Must not remove elements from the list.
|
||||
*
|
||||
* @return the number of names added to list
|
||||
@ -104,7 +104,7 @@ public:
|
||||
|
||||
/**
|
||||
* Add all the names present in the Archive to list. Returned
|
||||
* names can be used as parameters to openFile.
|
||||
* names can be used as parameters to createReadStreamForMember.
|
||||
* Must not remove elements from the list.
|
||||
*
|
||||
* @return the number of names added to list
|
||||
@ -120,7 +120,7 @@ public:
|
||||
* Create a stream bound to a file in the archive.
|
||||
* @return the newly created input stream
|
||||
*/
|
||||
virtual SeekableReadStream *openFile(const String &name) const = 0;
|
||||
virtual SeekableReadStream *createReadStreamForMember(const String &name) const = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -194,10 +194,10 @@ public:
|
||||
virtual ArchiveMemberPtr getMember(const String &name);
|
||||
|
||||
/**
|
||||
* Implements openFile from Archive base class. The current policy is
|
||||
* Implements createReadStreamForMember from Archive base class. The current policy is
|
||||
* opening the first file encountered that matches the name.
|
||||
*/
|
||||
virtual SeekableReadStream *openFile(const String &name) const;
|
||||
virtual SeekableReadStream *createReadStreamForMember(const String &name) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -62,12 +62,12 @@ bool File::open(const String &filename, Archive &archive) {
|
||||
SeekableReadStream *stream = 0;
|
||||
if (archive.hasFile(filename)) {
|
||||
debug(3, "Opening hashed: %s", filename.c_str());
|
||||
stream = archive.openFile(filename);
|
||||
stream = archive.createReadStreamForMember(filename);
|
||||
} else if (archive.hasFile(filename + ".")) {
|
||||
// WORKAROUND: Bug #1458388: "SIMON1: Game Detection fails"
|
||||
// sometimes instead of "GAMEPC" we get "GAMEPC." (note trailing dot)
|
||||
debug(3, "Opening hashed: %s.", filename.c_str());
|
||||
stream = archive.openFile(filename + ".");
|
||||
stream = archive.createReadStreamForMember(filename + ".");
|
||||
}
|
||||
|
||||
return open(stream, filename);
|
||||
|
@ -243,7 +243,7 @@ public:
|
||||
* Again, only SLASHES are used as separators independently from the
|
||||
* underlying file system.
|
||||
*
|
||||
* Relative paths can be specified when calling matching functions like openFile(),
|
||||
* Relative paths can be specified when calling matching functions like createReadStreamForMember(),
|
||||
* hasFile(), listMatchingMembers() and listMembers(). Please see the function
|
||||
* specific comments for more information.
|
||||
*
|
||||
@ -333,7 +333,7 @@ public:
|
||||
* Open the specified file. A full match of relative path and filename is needed
|
||||
* for success.
|
||||
*/
|
||||
virtual SeekableReadStream *openFile(const String &name) const;
|
||||
virtual SeekableReadStream *createReadStreamForMember(const String &name) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -350,7 +350,7 @@ bool ArjFile::open(const Common::String &filename) {
|
||||
error("Attempt to open another instance of archive");
|
||||
|
||||
if (_fallBack) {
|
||||
_uncompressed = SearchMan.openFile(filename);
|
||||
_uncompressed = SearchMan.createReadStreamForMember(filename);
|
||||
if (_uncompressed)
|
||||
return true;
|
||||
}
|
||||
|
@ -1376,7 +1376,7 @@ public:
|
||||
*/
|
||||
|
||||
ZipArchive::ZipArchive(const Common::String &name) {
|
||||
SeekableReadStream *stream = SearchMan.openFile(name);
|
||||
SeekableReadStream *stream = SearchMan.createReadStreamForMember(name);
|
||||
_zipFile = unzOpen(stream);
|
||||
}
|
||||
|
||||
@ -1428,7 +1428,7 @@ ArchiveMemberPtr ZipArchive::getMember(const String &name) {
|
||||
return ArchiveMemberPtr(new GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *ZipArchive::openFile(const Common::String &name) const {
|
||||
Common::SeekableReadStream *ZipArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
if (!_zipFile)
|
||||
return 0;
|
||||
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
virtual bool hasFile(const String &name);
|
||||
virtual int listMembers(ArchiveMemberList &list);
|
||||
virtual ArchiveMemberPtr getMember(const String &name);
|
||||
virtual SeekableReadStream *openFile(const String &name) const;
|
||||
virtual SeekableReadStream *createReadStreamForMember(const String &name) const;
|
||||
};
|
||||
|
||||
} // End of namespace Common
|
||||
|
@ -31,7 +31,7 @@
|
||||
namespace Common {
|
||||
|
||||
bool XMLParser::loadFile(const Common::String &filename) {
|
||||
_stream = SearchMan.openFile(filename);
|
||||
_stream = SearchMan.createReadStreamForMember(filename);
|
||||
if (!_stream)
|
||||
return false;
|
||||
|
||||
|
@ -311,7 +311,7 @@ bool Resource::loadFileToBuf(const char *file, void *buf, uint32 maxSize) {
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *Resource::getFileStream(const Common::String &file) {
|
||||
return _files.openFile(file);
|
||||
return _files.createReadStreamForMember(file);
|
||||
}
|
||||
|
||||
Common::Archive *Resource::loadArchive(const Common::String &name, Common::SharedPtr<Common::ArchiveMember> member) {
|
||||
|
@ -69,7 +69,7 @@ Common::ArchiveMemberPtr PlainArchive::getMember(const Common::String &name) {
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *PlainArchive::openFile(const Common::String &name) const {
|
||||
Common::SeekableReadStream *PlainArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
FileMap::const_iterator fDesc = _files.find(name);
|
||||
if (fDesc == _files.end())
|
||||
return 0;
|
||||
@ -124,7 +124,7 @@ Common::ArchiveMemberPtr CachedArchive::getMember(const Common::String &name) {
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *CachedArchive::openFile(const Common::String &name) const {
|
||||
Common::SeekableReadStream *CachedArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
FileMap::const_iterator fDesc = _files.find(name);
|
||||
if (fDesc == _files.end())
|
||||
return 0;
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
bool hasFile(const Common::String &name);
|
||||
int listMembers(Common::ArchiveMemberList &list);
|
||||
Common::ArchiveMemberPtr getMember(const Common::String &name);
|
||||
Common::SeekableReadStream *openFile(const Common::String &name) const;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
|
||||
private:
|
||||
struct Entry {
|
||||
uint32 offset;
|
||||
@ -82,7 +82,7 @@ public:
|
||||
bool hasFile(const Common::String &name);
|
||||
int listMembers(Common::ArchiveMemberList &list);
|
||||
Common::ArchiveMemberPtr getMember(const Common::String &name);
|
||||
Common::SeekableReadStream *openFile(const Common::String &name) const;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
|
||||
private:
|
||||
struct Entry {
|
||||
byte *data;
|
||||
|
@ -101,7 +101,7 @@ Common::SeekableReadStream *Disk_br::openFile_internal(bool errorOnNotFound, con
|
||||
lookup = name + ext;
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *stream = _sset.openFile(lookup);
|
||||
Common::SeekableReadStream *stream = _sset.createReadStreamForMember(lookup);
|
||||
if (stream) {
|
||||
return stream;
|
||||
}
|
||||
@ -116,7 +116,7 @@ Common::SeekableReadStream *Disk_br::openFile_internal(bool errorOnNotFound, con
|
||||
lookup.deleteLastChar();
|
||||
}
|
||||
lookup += ext;
|
||||
stream = _sset.openFile(lookup);
|
||||
stream = _sset.createReadStreamForMember(lookup);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
NSArchive(Common::SeekableReadStream *stream, Common::Platform platform, uint32 features);
|
||||
~NSArchive();
|
||||
|
||||
Common::SeekableReadStream *openFile(const Common::String &name) const;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
|
||||
bool hasFile(const Common::String &name);
|
||||
int listMembers(Common::ArchiveMemberList &list);
|
||||
Common::ArchiveMemberPtr getMember(const Common::String &name);
|
||||
@ -127,8 +127,8 @@ uint32 NSArchive::lookup(const char *name) const {
|
||||
return i;
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *NSArchive::openFile(const Common::String &name) const {
|
||||
debugC(3, kDebugDisk, "NSArchive::openFile(%s)", name.c_str());
|
||||
Common::SeekableReadStream *NSArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
debugC(3, kDebugDisk, "NSArchive::createReadStreamForMember(%s)", name.c_str());
|
||||
|
||||
if (name.empty())
|
||||
return 0;
|
||||
@ -136,7 +136,7 @@ Common::SeekableReadStream *NSArchive::openFile(const Common::String &name) cons
|
||||
uint32 index = lookup(name.c_str());
|
||||
if (index == _numFiles) return 0;
|
||||
|
||||
debugC(9, kDebugDisk, "NSArchive::openFile: '%s' found in slot %i", name.c_str(), index);
|
||||
debugC(9, kDebugDisk, "NSArchive::createReadStreamForMember: '%s' found in slot %i", name.c_str(), index);
|
||||
|
||||
int offset = _archiveOffsets[index];
|
||||
int endOffset = _archiveOffsets[index] + _archiveLenghts[index];
|
||||
@ -195,7 +195,7 @@ Common::SeekableReadStream *Disk_ns::openFile(const char *filename) {
|
||||
|
||||
|
||||
void Disk_ns::addArchive(const Common::String& name, int priority) {
|
||||
Common::SeekableReadStream *stream = _sset.openFile(name);
|
||||
Common::SeekableReadStream *stream = _sset.createReadStreamForMember(name);
|
||||
if (!stream)
|
||||
error("Disk_ns::addArchive() couldn't find archive '%s'", name.c_str());
|
||||
|
||||
@ -257,13 +257,13 @@ void DosDisk_ns::init() {
|
||||
Common::SeekableReadStream *DosDisk_ns::tryOpenFile(const char* name) {
|
||||
debugC(3, kDebugDisk, "DosDisk_ns::tryOpenFile(%s)", name);
|
||||
|
||||
Common::SeekableReadStream *stream = _sset.openFile(name);
|
||||
Common::SeekableReadStream *stream = _sset.createReadStreamForMember(name);
|
||||
if (stream)
|
||||
return stream;
|
||||
|
||||
char path[PATH_LEN];
|
||||
sprintf(path, "%s.pp", name);
|
||||
return _sset.openFile(path);
|
||||
return _sset.createReadStreamForMember(path);
|
||||
}
|
||||
|
||||
|
||||
@ -896,18 +896,18 @@ GfxObj* AmigaDisk_ns::loadStatic(const char* name) {
|
||||
Common::SeekableReadStream *AmigaDisk_ns::tryOpenFile(const char* name) {
|
||||
debugC(3, kDebugDisk, "AmigaDisk_ns::tryOpenFile(%s)", name);
|
||||
|
||||
Common::SeekableReadStream *stream = _sset.openFile(name);
|
||||
Common::SeekableReadStream *stream = _sset.createReadStreamForMember(name);
|
||||
if (stream)
|
||||
return stream;
|
||||
|
||||
char path[PATH_LEN];
|
||||
sprintf(path, "%s.pp", name);
|
||||
stream = _sset.openFile(path);
|
||||
stream = _sset.createReadStreamForMember(path);
|
||||
if (stream)
|
||||
return new PowerPackerStream(*stream);
|
||||
|
||||
sprintf(path, "%s.dd", name);
|
||||
stream = _sset.openFile(path);
|
||||
stream = _sset.createReadStreamForMember(path);
|
||||
if (stream)
|
||||
return new PowerPackerStream(*stream);
|
||||
|
||||
|
@ -167,7 +167,7 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte
|
||||
}
|
||||
|
||||
/* get file size */
|
||||
fi.file = SearchMan.openFile(_fileName);
|
||||
fi.file = SearchMan.createReadStreamForMember(_fileName);
|
||||
if (!fi.file) {
|
||||
error("Cannot open file %s", _fileName.c_str());
|
||||
}
|
||||
|
@ -1010,7 +1010,7 @@ void ScummEngine_v60he::o60_openFile() {
|
||||
// TODO / FIXME: Consider using listSavefiles to avoid unneccessary openForLoading calls
|
||||
_hInFileTable[slot] = _saveFileMan->openForLoading(filename);
|
||||
if (_hInFileTable[slot] == 0) {
|
||||
_hInFileTable[slot] = SearchMan.openFile(filename);
|
||||
_hInFileTable[slot] = SearchMan.createReadStreamForMember(filename);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
@ -72,7 +72,7 @@ bool DXAPlayer::loadFile(const char *fileName) {
|
||||
|
||||
closeFile();
|
||||
|
||||
_fileStream = SearchMan.openFile(fileName);
|
||||
_fileStream = SearchMan.createReadStreamForMember(fileName);
|
||||
if (!_fileStream)
|
||||
return false;
|
||||
|
||||
|
@ -66,7 +66,7 @@ int32 FlicPlayer::getFrameCount() {
|
||||
bool FlicPlayer::loadFile(const char *fileName) {
|
||||
closeFile();
|
||||
|
||||
_fileStream = SearchMan.openFile(fileName);
|
||||
_fileStream = SearchMan.createReadStreamForMember(fileName);
|
||||
if (!_fileStream)
|
||||
return false;
|
||||
|
||||
|
@ -356,7 +356,7 @@ bool SMKPlayer::loadFile(const char *fileName) {
|
||||
|
||||
closeFile();
|
||||
|
||||
_fileStream = SearchMan.openFile(fileName);
|
||||
_fileStream = SearchMan.createReadStreamForMember(fileName);
|
||||
if (!_fileStream)
|
||||
return false;
|
||||
|
||||
|
@ -580,7 +580,7 @@ bool ThemeEngine::addBitmap(const Common::String &filename) {
|
||||
// If not, try to load the bitmap via the ImageDecoder class.
|
||||
surf = Graphics::ImageDecoder::loadFile(filename);
|
||||
if (!surf && _themeArchive) {
|
||||
Common::SeekableReadStream *stream = _themeArchive->openFile(filename);
|
||||
Common::SeekableReadStream *stream = _themeArchive->createReadStreamForMember(filename);
|
||||
if (stream) {
|
||||
surf = Graphics::ImageDecoder::loadFile(*stream);
|
||||
delete stream;
|
||||
@ -1243,7 +1243,7 @@ const Graphics::Font *ThemeEngine::loadFontFromArchive(const Common::String &fil
|
||||
const Graphics::Font *font = 0;
|
||||
|
||||
if (_themeArchive)
|
||||
stream = _themeArchive->openFile(filename);
|
||||
stream = _themeArchive->createReadStreamForMember(filename);
|
||||
if (stream) {
|
||||
font = Graphics::NewFont::loadFromCache(*stream);
|
||||
delete stream;
|
||||
|
Loading…
Reference in New Issue
Block a user