From e560dca6b1953d7266cad6cc6316fcd9e7303933 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 22 Jan 2014 00:14:26 +0100 Subject: AGOS: Slightly clean up ArchiveMan code. This removes the (always true) _fallBack flag which determined whether SearchMan should be searched. --- engines/agos/res.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'engines/agos/res.cpp') diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp index cf1d062d96..8b8f9265d9 100644 --- a/engines/agos/res.cpp +++ b/engines/agos/res.cpp @@ -39,7 +39,6 @@ namespace AGOS { ArchiveMan::ArchiveMan() { - _fallBack = true; } #ifdef ENABLE_AGOS2 @@ -52,24 +51,24 @@ void ArchiveMan::registerArchive(const Common::String &filename, int priority) { #endif bool ArchiveMan::hasFile(const Common::String &name) const { - if (_fallBack && SearchMan.hasFile(name)) + if (SearchMan.hasFile(name)) return true; return Common::SearchSet::hasFile(name); } int ArchiveMan::listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern) const { - const int matches = _fallBack ? SearchMan.listMatchingMembers(list, pattern) : 0; + const int matches = SearchMan.listMatchingMembers(list, pattern); return matches + Common::SearchSet::listMatchingMembers(list, pattern); } int ArchiveMan::listMembers(Common::ArchiveMemberList &list) const { - const int matches = _fallBack ? SearchMan.listMembers(list) : 0; + const int matches = SearchMan.listMembers(list); return matches + Common::SearchSet::listMembers(list); } const Common::ArchiveMemberPtr ArchiveMan::getMember(const Common::String &name) const { - Common::ArchiveMemberPtr ptr = _fallBack ? SearchMan.getMember(name) : Common::ArchiveMemberPtr(); + Common::ArchiveMemberPtr ptr = SearchMan.getMember(name); if (ptr) return ptr; @@ -77,7 +76,7 @@ const Common::ArchiveMemberPtr ArchiveMan::getMember(const Common::String &name) } Common::SeekableReadStream *ArchiveMan::createReadStreamForMember(const Common::String &filename) const { - if (_fallBack && SearchMan.hasFile(filename)) { + if (SearchMan.hasFile(filename)) { return SearchMan.createReadStreamForMember(filename); } -- cgit v1.2.3 From 1cee8439e70e26427ac5ff04f559016db99bf66b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 22 Jan 2014 00:30:28 +0100 Subject: AGOS: Get rid of ArchiveMan in favor of global SearchMan. This in fact slightly changes the priority order of added archives. Formerly, all archives in SearchMan were preferred to the customly added ones in ArchiveMan. All standard paths (i.e. path and extrapath) will be still be searched before the custom ones (which are all priority 0 right now) but system specific paths will be searched after (due to their priority being -1). Since system specific paths shouldn't contain any game data files this should hopefully be harmless. This wasn't tested for games with CAB archives. --- engines/agos/res.cpp | 66 ++++++++-------------------------------------------- 1 file changed, 10 insertions(+), 56 deletions(-) (limited to 'engines/agos/res.cpp') diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp index 8b8f9265d9..e474cf8acf 100644 --- a/engines/agos/res.cpp +++ b/engines/agos/res.cpp @@ -24,7 +24,6 @@ #include "common/archive.h" -#include "common/installshield_cab.h" #include "common/file.h" #include "common/memstream.h" #include "common/textconsole.h" @@ -38,51 +37,6 @@ namespace AGOS { -ArchiveMan::ArchiveMan() { -} - -#ifdef ENABLE_AGOS2 -void ArchiveMan::registerArchive(const Common::String &filename, int priority) { - Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(filename); - - if (stream) - add(filename, makeInstallShieldArchive(stream, DisposeAfterUse::YES), priority); -} -#endif - -bool ArchiveMan::hasFile(const Common::String &name) const { - if (SearchMan.hasFile(name)) - return true; - - return Common::SearchSet::hasFile(name); -} - -int ArchiveMan::listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern) const { - const int matches = SearchMan.listMatchingMembers(list, pattern); - return matches + Common::SearchSet::listMatchingMembers(list, pattern); -} - -int ArchiveMan::listMembers(Common::ArchiveMemberList &list) const { - const int matches = SearchMan.listMembers(list); - return matches + Common::SearchSet::listMembers(list); -} - -const Common::ArchiveMemberPtr ArchiveMan::getMember(const Common::String &name) const { - Common::ArchiveMemberPtr ptr = SearchMan.getMember(name); - if (ptr) - return ptr; - - return Common::SearchSet::getMember(name); -} - -Common::SeekableReadStream *ArchiveMan::createReadStreamForMember(const Common::String &filename) const { - if (SearchMan.hasFile(filename)) { - return SearchMan.createReadStreamForMember(filename); - } - - return Common::SearchSet::createReadStreamForMember(filename); -} - #ifdef ENABLE_AGOS2 uint16 AGOSEngine_Feeble::to16Wrapper(uint value) { return TO_LE_16(value); @@ -201,7 +155,7 @@ void AGOSEngine_PN::loadGamePcFile() { if (getFileName(GAME_BASEFILE) != NULL) { // Read dataBase - in = _archives.createReadStreamForMember(getFileName(GAME_BASEFILE)); + in = SearchMan.createReadStreamForMember(getFileName(GAME_BASEFILE)); if (!in) { error("loadGamePcFile: Can't load database file '%s'", getFileName(GAME_BASEFILE)); } @@ -219,7 +173,7 @@ void AGOSEngine_PN::loadGamePcFile() { if (getFileName(GAME_TEXTFILE) != NULL) { // Read textBase - in = _archives.createReadStreamForMember(getFileName(GAME_TEXTFILE)); + in = SearchMan.createReadStreamForMember(getFileName(GAME_TEXTFILE)); if (!in) { error("loadGamePcFile: Can't load textbase file '%s'", getFileName(GAME_TEXTFILE)); } @@ -242,7 +196,7 @@ void AGOSEngine::loadGamePcFile() { if (getFileName(GAME_BASEFILE) != NULL) { /* Read main gamexx file */ - in = _archives.createReadStreamForMember(getFileName(GAME_BASEFILE)); + in = SearchMan.createReadStreamForMember(getFileName(GAME_BASEFILE)); if (!in) { error("loadGamePcFile: Can't load gamexx file '%s'", getFileName(GAME_BASEFILE)); } @@ -268,7 +222,7 @@ void AGOSEngine::loadGamePcFile() { if (getFileName(GAME_TBLFILE) != NULL) { /* Read list of TABLE resources */ - in = _archives.createReadStreamForMember(getFileName(GAME_TBLFILE)); + in = SearchMan.createReadStreamForMember(getFileName(GAME_TBLFILE)); if (!in) { error("loadGamePcFile: Can't load table resources file '%s'", getFileName(GAME_TBLFILE)); } @@ -289,7 +243,7 @@ void AGOSEngine::loadGamePcFile() { if (getFileName(GAME_STRFILE) != NULL) { /* Read list of TEXT resources */ - in = _archives.createReadStreamForMember(getFileName(GAME_STRFILE)); + in = SearchMan.createReadStreamForMember(getFileName(GAME_STRFILE)); if (!in) error("loadGamePcFile: Can't load text resources file '%s'", getFileName(GAME_STRFILE)); @@ -303,7 +257,7 @@ void AGOSEngine::loadGamePcFile() { if (getFileName(GAME_STATFILE) != NULL) { /* Read list of ROOM STATE resources */ - in = _archives.createReadStreamForMember(getFileName(GAME_STATFILE)); + in = SearchMan.createReadStreamForMember(getFileName(GAME_STATFILE)); if (!in) { error("loadGamePcFile: Can't load state resources file '%s'", getFileName(GAME_STATFILE)); } @@ -326,7 +280,7 @@ void AGOSEngine::loadGamePcFile() { if (getFileName(GAME_RMSLFILE) != NULL) { /* Read list of ROOM ITEMS resources */ - in = _archives.createReadStreamForMember(getFileName(GAME_RMSLFILE)); + in = SearchMan.createReadStreamForMember(getFileName(GAME_RMSLFILE)); if (!in) { error("loadGamePcFile: Can't load room resources file '%s'", getFileName(GAME_RMSLFILE)); } @@ -342,7 +296,7 @@ void AGOSEngine::loadGamePcFile() { if (getFileName(GAME_XTBLFILE) != NULL) { /* Read list of XTABLE resources */ - in = _archives.createReadStreamForMember(getFileName(GAME_XTBLFILE)); + in = SearchMan.createReadStreamForMember(getFileName(GAME_XTBLFILE)); if (!in) { error("loadGamePcFile: Can't load xtable resources file '%s'", getFileName(GAME_XTBLFILE)); } @@ -843,7 +797,7 @@ void AGOSEngine::loadVGABeardFile(uint16 id) { sprintf(filename, "0%d.VGA", id); } - in = _archives.createReadStreamForMember(filename); + in = SearchMan.createReadStreamForMember(filename); if (!in) error("loadSimonVGAFile: Can't load %s", filename); @@ -921,7 +875,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { } } - in = _archives.createReadStreamForMember(filename); + in = SearchMan.createReadStreamForMember(filename); if (!in) { if (useError) error("loadVGAVideoFile: Can't load %s", filename); -- cgit v1.2.3 From 047df69407fabf19385012bf8e2ebb55906ba228 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 22 Jan 2014 00:53:21 +0100 Subject: AGOS: Use Common::File instead of SearchMan. This makes sure the hack from Common::File for filenames with a trailing dot is used as expected. --- engines/agos/res.cpp | 111 ++++++++++++++++++++++----------------------------- 1 file changed, 48 insertions(+), 63 deletions(-) (limited to 'engines/agos/res.cpp') diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp index e474cf8acf..1c79a073e8 100644 --- a/engines/agos/res.cpp +++ b/engines/agos/res.cpp @@ -151,39 +151,35 @@ int AGOSEngine::allocGamePcVars(Common::SeekableReadStream *in) { } void AGOSEngine_PN::loadGamePcFile() { - Common::SeekableReadStream *in; - if (getFileName(GAME_BASEFILE) != NULL) { + Common::File in; // Read dataBase - in = SearchMan.createReadStreamForMember(getFileName(GAME_BASEFILE)); - if (!in) { + if (!in.open(getFileName(GAME_BASEFILE))) { error("loadGamePcFile: Can't load database file '%s'", getFileName(GAME_BASEFILE)); } - _dataBaseSize = in->size(); + _dataBaseSize = in.size(); _dataBase = (byte *)malloc(_dataBaseSize); if (_dataBase == NULL) error("loadGamePcFile: Out of memory for dataBase"); - in->read(_dataBase, _dataBaseSize); - delete in; + in.read(_dataBase, _dataBaseSize); if (_dataBase[31] != 0) error("Later version of system requested"); } if (getFileName(GAME_TEXTFILE) != NULL) { + Common::File in; // Read textBase - in = SearchMan.createReadStreamForMember(getFileName(GAME_TEXTFILE)); - if (!in) { + if (!in.open(getFileName(GAME_TEXTFILE))) { error("loadGamePcFile: Can't load textbase file '%s'", getFileName(GAME_TEXTFILE)); } - _textBaseSize = in->size(); + _textBaseSize = in.size(); _textBase = (byte *)malloc(_textBaseSize); if (_textBase == NULL) error("loadGamePcFile: Out of memory for textBase"); - in->read(_textBase, _textBaseSize); - delete in; + in.read(_textBase, _textBaseSize); if (_textBase[getlong(30L)] != 128) error("Unknown compression format"); @@ -191,20 +187,19 @@ void AGOSEngine_PN::loadGamePcFile() { } void AGOSEngine::loadGamePcFile() { - Common::SeekableReadStream *in; int fileSize; if (getFileName(GAME_BASEFILE) != NULL) { /* Read main gamexx file */ - in = SearchMan.createReadStreamForMember(getFileName(GAME_BASEFILE)); - if (!in) { + Common::File in; + if (!in.open(getFileName(GAME_BASEFILE))) { error("loadGamePcFile: Can't load gamexx file '%s'", getFileName(GAME_BASEFILE)); } if (getFeatures() & GF_CRUNCHED_GAMEPC) { - uint srcSize = in->size(); + uint srcSize = in.size(); byte *srcBuf = (byte *)malloc(srcSize); - in->read(srcBuf, srcSize); + in.read(srcBuf, srcSize); uint dstSize = READ_BE_UINT32(srcBuf + srcSize - 4); byte *dstBuf = (byte *)malloc(dstSize); @@ -215,25 +210,23 @@ void AGOSEngine::loadGamePcFile() { readGamePcFile(&stream); free(dstBuf); } else { - readGamePcFile(in); + readGamePcFile(&in); } - delete in; } if (getFileName(GAME_TBLFILE) != NULL) { /* Read list of TABLE resources */ - in = SearchMan.createReadStreamForMember(getFileName(GAME_TBLFILE)); - if (!in) { + Common::File in; + if (!in.open(getFileName(GAME_TBLFILE))) { error("loadGamePcFile: Can't load table resources file '%s'", getFileName(GAME_TBLFILE)); } - fileSize = in->size(); + fileSize = in.size(); _tblList = (byte *)malloc(fileSize); if (_tblList == NULL) error("loadGamePcFile: Out of memory for strip table list"); - in->read(_tblList, fileSize); - delete in; + in.read(_tblList, fileSize); /* Remember the current state */ _subroutineListOrg = _subroutineList; @@ -243,71 +236,67 @@ void AGOSEngine::loadGamePcFile() { if (getFileName(GAME_STRFILE) != NULL) { /* Read list of TEXT resources */ - in = SearchMan.createReadStreamForMember(getFileName(GAME_STRFILE)); - if (!in) + Common::File in; + if (!in.open(getFileName(GAME_STRFILE))) error("loadGamePcFile: Can't load text resources file '%s'", getFileName(GAME_STRFILE)); - fileSize = in->size(); + fileSize = in.size(); _strippedTxtMem = (byte *)malloc(fileSize); if (_strippedTxtMem == NULL) error("loadGamePcFile: Out of memory for strip text list"); - in->read(_strippedTxtMem, fileSize); - delete in; + in.read(_strippedTxtMem, fileSize); } if (getFileName(GAME_STATFILE) != NULL) { /* Read list of ROOM STATE resources */ - in = SearchMan.createReadStreamForMember(getFileName(GAME_STATFILE)); - if (!in) { + Common::File in; + if (!in.open(getFileName(GAME_STATFILE))) { error("loadGamePcFile: Can't load state resources file '%s'", getFileName(GAME_STATFILE)); } - _numRoomStates = in->size() / 8; + _numRoomStates = in.size() / 8; _roomStates = (RoomState *)calloc(_numRoomStates, sizeof(RoomState)); if (_roomStates == NULL) error("loadGamePcFile: Out of memory for room state list"); for (uint s = 0; s < _numRoomStates; s++) { - uint16 num = in->readUint16BE() - (_itemArrayInited - 2); + uint16 num = in.readUint16BE() - (_itemArrayInited - 2); - _roomStates[num].state = in->readUint16BE(); - _roomStates[num].classFlags = in->readUint16BE(); - _roomStates[num].roomExitStates = in->readUint16BE(); + _roomStates[num].state = in.readUint16BE(); + _roomStates[num].classFlags = in.readUint16BE(); + _roomStates[num].roomExitStates = in.readUint16BE(); } - delete in; } if (getFileName(GAME_RMSLFILE) != NULL) { /* Read list of ROOM ITEMS resources */ - in = SearchMan.createReadStreamForMember(getFileName(GAME_RMSLFILE)); - if (!in) { + Common::File in; + if (!in.open(getFileName(GAME_RMSLFILE))) { error("loadGamePcFile: Can't load room resources file '%s'", getFileName(GAME_RMSLFILE)); } - fileSize = in->size(); + fileSize = in.size(); _roomsList = (byte *)malloc(fileSize); if (_roomsList == NULL) error("loadGamePcFile: Out of memory for room items list"); - in->read(_roomsList, fileSize); - delete in; + in.read(_roomsList, fileSize); } if (getFileName(GAME_XTBLFILE) != NULL) { /* Read list of XTABLE resources */ - in = SearchMan.createReadStreamForMember(getFileName(GAME_XTBLFILE)); - if (!in) { + Common::File in; + if (!in.open(getFileName(GAME_XTBLFILE))) { error("loadGamePcFile: Can't load xtable resources file '%s'", getFileName(GAME_XTBLFILE)); } - fileSize = in->size(); + fileSize = in.size(); _xtblList = (byte *)malloc(fileSize); if (_xtblList == NULL) error("loadGamePcFile: Out of memory for strip xtable list"); - in->read(_xtblList, fileSize); - delete in; + in.read(_xtblList, fileSize); /* Remember the current state */ _xsubroutineListOrg = _subroutineList; @@ -781,7 +770,7 @@ void AGOSEngine::loadVGABeardFile(uint16 id) { uint32 offs, size; if (getFeatures() & GF_OLD_BUNDLE) { - Common::SeekableReadStream *in; + Common::File in; char filename[15]; if (id == 23) id = 112; @@ -797,22 +786,20 @@ void AGOSEngine::loadVGABeardFile(uint16 id) { sprintf(filename, "0%d.VGA", id); } - in = SearchMan.createReadStreamForMember(filename); - if (!in) + if (!in.open(filename)) error("loadSimonVGAFile: Can't load %s", filename); - size = in->size(); + size = in.size(); if (getFeatures() & GF_CRUNCHED) { byte *srcBuffer = (byte *)malloc(size); - if (in->read(srcBuffer, size) != size) + if (in.read(srcBuffer, size) != size) error("loadSimonVGAFile: Read failed"); decrunchFile(srcBuffer, _vgaBufferPointers[11].vgaFile2, size); free(srcBuffer); } else { - if (in->read(_vgaBufferPointers[11].vgaFile2, size) != size) + if (in.read(_vgaBufferPointers[11].vgaFile2, size) != size) error("loadSimonVGAFile: Read failed"); } - delete in; } else { offs = _gameOffsetsPtr[id]; @@ -822,7 +809,7 @@ void AGOSEngine::loadVGABeardFile(uint16 id) { } void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { - Common::SeekableReadStream *in; + Common::File in; char filename[15]; byte *dst; uint32 file, offs, srcSize, dstSize; @@ -875,8 +862,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { } } - in = SearchMan.createReadStreamForMember(filename); - if (!in) { + if (!in.open(filename)) { if (useError) error("loadVGAVideoFile: Can't load %s", filename); @@ -884,11 +870,11 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { return; } - dstSize = srcSize = in->size(); + dstSize = srcSize = in.size(); if (getGameType() == GType_PN && getPlatform() == Common::kPlatformDOS && id == 17 && type == 2) { // The A2.out file isn't compressed in PC version of Personal Nightmare dst = allocBlock(dstSize + extraBuffer); - if (in->read(dst, dstSize) != dstSize) + if (in.read(dst, dstSize) != dstSize) error("loadVGAVideoFile: Read failed"); } else if (getGameType() == GType_PN && (getFeatures() & GF_CRUNCHED)) { Common::Stack data; @@ -896,7 +882,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { int dataOutSize = 0; for (uint i = 0; i < srcSize / 4; ++i) { - uint32 dataVal = in->readUint32BE(); + uint32 dataVal = in.readUint32BE(); // Correct incorrect byte, in corrupt 72.out file, included in some PC versions. if (dataVal == 168042714) data.push(168050906); @@ -910,7 +896,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { delete[] dataOut; } else if (getFeatures() & GF_CRUNCHED) { byte *srcBuffer = (byte *)malloc(srcSize); - if (in->read(srcBuffer, srcSize) != srcSize) + if (in.read(srcBuffer, srcSize) != srcSize) error("loadVGAVideoFile: Read failed"); dstSize = READ_BE_UINT32(srcBuffer + srcSize - 4); @@ -919,10 +905,9 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { free(srcBuffer); } else { dst = allocBlock(dstSize + extraBuffer); - if (in->read(dst, dstSize) != dstSize) + if (in.read(dst, dstSize) != dstSize) error("loadVGAVideoFile: Read failed"); } - delete in; } else { id = id * 2 + (type - 1); offs = _gameOffsetsPtr[id]; -- cgit v1.2.3 From c4fc0cee96ed4e287385fdb75d6c81f0d4a552dc Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 18 Feb 2014 02:34:17 +0100 Subject: AGOS: Make GPL headers consistent in themselves. --- engines/agos/res.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/agos/res.cpp') diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp index 1c79a073e8..e3e9d09f3b 100644 --- a/engines/agos/res.cpp +++ b/engines/agos/res.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -- cgit v1.2.3 From 41d46f07ef0f93c131644cd4dc3a00752df05c12 Mon Sep 17 00:00:00 2001 From: Kirben Date: Wed, 5 Mar 2014 09:17:54 +1100 Subject: AGOS: Correct typos in comments. --- engines/agos/res.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/agos/res.cpp') diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp index e3e9d09f3b..4d91d1a8e1 100644 --- a/engines/agos/res.cpp +++ b/engines/agos/res.cpp @@ -817,9 +817,9 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) && id == 2 && type == 2) { - // WORKAROUND: For the exta long strings in foreign languages + // WORKAROUND: For the extra long strings in foreign languages // Allocate more space for text to cope with foreign languages that use - // up more space than english. I hope 6400 bytes are enough. This number + // up more space than English. I hope 6400 bytes are enough. This number // is base on: 2 (lines) * 320 (screen width) * 10 (textheight) -- olki extraBuffer += 6400; } -- cgit v1.2.3 From a310feb8a562ddce2a45f4ae1b5b46206cdda692 Mon Sep 17 00:00:00 2001 From: Kirben Date: Thu, 6 Mar 2014 15:06:54 +1100 Subject: AGOS: Fix error when dumping all VGA scripts. --- engines/agos/res.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'engines/agos/res.cpp') diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp index 4d91d1a8e1..2631f7998e 100644 --- a/engines/agos/res.cpp +++ b/engines/agos/res.cpp @@ -802,7 +802,6 @@ void AGOSEngine::loadVGABeardFile(uint16 id) { } } else { offs = _gameOffsetsPtr[id]; - size = _gameOffsetsPtr[id + 1] - offs; readGameFile(_vgaBufferPointers[11].vgaFile2, offs, size); } @@ -911,8 +910,16 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { } else { id = id * 2 + (type - 1); offs = _gameOffsetsPtr[id]; - dstSize = _gameOffsetsPtr[id + 1] - offs; + + if (!dstSize) { + if (useError) + error("loadVGAVideoFile: Can't load id %d type %d", id, type); + + _block = _blockEnd = NULL; + return; + } + dst = allocBlock(dstSize + extraBuffer); readGameFile(dst, offs, dstSize); } -- cgit v1.2.3