diff options
author | Travis Howell | 2011-09-25 10:32:20 +1000 |
---|---|---|
committer | Travis Howell | 2011-09-25 10:32:20 +1000 |
commit | 460c4eca26fa4578dc5fccf45279aa59a950d0f4 (patch) | |
tree | 7405572c54a5235d127b7fbc018d3619df48c092 | |
parent | 1b4f9f063c533984fa87031a7ec22f8ecb2398cf (diff) | |
download | scummvm-rg350-460c4eca26fa4578dc5fccf45279aa59a950d0f4.tar.gz scummvm-rg350-460c4eca26fa4578dc5fccf45279aa59a950d0f4.tar.bz2 scummvm-rg350-460c4eca26fa4578dc5fccf45279aa59a950d0f4.zip |
AGOS: Fix loading VGA files from InstallShield cab file.
-rw-r--r-- | engines/agos/res.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp index 0baae11e89..69447f4b83 100644 --- a/engines/agos/res.cpp +++ b/engines/agos/res.cpp @@ -799,7 +799,7 @@ void AGOSEngine::loadVGABeardFile(uint16 id) { uint32 offs, size; if (getFeatures() & GF_OLD_BUNDLE) { - Common::File in; + Common::SeekableReadStream *in; char filename[15]; if (id == 23) id = 112; @@ -815,22 +815,22 @@ void AGOSEngine::loadVGABeardFile(uint16 id) { sprintf(filename, "0%d.VGA", id); } - in.open(filename); - if (in.isOpen() == false) + in = _archives.open(filename); + if (!in) 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"); } - in.close(); + delete in; } else { offs = _gameOffsetsPtr[id]; @@ -840,7 +840,7 @@ void AGOSEngine::loadVGABeardFile(uint16 id) { } void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { - Common::File in; + Common::SeekableReadStream *in; char filename[15]; byte *dst; uint32 file, offs, srcSize, dstSize; @@ -893,8 +893,8 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { } } - in.open(filename); - if (in.isOpen() == false) { + in = _archives.open(filename); + if (!in) { if (useError) error("loadVGAVideoFile: Can't load %s", filename); @@ -902,11 +902,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::kPlatformPC && 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<uint32> data; @@ -914,7 +914,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); @@ -928,7 +928,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); @@ -937,10 +937,10 @@ 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"); } - in.close(); + delete in; } else { id = id * 2 + (type - 1); offs = _gameOffsetsPtr[id]; |