[Scummvm-cvs-logs] SF.net SVN: scummvm:[47994] scummvm/trunk

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Feb 8 17:14:04 CET 2010


Revision: 47994
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47994&view=rev
Author:   peres001
Date:     2010-02-08 16:14:04 +0000 (Mon, 08 Feb 2010)

Log Message:
-----------
Let ArjFile return a SeekableReadStream instead of implementing
the same interface itself. The caller is now responsible for
deleting the returned streams.

Modified Paths:
--------------
    scummvm/trunk/common/unarj.cpp
    scummvm/trunk/common/unarj.h
    scummvm/trunk/engines/drascula/converse.cpp
    scummvm/trunk/engines/drascula/drascula.cpp
    scummvm/trunk/engines/drascula/drascula.h
    scummvm/trunk/engines/drascula/graphics.cpp
    scummvm/trunk/engines/drascula/rooms.cpp
    scummvm/trunk/engines/drascula/sound.cpp

Modified: scummvm/trunk/common/unarj.cpp
===================================================================
--- scummvm/trunk/common/unarj.cpp	2010-02-08 16:13:31 UTC (rev 47993)
+++ scummvm/trunk/common/unarj.cpp	2010-02-08 16:14:04 UTC (rev 47994)
@@ -189,14 +189,12 @@
 	return CRC ^ 0xFFFFFFFF;
 }
 
-ArjFile::ArjFile() : _uncompressed(0) {
+ArjFile::ArjFile() {
 	InitCRC();
 	_fallBack = false;
 }
 
 ArjFile::~ArjFile() {
-	close();
-
 	for (uint i = 0; i < _headers.size(); i++)
 		delete _headers[i];
 }
@@ -346,18 +344,14 @@
 }
 
 
-bool ArjFile::open(const Common::String &filename) {
-	if (_uncompressed)
-		error("Attempt to open another instance of archive");
+SeekableReadStream *ArjFile::open(const Common::String &filename) {
 
-	if (_fallBack) {
-		_uncompressed = SearchMan.createReadStreamForMember(filename);
-		if (_uncompressed)
-			return true;
+	if (_fallBack && SearchMan.hasFile(filename)) {
+		return SearchMan.createReadStreamForMember(filename);
 	}
 
 	if (!_fileMap.contains(filename))
-		return false;
+		return 0;
 
 	ArjHeader *hdr = _headers[_fileMap[filename]];
 
@@ -390,43 +384,10 @@
 		delete decoder;
 	}
 
-
-	_uncompressed = new MemoryReadStream(uncompressedData, hdr->origSize, DisposeAfterUse::YES);
-	assert(_uncompressed);
-
-	return true;
+	return new MemoryReadStream(uncompressedData, hdr->origSize, true);
 }
 
-void ArjFile::close() {
-	delete _uncompressed;
-	_uncompressed = NULL;
-}
 
-uint32 ArjFile::read(void *dataPtr, uint32 dataSize) {
-	assert(_uncompressed);
-	return _uncompressed->read(dataPtr, dataSize);
-}
-
-bool ArjFile::eos() const {
-	assert(_uncompressed);
-	return _uncompressed->eos();
-}
-
-int32 ArjFile::pos() const {
-	assert(_uncompressed);
-	return _uncompressed->pos();
-}
-
-int32 ArjFile::size() const {
-	assert(_uncompressed);
-	return _uncompressed->size();
-}
-
-bool ArjFile::seek(int32 offset, int whence) {
-	assert(_uncompressed);
-	return _uncompressed->seek(offset, whence);
-}
-
 //
 // Source for init_getbits: arj_file.c (decode_start_stub)
 //

Modified: scummvm/trunk/common/unarj.h
===================================================================
--- scummvm/trunk/common/unarj.h	2010-02-08 16:13:31 UTC (rev 47993)
+++ scummvm/trunk/common/unarj.h	2010-02-08 16:14:04 UTC (rev 47994)
@@ -37,7 +37,7 @@
 
 // TODO: Get rid of this class, by implementing an ArjArchive subclass of Common::Archive.
 // Then ArjFile can be substituted by a SearchSet full of ArjArchives plus SearchMan.
-class ArjFile : public SeekableReadStream, public NonCopyable {
+class ArjFile : public NonCopyable {
 public:
 	ArjFile();
 	~ArjFile();
@@ -46,24 +46,14 @@
 
 	void registerArchive(const String &filename);
 
-	bool open(const Common::String &filename);
-	void close();
+	SeekableReadStream *open(const Common::String &filename);
 
-	uint32 read(void *dataPtr, uint32 dataSize);
-	bool eos() const;
-	int32 pos() const;
-	int32 size() const;
-	bool seek(int32 offset, int whence = SEEK_SET);
-	bool isOpen() { return _uncompressed != 0; }
-
 private:
 	bool _fallBack;
 
 	Array<ArjHeader *> _headers;
 	ArjFilesMap _fileMap;
 	StringMap _archMap;
-
-	SeekableReadStream *_uncompressed;
 };
 
 } // End of namespace Common

Modified: scummvm/trunk/engines/drascula/converse.cpp
===================================================================
--- scummvm/trunk/engines/drascula/converse.cpp	2010-02-08 16:13:31 UTC (rev 47993)
+++ scummvm/trunk/engines/drascula/converse.cpp	2010-02-08 16:14:04 UTC (rev 47994)
@@ -133,11 +133,11 @@
 void DrasculaEngine::converse(int index) {
 	char fileName[20];
 	sprintf(fileName, "op_%d.cal", index);
-	_arj.open(fileName);
-	if (!_arj.isOpen())
+	Common::SeekableReadStream *stream = _arj.open(fileName);
+	if (!stream)
 		error("missing data file %s", fileName);
 
-	int size = _arj.size();
+	int size = stream->size();
 	int game1 = kDialogOptionUnselected,
 		game2 = kDialogOptionUnselected,
 		game3 = kDialogOptionUnselected;
@@ -150,19 +150,19 @@
 
 	selectVerb(kVerbNone);
 
-	getStringFromLine(_arj, size, phrase1);
-	getStringFromLine(_arj, size, phrase2);
-	getStringFromLine(_arj, size, phrase3);
-	getStringFromLine(_arj, size, phrase4);
-	getStringFromLine(_arj, size, sound1);
-	getStringFromLine(_arj, size, sound2);
-	getStringFromLine(_arj, size, sound3);
-	getStringFromLine(_arj, size, sound4);
-	getIntFromLine(_arj, size, &answer1);
-	getIntFromLine(_arj, size, &answer2);
-	getIntFromLine(_arj, size, &answer3);
+	getStringFromLine(stream, size, phrase1);
+	getStringFromLine(stream, size, phrase2);
+	getStringFromLine(stream, size, phrase3);
+	getStringFromLine(stream, size, phrase4);
+	getStringFromLine(stream, size, sound1);
+	getStringFromLine(stream, size, sound2);
+	getStringFromLine(stream, size, sound3);
+	getStringFromLine(stream, size, sound4);
+	getIntFromLine(stream, size, &answer1);
+	getIntFromLine(stream, size, &answer2);
+	getIntFromLine(stream, size, &answer3);
 
-	_arj.close();
+	delete stream;
 
 	if (currentChapter == 2 && !strcmp(fileName, "op_5.cal") && flags[38] == 1 && flags[33] == 1) {
 		strcpy(phrase3, _text[405]);

Modified: scummvm/trunk/engines/drascula/drascula.cpp
===================================================================
--- scummvm/trunk/engines/drascula/drascula.cpp	2010-02-08 16:13:31 UTC (rev 47993)
+++ scummvm/trunk/engines/drascula/drascula.cpp	2010-02-08 16:14:04 UTC (rev 47994)
@@ -604,15 +604,15 @@
 	}
 }
 
-char *DrasculaEngine::getLine(Common::SeekableReadStream &stream, char *buf, int len) {
+char *DrasculaEngine::getLine(Common::SeekableReadStream *stream, char *buf, int len) {
 	byte c;
 	char *b;
 
 	for (;;) {
 		b = buf;
 		while (true) {
-			c = ~stream.readByte();
-			if (stream.eos()) break;
+			c = ~stream->readByte();
+			if (stream->eos()) break;
 
 			if (c == '\r')
 				continue;
@@ -621,7 +621,7 @@
 			*b++ = c;
 		}
 		*b = '\0';
-		if (stream.eos() && b == buf)
+		if (stream->eos() && b == buf)
 			return NULL;
 		if (b != buf)
 			break;
@@ -629,13 +629,13 @@
 	return buf;
 }
 
-void DrasculaEngine::getIntFromLine(Common::SeekableReadStream &stream, int len, int* result) {
+void DrasculaEngine::getIntFromLine(Common::SeekableReadStream *stream, int len, int* result) {
 	char buf[256];
 	getLine(stream, buf, len);
 	sscanf(buf, "%d", result);
 }
 
-void DrasculaEngine::getStringFromLine(Common::SeekableReadStream &stream, int len, char* result) {
+void DrasculaEngine::getStringFromLine(Common::SeekableReadStream *stream, int len, char* result) {
 	char buf[256];
 	getLine(stream, buf, len);
 	sscanf(buf, "%s", result);

Modified: scummvm/trunk/engines/drascula/drascula.h
===================================================================
--- scummvm/trunk/engines/drascula/drascula.h	2010-02-08 16:13:31 UTC (rev 47993)
+++ scummvm/trunk/engines/drascula/drascula.h	2010-02-08 16:14:04 UTC (rev 47994)
@@ -541,8 +541,8 @@
 	void mixVideo(byte *OldScreen, byte *NewScreen);
 	void decodeRLE(byte *BufferRLE, byte *MiVideoRLE);
 	void decodeOffset(byte *BufferOFF, byte *MiVideoOFF, int length);
-	byte *TryInMem(Common::SeekableReadStream &stream);
-	int playFrameSSN(Common::SeekableReadStream &stream);
+	byte *TryInMem(Common::SeekableReadStream *stream);
+	int playFrameSSN(Common::SeekableReadStream *stream);
 
 	bool _useMemForArj;
 	byte CHUNK;
@@ -553,7 +553,7 @@
 
 	int flag_tv;
 
-	void showFrame(Common::SeekableReadStream &stream, bool firstFrame = false);
+	void showFrame(Common::SeekableReadStream *stream, bool firstFrame = false);
 	int getTime();
 	void reduce_hare_chico(int, int, int, int, int, int, int, byte *, byte *);
 	void quadrant_1();
@@ -577,9 +577,9 @@
 	void MusicFadeout();
 	void playFile(const char *fname);
 
-	char *getLine(Common::SeekableReadStream &stream, char *buf, int len);
-	void getIntFromLine(Common::SeekableReadStream &stream, int len, int* result);
-	void getStringFromLine(Common::SeekableReadStream &stream, int len, char* result);
+	char *getLine(Common::SeekableReadStream *stream, char *buf, int len);
+	void getIntFromLine(Common::SeekableReadStream *stream, int len, int* result);
+	void getStringFromLine(Common::SeekableReadStream *stream, int len, char* result);
 
 	void grr();
 	void updateAnim(int y, int destX, int destY, int width, int height, int count, byte* src, int delayVal = 3, bool copyRectangle = false);

Modified: scummvm/trunk/engines/drascula/graphics.cpp
===================================================================
--- scummvm/trunk/engines/drascula/graphics.cpp	2010-02-08 16:13:31 UTC (rev 47993)
+++ scummvm/trunk/engines/drascula/graphics.cpp	2010-02-08 16:14:04 UTC (rev 47994)
@@ -93,39 +93,39 @@
 	uint dataSize = 0;
 	byte *pcxData;
 
-	_arj.open(NamePcc);
-	if (!_arj.isOpen())
+	Common::SeekableReadStream *stream = _arj.open(NamePcc);
+	if (!stream)
 		error("missing game data %s %c", NamePcc, 7);
 
-	dataSize = _arj.size() - 128 - (256 * 3);
+	dataSize = stream->size() - 128 - (256 * 3);
 	pcxData = (byte *)malloc(dataSize);
 
-	_arj.seek(128, SEEK_SET);
-	_arj.read(pcxData, dataSize);
+	stream->seek(128, SEEK_SET);
+	stream->read(pcxData, dataSize);
 
 	decodeRLE(pcxData, targetSurface);
 	free(pcxData);
 
 	for (int i = 0; i < 256; i++) {
-		cPal[i * 3 + 0] = _arj.readByte();
-		cPal[i * 3 + 1] = _arj.readByte();
-		cPal[i * 3 + 2] = _arj.readByte();
+		cPal[i * 3 + 0] = stream->readByte();
+		cPal[i * 3 + 1] = stream->readByte();
+		cPal[i * 3 + 2] = stream->readByte();
 	}
 
-	_arj.close();
+	delete stream;
 
 	setRGB((byte *)cPal, colorCount);
 }
 
-void DrasculaEngine::showFrame(Common::SeekableReadStream &stream, bool firstFrame) {
-	int dataSize = stream.readSint32LE();
+void DrasculaEngine::showFrame(Common::SeekableReadStream *stream, bool firstFrame) {
+	int dataSize = stream->readSint32LE();
 	byte *pcxData = (byte *)malloc(dataSize);
-	stream.read(pcxData, dataSize);
+	stream->read(pcxData, dataSize);
 
 	for (int i = 0; i < 256; i++) {
-		cPal[i * 3 + 0] = stream.readByte();
-		cPal[i * 3 + 1] = stream.readByte();
-		cPal[i * 3 + 2] = stream.readByte();
+		cPal[i * 3 + 0] = stream->readByte();
+		cPal[i * 3 + 1] = stream->readByte();
+		cPal[i * 3 + 2] = stream->readByte();
 	}
 
 	byte *prevFrame = (byte *)malloc(64000);
@@ -388,12 +388,12 @@
 	ghost = (byte *)malloc(65536);
 
 	// carga_ghost();
-	_arj.open("ghost.drv");
-	if (!_arj.isOpen())
+	Common::SeekableReadStream *stream = _arj.open("ghost.drv");
+	if (!stream)
 		error("Cannot open file ghost.drv");
 
-	_arj.read(ghost, 65536);
-	_arj.close();
+	stream->read(ghost, 65536);
+	delete stream;
 
 	updateEvents();
 	xr = mouseX;
@@ -477,14 +477,14 @@
 	globalSpeed = 1000 / vel;
 	FrameSSN = 0;
 	_useMemForArj = false;
-	_arj.open(filefli);
+	Common::SeekableReadStream *stream = _arj.open(filefli);
 	// TODO: mSession is treated like a stream from playFrameSSN, so turn it
 	// into a stream, and pass it to playFrameSSN. Get rid of _useMemForArj
 	// as well.
-	mSession = TryInMem(_arj);
+	mSession = TryInMem(stream);
 	LastFrame = _system->getMillis();
 
-	while (playFrameSSN(_arj) && (!term_int)) {
+	while (playFrameSSN(stream) && (!term_int)) {
 		if (getScan() == Common::KEYCODE_ESCAPE)
 			term_int = 1;
 	}
@@ -492,16 +492,16 @@
 	if (_useMemForArj)
 		free(memPtr);
 
-	_arj.close();
+	delete stream;
 }
 
-int DrasculaEngine::playFrameSSN(Common::SeekableReadStream &stream) {
+int DrasculaEngine::playFrameSSN(Common::SeekableReadStream *stream) {
 	int Exit = 0;
 	uint32 length;
 	byte *BufferSSN;
 
 	if (!_useMemForArj)
-		CHUNK = stream.readByte();
+		CHUNK = stream->readByte();
 	else {
 		memcpy(&CHUNK, mSession, 1);
 		mSession += 1;
@@ -511,9 +511,9 @@
 	case kFrameSetPal:
 		if (!_useMemForArj) {
 			for (int i = 0; i < 256; i++) {
-				dacSSN[i * 3 + 0] = stream.readByte();
-				dacSSN[i * 3 + 1] = stream.readByte();
-				dacSSN[i * 3 + 2] = stream.readByte();
+				dacSSN[i * 3 + 0] = stream->readByte();
+				dacSSN[i * 3 + 1] = stream->readByte();
+				dacSSN[i * 3 + 2] = stream->readByte();
 			}
 		} else {
 			memcpy(dacSSN, mSession, 768);
@@ -526,8 +526,8 @@
 		break;
 	case kFrameInit:
 		if (!_useMemForArj) {
-			CMP = stream.readByte();
-			length = stream.readUint32LE();
+			CMP = stream->readByte();
+			length = stream->readUint32LE();
 		} else {
 			memcpy(&CMP, mSession, 1);
 			mSession += 1;
@@ -537,7 +537,7 @@
 		if (CMP == kFrameCmpRle) {
 			BufferSSN = (byte *)malloc(length);
 			if (!_useMemForArj) {
-				stream.read(BufferSSN, length);
+				stream->read(BufferSSN, length);
 			} else {
 				memcpy(BufferSSN, mSession, length);
 				mSession += length;
@@ -559,7 +559,7 @@
 			if (CMP == kFrameCmpOff) {
 				BufferSSN = (byte *)malloc(length);
 				if (!_useMemForArj) {
-					stream.read(BufferSSN, length);
+					stream->read(BufferSSN, length);
 				} else {
 					memcpy(BufferSSN, mSession, length);
 					mSession += length;
@@ -590,16 +590,16 @@
 	return (!Exit);
 }
 
-byte *DrasculaEngine::TryInMem(Common::SeekableReadStream &stream) {
+byte *DrasculaEngine::TryInMem(Common::SeekableReadStream *stream) {
 	int length;
 
-	stream.seek(0, SEEK_END);
-	length = stream.pos();
-	stream.seek(0, SEEK_SET);
+	stream->seek(0, SEEK_END);
+	length = stream->pos();
+	stream->seek(0, SEEK_SET);
 	memPtr = (byte *)malloc(length);
 	if (memPtr == NULL)
 		return NULL;
-	stream.read(memPtr, length);
+	stream->read(memPtr, length);
 	_useMemForArj = true;
 
 	return memPtr;
@@ -660,17 +660,17 @@
 	int NFrames = 1;
 	int cnt = 2;
 
-	_arj.open(animationFile);
+	Common::SeekableReadStream *stream = _arj.open(animationFile);
 
-	if (!_arj.isOpen()) {
+	if (!stream) {
 		error("Animation file %s not found", animationFile);
 	}
 
-	NFrames = _arj.readSint32LE();
-	showFrame(_arj, true);
+	NFrames = stream->readSint32LE();
+	showFrame(stream, true);
 	_system->delayMillis(1000 / FPS);
 	while (cnt < NFrames) {
-		showFrame(_arj);
+		showFrame(stream);
 		_system->delayMillis(1000 / FPS);
 		cnt++;
 		byte key = getScan();
@@ -679,7 +679,7 @@
 		if (key != 0)
 			break;
 	}
-	_arj.close();
+	delete stream;
 
 	return ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE));
 }

Modified: scummvm/trunk/engines/drascula/rooms.cpp
===================================================================
--- scummvm/trunk/engines/drascula/rooms.cpp	2010-02-08 16:13:31 UTC (rev 47993)
+++ scummvm/trunk/engines/drascula/rooms.cpp	2010-02-08 16:14:04 UTC (rev 47994)
@@ -1649,69 +1649,69 @@
 
 	strcpy(currentData, fileName);
 
-	_arj.open(fileName);
-	if (!_arj.isOpen()) {
+	Common::SeekableReadStream *stream = _arj.open(fileName);
+	if (!stream) {
 		error("missing data file %s", fileName);
 	}
-	int size = _arj.size();
+	int size = stream->size();
 
-	getIntFromLine(_arj, size, &roomNumber);
-	getIntFromLine(_arj, size, &roomMusic);
-	getStringFromLine(_arj, size, roomDisk);
-	getIntFromLine(_arj, size, &palLevel);
+	getIntFromLine(stream, size, &roomNumber);
+	getIntFromLine(stream, size, &roomMusic);
+	getStringFromLine(stream, size, roomDisk);
+	getIntFromLine(stream, size, &palLevel);
 
 	if (currentChapter == 2)
-		getIntFromLine(_arj, size, &martin);
+		getIntFromLine(stream, size, &martin);
 
 	if (currentChapter == 2 && martin != 0) {
 		curWidth = martin;
-		getIntFromLine(_arj, size, &curHeight);
-		getIntFromLine(_arj, size, &feetHeight);
-		getIntFromLine(_arj, size, &stepX);
-		getIntFromLine(_arj, size, &stepY);
+		getIntFromLine(stream, size, &curHeight);
+		getIntFromLine(stream, size, &feetHeight);
+		getIntFromLine(stream, size, &stepX);
+		getIntFromLine(stream, size, &stepY);
 
-		getStringFromLine(_arj, size, pant1);
-		getStringFromLine(_arj, size, pant2);
-		getStringFromLine(_arj, size, pant3);
-		getStringFromLine(_arj, size, pant4);
+		getStringFromLine(stream, size, pant1);
+		getStringFromLine(stream, size, pant2);
+		getStringFromLine(stream, size, pant3);
+		getStringFromLine(stream, size, pant4);
 
 		strcpy(menuBackground, pant4);
 	}
 
-	getIntFromLine(_arj, size, &numRoomObjs);
+	getIntFromLine(stream, size, &numRoomObjs);
 
 	for (l = 0; l < numRoomObjs; l++) {
-		getIntFromLine(_arj, size, &objectNum[l]);
-		getStringFromLine(_arj, size, objName[l]);
-		getIntFromLine(_arj, size, &x1[l]);
-		getIntFromLine(_arj, size, &y1[l]);
-		getIntFromLine(_arj, size, &x2[l]);
-		getIntFromLine(_arj, size, &y2[l]);
-		getIntFromLine(_arj, size, &roomObjX[l]);
-		getIntFromLine(_arj, size, &roomObjY[l]);
-		getIntFromLine(_arj, size, &trackObj[l]);
-		getIntFromLine(_arj, size, &visible[l]);
-		getIntFromLine(_arj, size, &isDoor[l]);
+		getIntFromLine(stream, size, &objectNum[l]);
+		getStringFromLine(stream, size, objName[l]);
+		getIntFromLine(stream, size, &x1[l]);
+		getIntFromLine(stream, size, &y1[l]);
+		getIntFromLine(stream, size, &x2[l]);
+		getIntFromLine(stream, size, &y2[l]);
+		getIntFromLine(stream, size, &roomObjX[l]);
+		getIntFromLine(stream, size, &roomObjY[l]);
+		getIntFromLine(stream, size, &trackObj[l]);
+		getIntFromLine(stream, size, &visible[l]);
+		getIntFromLine(stream, size, &isDoor[l]);
 		if (isDoor[l] != 0) {
-			getStringFromLine(_arj, size, _targetSurface[l]);
-			getIntFromLine(_arj, size, &_destX[l]);
-			getIntFromLine(_arj, size, &_destY[l]);
-			getIntFromLine(_arj, size, &trackCharacter_alkeva[l]);
-			getIntFromLine(_arj, size, &roomExits[l]);
+			getStringFromLine(stream, size, _targetSurface[l]);
+			getIntFromLine(stream, size, &_destX[l]);
+			getIntFromLine(stream, size, &_destY[l]);
+			getIntFromLine(stream, size, &trackCharacter_alkeva[l]);
+			getIntFromLine(stream, size, &roomExits[l]);
 			updateDoor(l);
 		}
 	}
 
-	getIntFromLine(_arj, size, &floorX1);
-	getIntFromLine(_arj, size, &floorY1);
-	getIntFromLine(_arj, size, &floorX2);
-	getIntFromLine(_arj, size, &floorY2);
+	getIntFromLine(stream, size, &floorX1);
+	getIntFromLine(stream, size, &floorY1);
+	getIntFromLine(stream, size, &floorX2);
+	getIntFromLine(stream, size, &floorY2);
 
 	if (currentChapter != 2) {
-		getIntFromLine(_arj, size, &upperLimit);
-		getIntFromLine(_arj, size, &lowerLimit);
+		getIntFromLine(stream, size, &upperLimit);
+		getIntFromLine(stream, size, &lowerLimit);
 	}
-	_arj.close();
+	delete stream;
 
 	if (currentChapter == 2 && martin != 0) {
 		loadPic(pant2, extraSurface);

Modified: scummvm/trunk/engines/drascula/sound.cpp
===================================================================
--- scummvm/trunk/engines/drascula/sound.cpp	2010-02-08 16:13:31 UTC (rev 47993)
+++ scummvm/trunk/engines/drascula/sound.cpp	2010-02-08 16:14:04 UTC (rev 47994)
@@ -163,23 +163,24 @@
 }
 
 void DrasculaEngine::playFile(const char *fname) {
-	if (_arj.open(fname)) {
-		int soundSize = _arj.size();
+	Common::SeekableReadStream *stream = _arj.open(fname);
+	if (stream) {
+		int soundSize = stream->size();
 		byte *soundData = (byte *)malloc(soundSize);
 
 		if (!(!strcmp(fname, "3.als") && soundSize == 145166 && _lang != kSpanish)) {
-			_arj.seek(32);
+			stream->seek(32);
 		} else {
 			// WORKAROUND: File 3.als with English speech files has a big silence at
 			// its beginning and end. We seek past the silence at the beginning,
 			// and ignore the silence at the end
 			// Fixes bug #2111815 - "DRASCULA: Voice delayed"
-			_arj.seek(73959, SEEK_SET);
+			stream->seek(73959, SEEK_SET);
 			soundSize = 117158 - 73959;
 		}
 
-		_arj.read(soundData, soundSize);
-		_arj.close();
+		stream->read(soundData, soundSize);
+		delete stream;
 
 		_subtitlesDisabled = !ConfMan.getBool("subtitles");
 		if (ConfMan.getBool("speech_mute"))


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list