[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.456,2.457 script_v72he.cpp,2.271,2.272

kirben kirben at users.sourceforge.net
Fri Apr 22 18:51:20 CEST 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28435/scumm

Modified Files:
	intern.h script_v72he.cpp 
Log Message:

Always set file path separately in o72_openFile() so upper and lower case filenames are checked.


Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.456
retrieving revision 2.457
diff -u -d -r2.456 -r2.457
--- intern.h	22 Apr 2005 07:12:27 -0000	2.456
+++ intern.h	23 Apr 2005 01:50:42 -0000	2.457
@@ -823,7 +823,7 @@
 	virtual void decodeParseString(int a, int b);
 	void decodeScriptString(byte *dst, bool scriptString = false);
 	void copyScriptString(byte *dst, int dstSize);
-	void convertFilePath(byte *dst);
+	int convertFilePath(byte *dst, bool setFilePath = 0);
 
 	byte *heFindResourceData(uint32 tag, byte *ptr);
 	byte *heFindResource(uint32 tag, byte *ptr);

Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.271
retrieving revision 2.272
diff -u -d -r2.271 -r2.272
--- script_v72he.cpp	22 Apr 2005 07:12:28 -0000	2.271
+++ script_v72he.cpp	23 Apr 2005 01:50:42 -0000	2.272
@@ -518,7 +518,7 @@
 	}
 }
 
-void ScummEngine_v72he::convertFilePath(byte *dst) {
+int ScummEngine_v72he::convertFilePath(byte *dst, bool setFilePath) {
 	// Switch all \ to / for portablity
 	int len = resStrLen(dst) + 1;
 	for (int i = 0; i < len; i++) {
@@ -537,21 +537,24 @@
 		}
 	}
 
-	File f;
-	char filePath[256], newFilePath[256];
+	if (setFilePath) {
+		File f;
+		char filePath[256], newFilePath[256];
 
-	sprintf(filePath, "%s%s", _gameDataPath.c_str(), dst + r);
-	if (f.exists(filePath)) {
-		sprintf(newFilePath, "%s%s", _gameDataPath.c_str(), dst + r);
-	} else {
-		sprintf(newFilePath, "%s%s", _saveFileMan->getSavePath(), dst + r);
-	}
+		sprintf(filePath, "%s%s", _gameDataPath.c_str(), dst + r);
+		if (f.exists(filePath)) {
+			sprintf(newFilePath, "%s%s", _gameDataPath.c_str(), dst + r);
+		} else {
+			sprintf(newFilePath, "%s%s", _saveFileMan->getSavePath(), dst + r);
+		}
 
-	len = resStrLen((const byte *)newFilePath);
-	memcpy(dst, newFilePath, len);
-	dst[len] = 0;
+		len = resStrLen((const byte *)newFilePath);
+		memcpy(dst, newFilePath, len);
+		dst[len] = 0;
+		debug(0, "convertFilePath: newFilePath is %s", newFilePath);
+	}
 
-	debug(0, "convertFilePath: newFilePath is %s", newFilePath);
+	return r;
 }	
 
 void ScummEngine_v72he::copyScriptString(byte *dst, int dstSize) {
@@ -1722,7 +1725,7 @@
 		strcpy((char *)filename, buf1);
 	}
 
-	convertFilePath(filename);
+	int r = convertFilePath(filename);
 	debug(0,"Final filename to %s", filename);
 
 	slot = -1;
@@ -1736,10 +1739,12 @@
 	if (slot != -1) {
 		switch(mode) {
 		case 1:
-			_hFileTable[slot].open((char*)filename, File::kFileReadMode);
+			_hFileTable[slot].open((char*)filename + r, File::kFileReadMode, _saveFileMan->getSavePath());
+			if (_hFileTable[slot].isOpen() == false)
+				_hFileTable[slot].open((char*)filename + r, File::kFileReadMode, _gameDataPath.c_str());
 			break;
 		case 2:
-			_hFileTable[slot].open((char*)filename, File::kFileWriteMode);
+			_hFileTable[slot].open((char*)filename + r, File::kFileWriteMode, _saveFileMan->getSavePath());
 			break;
 		default:
 			error("o72_openFile(): wrong open file mode %d", mode);





More information about the Scummvm-git-logs mailing list