[Scummvm-cvs-logs] SF.net SVN: scummvm:[54434] scummvm/trunk/engines/scumm

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Nov 23 23:25:12 CET 2010


Revision: 54434
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54434&view=rev
Author:   fingolfin
Date:     2010-11-23 22:25:10 +0000 (Tue, 23 Nov 2010)

Log Message:
-----------
SCUMM: Replace Common::File uses by SeekableReadStream and SearchMan

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/detection.cpp
    scummvm/trunk/engines/scumm/he/animation_he.h
    scummvm/trunk/engines/scumm/he/script_v72he.cpp
    scummvm/trunk/engines/scumm/he/script_v80he.cpp
    scummvm/trunk/engines/scumm/he/wiz_he.cpp
    scummvm/trunk/engines/scumm/imuse_digi/dimuse_bndmgr.cpp
    scummvm/trunk/engines/scumm/imuse_digi/dimuse_bndmgr.h
    scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
    scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.h

Modified: scummvm/trunk/engines/scumm/detection.cpp
===================================================================
--- scummvm/trunk/engines/scumm/detection.cpp	2010-11-23 21:37:26 UTC (rev 54433)
+++ scummvm/trunk/engines/scumm/detection.cpp	2010-11-23 22:25:10 UTC (rev 54434)
@@ -466,7 +466,7 @@
 		//
 		DetectorDesc &d = fileMD5Map[file];
 		if (d.md5.empty()) {
-			Common::File *tmp = 0;
+			Common::SeekableReadStream *tmp = 0;
 			bool isDiskImg = (file.hasSuffix(".d64") || file.hasSuffix(".dsk") || file.hasSuffix(".prg"));
 			
 			if (isDiskImg) {
@@ -474,12 +474,11 @@
 
 				debug(2, "Falling back to disk-based detection");
 			} else {
-				tmp = new Common::File;
-				tmp->open(d.node);
+				tmp = d.node.createReadStream();
 			}
 
 			Common::String md5str;
-			if (tmp && tmp->isOpen())
+			if (tmp)
 				md5str = computeStreamMD5AsString(*tmp, kMD5FileSizeLimit);
 			if (!md5str.empty()) {
 

Modified: scummvm/trunk/engines/scumm/he/animation_he.h
===================================================================
--- scummvm/trunk/engines/scumm/he/animation_he.h	2010-11-23 21:37:26 UTC (rev 54433)
+++ scummvm/trunk/engines/scumm/he/animation_he.h	2010-11-23 22:25:10 UTC (rev 54434)
@@ -26,8 +26,6 @@
 #if !defined(SCUMM_HE_ANIMATION_H) && defined(ENABLE_HE)
 #define SCUMM_HE_ANIMATION_H
 
-#include "common/file.h"
-
 #include "graphics/video/smk_decoder.h"
 
 #include "sound/mixer.h"

Modified: scummvm/trunk/engines/scumm/he/script_v72he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v72he.cpp	2010-11-23 21:37:26 UTC (rev 54433)
+++ scummvm/trunk/engines/scumm/he/script_v72he.cpp	2010-11-23 22:25:10 UTC (rev 54434)
@@ -1412,12 +1412,7 @@
 			if (!_saveFileMan->listSavefiles(filename).empty()) {
 				_hInFileTable[slot] = _saveFileMan->openForLoading(filename);
 			} else {
-				Common::File *f = new Common::File();
-				f->open(filename);
-				if (!f->isOpen())
-					delete f;
-				else
-					_hInFileTable[slot] = f;
+				_hInFileTable[slot] = SearchMan.createReadStreamForMember(filename);
 			}
 			break;
 		case 2:

Modified: scummvm/trunk/engines/scumm/he/script_v80he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v80he.cpp	2010-11-23 21:37:26 UTC (rev 54433)
+++ scummvm/trunk/engines/scumm/he/script_v80he.cpp	2010-11-23 22:25:10 UTC (rev 54434)
@@ -25,6 +25,7 @@
 
 #ifdef ENABLE_HE
 
+#include "common/archive.h"
 #include "common/config-file.h"
 #include "common/config-manager.h"
 #include "common/savefile.h"
@@ -94,14 +95,9 @@
 
 	Common::SeekableReadStream *f = 0;
 	if (!_saveFileMan->listSavefiles(filename).empty()) {
-		f = _saveFileMan->openForLoading((const char *)filename);
+		f = _saveFileMan->openForLoading(filename);
 	} else {
-		Common::File *file = new Common::File();
-		file->open((const char *)filename);
-		if (!file->isOpen())
-			delete file;
-		else
-			f = file;
+		f = SearchMan.createReadStreamForMember(filename);
 	}
 
 	if (!f) {

Modified: scummvm/trunk/engines/scumm/he/wiz_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/wiz_he.cpp	2010-11-23 21:37:26 UTC (rev 54433)
+++ scummvm/trunk/engines/scumm/he/wiz_he.cpp	2010-11-23 22:25:10 UTC (rev 54434)
@@ -25,6 +25,7 @@
 
 #ifdef ENABLE_HE
 
+#include "common/archive.h"
 #include "common/system.h"
 #include "graphics/cursorman.h"
 #include "graphics/primitives.h"
@@ -2374,12 +2375,7 @@
 			if (!_vm->_saveFileMan->listSavefiles(filename).empty()) {
 				f = _vm->_saveFileMan->openForLoading(filename);
 			} else {
-				Common::File *nf = new Common::File();
-				nf->open(filename);
-				if (!nf->isOpen())
-					delete nf;
-				else
-					f = nf;
+				f = SearchMan.createReadStreamForMember(filename);
 			}
 
 			if (f) {

Modified: scummvm/trunk/engines/scumm/imuse_digi/dimuse_bndmgr.cpp
===================================================================
--- scummvm/trunk/engines/scumm/imuse_digi/dimuse_bndmgr.cpp	2010-11-23 21:37:26 UTC (rev 54433)
+++ scummvm/trunk/engines/scumm/imuse_digi/dimuse_bndmgr.cpp	2010-11-23 22:25:10 UTC (rev 54434)
@@ -157,7 +157,7 @@
 	delete _file;
 }
 
-Common::File *BundleMgr::getFile(const char *filename, int32 &offset, int32 &size) {
+Common::SeekableReadStream *BundleMgr::getFile(const char *filename, int32 &offset, int32 &size) {
 	BundleDirCache::IndexNode target;
 	strcpy(target.filename, filename);
 	BundleDirCache::IndexNode *found = (BundleDirCache::IndexNode *)bsearch(&target, _indexTable, _numFiles,

Modified: scummvm/trunk/engines/scumm/imuse_digi/dimuse_bndmgr.h
===================================================================
--- scummvm/trunk/engines/scumm/imuse_digi/dimuse_bndmgr.h	2010-11-23 21:37:26 UTC (rev 54433)
+++ scummvm/trunk/engines/scumm/imuse_digi/dimuse_bndmgr.h	2010-11-23 22:25:10 UTC (rev 54434)
@@ -101,7 +101,7 @@
 
 	bool open(const char *filename, bool &compressed, bool errorFlag = false);
 	void close();
-	Common::File *getFile(const char *filename, int32 &offset, int32 &size);
+	Common::SeekableReadStream *getFile(const char *filename, int32 &offset, int32 &size);
 	int32 decompressSampleByName(const char *name, int32 offset, int32 size, byte **compFinal, bool headerOutside);
 	int32 decompressSampleByIndex(int32 index, int32 offset, int32 size, byte **compFinal, int header_size, bool headerOutside);
 	int32 decompressSampleByCurIndex(int32 offset, int32 size, byte **compFinal, int headerSize, bool headerOutside);

Modified: scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
===================================================================
--- scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp	2010-11-23 21:37:26 UTC (rev 54433)
+++ scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp	2010-11-23 22:25:10 UTC (rev 54434)
@@ -93,7 +93,7 @@
 	} while (tag != MKID_BE('DATA'));
 }
 
-void ImuseDigiSndMgr::prepareSoundFromRMAP(Common::File *file, SoundDesc *sound, int32 offset, int32 size) {
+void ImuseDigiSndMgr::prepareSoundFromRMAP(Common::SeekableReadStream *file, SoundDesc *sound, int32 offset, int32 size) {
 	int l;
 
 	file->seek(offset, SEEK_SET);
@@ -428,7 +428,7 @@
 			char fileName[24];
 			int32 offset = 0, size = 0;
 			sprintf(fileName, "%s.map", soundName);
-			Common::File *rmapFile = sound->bundle->getFile(fileName, offset, size);
+			Common::SeekableReadStream *rmapFile = sound->bundle->getFile(fileName, offset, size);
 			if (!rmapFile) {
 				closeSound(sound);
 				return NULL;
@@ -666,7 +666,7 @@
 		sprintf(fileName, "%s_reg%03d", soundDesc->name, region);
 		if (scumm_stricmp(fileName, soundDesc->lastFileName) != 0) {
 			int32 offs = 0, len = 0;
-			Common::File *cmpFile;
+			Common::SeekableReadStream *cmpFile;
 			uint8 soundMode = 0;
 
 			sprintf(fileName, "%s_reg%03d.fla", soundDesc->name, region);

Modified: scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.h
===================================================================
--- scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.h	2010-11-23 21:37:26 UTC (rev 54433)
+++ scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.h	2010-11-23 22:25:10 UTC (rev 54434)
@@ -113,7 +113,7 @@
 	bool checkForProperHandle(SoundDesc *soundDesc);
 	SoundDesc *allocSlot();
 	void prepareSound(byte *ptr, SoundDesc *sound);
-	void prepareSoundFromRMAP(Common::File *file, SoundDesc *sound, int32 offset, int32 size);
+	void prepareSoundFromRMAP(Common::SeekableReadStream *file, SoundDesc *sound, int32 offset, int32 size);
 
 	ScummEngine *_vm;
 	byte _disk;


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