[Scummvm-cvs-logs] SF.net SVN: scummvm: [28381] scummvm/trunk/engines/saga

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Aug 1 11:02:28 CEST 2007


Revision: 28381
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28381&view=rev
Author:   thebluegr
Date:     2007-08-01 02:02:28 -0700 (Wed, 01 Aug 2007)

Log Message:
-----------
Patch files are no longer left open the whole time, but are only opened when needed. This fixes the strange bug where BBM files didn't appear in the ITE demos that have substitute scenes when using MSVC compiled executables, as too many files were open at the same time

Modified Paths:
--------------
    scummvm/trunk/engines/saga/rscfile.cpp
    scummvm/trunk/engines/saga/rscfile.h
    scummvm/trunk/engines/saga/saga.cpp

Modified: scummvm/trunk/engines/saga/rscfile.cpp
===================================================================
--- scummvm/trunk/engines/saga/rscfile.cpp	2007-08-01 02:37:29 UTC (rev 28380)
+++ scummvm/trunk/engines/saga/rscfile.cpp	2007-08-01 09:02:28 UTC (rev 28381)
@@ -330,6 +330,7 @@
 				if (resourceData->patchData->_patchFile->open(patchDescription->fileName)) {
 					resourceData->offset = 0;
 					resourceData->size = resourceData->patchData->_patchFile->size();
+					resourceData->patchData->_patchFile->close();
 				} else {
 					delete resourceData->patchData;
 					resourceData->patchData = NULL;
@@ -544,6 +545,8 @@
 	if (file->read(resourceBuffer, resourceSize) != resourceSize) {
 		error("Resource::loadResource() failed to read");
 	}
+	if (resourceData->patchData != NULL)
+		file->close();
 }
 
 static int metaResourceTable[] = { 0, 326, 517, 677, 805, 968, 1165, 0, 1271 };

Modified: scummvm/trunk/engines/saga/rscfile.h
===================================================================
--- scummvm/trunk/engines/saga/rscfile.h	2007-08-01 02:37:29 UTC (rev 28380)
+++ scummvm/trunk/engines/saga/rscfile.h	2007-08-01 09:02:28 UTC (rev 28381)
@@ -83,6 +83,8 @@
 
 	Common::File *getFile(ResourceData *resourceData) const {
 		if (resourceData->patchData != NULL) {
+			if (!resourceData->patchData->_patchFile->isOpen())
+				resourceData->patchData->_patchFile->open(resourceData->patchData->_patchDescription->fileName);
 			return resourceData->patchData->_patchFile;
 		} else {
 			return file;

Modified: scummvm/trunk/engines/saga/saga.cpp
===================================================================
--- scummvm/trunk/engines/saga/saga.cpp	2007-08-01 02:37:29 UTC (rev 28380)
+++ scummvm/trunk/engines/saga/saga.cpp	2007-08-01 09:02:28 UTC (rev 28381)
@@ -233,30 +233,6 @@
 		_voicesEnabled = true;
 	}
 
-	// WORKAROUND for a weird bug that I haven't been able to understand.
-	// In some ITE demos, scenes are substituted with pictures, which are
-	// loaded instead of the actual scene in Scene::changeScene(). The
-	// weird phenomenon is that NO files can be opened or found in that
-	// function. However, file existence works in other parts of the engine.
-	// The strange thing is that if we add a dummy file existence check here
-	// (or in any part of init() or go()) for a file that exists (it doesn't
-	// work if the file doesn't exist), files are opened correctly in the
-	// function. I don't know if this is a bug of the Common::File class or 
-	// of the SAGA engine itself (or perhaps of a clashing definition?), but
-	// still, it's very strange that a file existence check fixes things. In
-	// both cases (with and without this dummy check here), the Common::File
-	// open function called from Scene::changeScene() finds the file through
-	// the _filesMap, but without this dummy check here, the handle returned
-	// is 0
-	// To reproduce: run any of the ITE demos that has scene substitutes like,
-	// for example, the ITE demo from Wyrmkeep's site. Enter the game, and
-	// exit the faire (to speed things up, open the debug console and type
-	// "scene_change 1", close the console and visit any place other than
-	// the faire)
-	// Since the files we need are BBM files, just check for the existence
-	// of one file of them here
-	if (Common::File::exists("tycho.bbm")) {}
-
 	// FIXME: This is the ugly way of reducing redraw overhead. It works
 	//        well for 320x200 but it's unclear how well it will work for
 	//        640x480.


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