[Scummvm-cvs-logs] SF.net SVN: scummvm:[46814] scummvm/trunk/engines/sci/engine/kfile.cpp

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Fri Jan 1 11:08:14 CET 2010


Revision: 46814
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46814&view=rev
Author:   m_kiewitz
Date:     2010-01-01 10:08:14 +0000 (Fri, 01 Jan 2010)

Log Message:
-----------
SCI: implement kFOpen (OPEN_OR_CREATE), makes it possible to save character data at the end of qfg1ega

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kfile.cpp

Modified: scummvm/trunk/engines/sci/engine/kfile.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kfile.cpp	2010-01-01 09:40:28 UTC (rev 46813)
+++ scummvm/trunk/engines/sci/engine/kfile.cpp	2010-01-01 10:08:14 UTC (rev 46814)
@@ -138,13 +138,13 @@
 			warning("file_open(_K_FILE_MODE_CREATE) failed to create file '%s'", englishName.c_str());
 	} else if (mode == _K_FILE_MODE_OPEN_OR_CREATE) {
 		// Try to open file, create it if it doesn't exist
-
-		// This has been disabled, as it's not used anywhere. Furthermore, it's not
-		// quite clear what should happen if the given file already exists... open
-		// it for appending? Or (more likely), open it for reading *and* writing?
-		// We may have to clone the file for that, etc., see also the long comment
-		// at the start of this file.
-		error("file_open(_K_FILE_MODE_OPEN_OR_CREATE) File creation currently not supported (filename '%s')", englishName.c_str());
+		outFile = saveFileMan->openForSaving(wrappedName);
+		if (!outFile)
+			warning("file_open(_K_FILE_MODE_CREATE) failed to create file '%s'", englishName.c_str());
+		// QfG1 opens the character export file with _K_FILE_MODE_CREATE first, closes it immediately and opens it again
+		//  with this here
+		// Perhaps other games use this for read access as well
+		// I guess changing this whole code into using virtual files and writing them after close would be more appropriate
 	} else {
 		error("file_open: unsupported mode %d (filename '%s')", mode, englishName.c_str());
 	}


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