[Scummvm-cvs-logs] scummvm master -> 460c4eca26fa4578dc5fccf45279aa59a950d0f4

Kirben kirben at optusnet.com.au
Sun Sep 25 02:39:11 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
460c4eca26 AGOS: Fix loading VGA files from InstallShield cab file.


Commit: 460c4eca26fa4578dc5fccf45279aa59a950d0f4
    https://github.com/scummvm/scummvm/commit/460c4eca26fa4578dc5fccf45279aa59a950d0f4
Author: Travis Howell (kirben at optusnet.com.au)
Date: 2011-09-24T17:32:20-07:00

Commit Message:
AGOS: Fix loading VGA files from InstallShield cab file.

Changed paths:
    engines/agos/res.cpp



diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp
index 0baae11..69447f4 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];






More information about the Scummvm-git-logs mailing list