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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Fri Jan 1 00:59:28 CET 2010


Revision: 46811
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46811&view=rev
Author:   m_kiewitz
Date:     2009-12-31 23:59:28 +0000 (Thu, 31 Dec 2009)

Log Message:
-----------
SCI: kFileIO findFirst/findNext returns only game-specific prefixed files

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

Modified: scummvm/trunk/engines/sci/engine/kfile.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kfile.cpp	2009-12-31 23:59:07 UTC (rev 46810)
+++ scummvm/trunk/engines/sci/engine/kfile.cpp	2009-12-31 23:59:28 UTC (rev 46811)
@@ -620,7 +620,6 @@
 	K_FILEIO_WRITE_WORD     = 16
 };
 
-
 reg_t DirSeeker::firstFile(const Common::String &mask, reg_t buffer) {
 	// Verify that we are given a valid buffer
 	if (!buffer.segment) {
@@ -629,10 +628,12 @@
 	}
 	_outbuffer = buffer;
 
+	// Prefix the mask
+	const Common::String wrappedMask = ((Sci::SciEngine*)g_engine)->wrapFilename(mask);
+
 	// Obtain a list of all savefiles matching the given mask
-	// TODO: Modify the mask, e.g. by prefixing "TARGET-".
 	Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
-	_savefiles = saveFileMan->listSavefiles(mask);
+	_savefiles = saveFileMan->listSavefiles(wrappedMask);
 
 	// Reset the list iterator and write the first match to the output buffer, if any.
 	_iter = _savefiles.begin();
@@ -644,9 +645,10 @@
 		return NULL_REG;
 	}
 
-	// TODO: Transform the string back into a format usable by the SCI scripts.
-	// I.e., strip any TARGET- prefix.
-	Common::String string = *_iter;
+	const Common::String wrappedString = *_iter;
+
+	// Strip the prefix
+	Common::String string = ((Sci::SciEngine*)g_engine)->unwrapFilename(wrappedString);
 	if (string.size() > 12)
 		string = Common::String(string.c_str(), 12);
 	_state->_segMan->strcpy(_outbuffer, string.c_str());
@@ -656,8 +658,6 @@
 	return _outbuffer;
 }
 
-
-
 reg_t kFileIO(EngineState *s, int argc, reg_t *argv) {
 	int func_nr = argv[0].toUint16();
 
@@ -789,13 +789,17 @@
 		int attr = argv[3].toUint16(); // We won't use this, Win32 might, though...
 		debug(3, "K_FILEIO_FIND_FIRST(%s,0x%x)", mask.c_str(), attr);
 
+		// We remove ".*". mask will get prefixed, so we will return all additional files for that gameid
+		if (mask == "*.*")
+			mask = "*";
+
 		// QfG3 uses this mask for the character import
 		if (mask == "/\\*.*")
-			mask = "*.*";
-#ifndef WIN32
-		if (mask == "*.*")
-			mask = "*"; // For UNIX
-#endif
+			mask = "*";
+//#ifndef WIN32
+//		if (mask == "*.*")
+//			mask = "*"; // For UNIX
+//#endif
 		s->r_acc = s->_dirseeker.firstFile(mask, buf);
 
 		break;


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