mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 05:38:56 +00:00
Checking for the file's existence in DataIO::getDataStream()
svn-id: r41837
This commit is contained in:
parent
483c3a51c3
commit
53c4e66b71
@ -585,6 +585,9 @@ byte *DataIO::getData(const char *path) {
|
||||
}
|
||||
|
||||
DataStream *DataIO::getDataStream(const char *path) {
|
||||
if (!path || (path[0] == '\0') || !existData(path))
|
||||
return 0;
|
||||
|
||||
uint32 size = getDataSize(path);
|
||||
byte *data = getData(path);
|
||||
|
||||
|
@ -508,10 +508,9 @@ uint16 Script::getFunctionOffset(uint8 function) const {
|
||||
}
|
||||
|
||||
uint32 Script::getVariablesCount(const char *fileName, GobEngine *vm) {
|
||||
if (!vm->_dataIO->existData(fileName))
|
||||
return 0;
|
||||
|
||||
DataStream *stream = vm->_dataIO->getDataStream(fileName);
|
||||
if (!stream)
|
||||
return 0;
|
||||
|
||||
stream->seek(0x2C);
|
||||
uint32 variablesCount = stream->readUint32LE();
|
||||
|
@ -44,9 +44,11 @@ TOTFile::~TOTFile() {
|
||||
}
|
||||
|
||||
bool TOTFile::load(const Common::String &fileName) {
|
||||
if (_vm->_dataIO->existData(fileName.c_str()))
|
||||
_stream = _vm->_dataIO->getDataStream(fileName.c_str());
|
||||
else
|
||||
// Trying to open normally
|
||||
_stream = _vm->_dataIO->getDataStream(fileName.c_str());
|
||||
|
||||
if (!_stream)
|
||||
// Trying to open from video video
|
||||
_stream = _vm->_vidPlayer->getExtraData(fileName.c_str());
|
||||
|
||||
if (!_stream)
|
||||
|
Loading…
Reference in New Issue
Block a user