aboutsummaryrefslogtreecommitdiff
path: root/scumm/script_v72he.cpp
diff options
context:
space:
mode:
authorTravis Howell2005-04-23 01:50:42 +0000
committerTravis Howell2005-04-23 01:50:42 +0000
commitc61d834c6ea85296ceeb1df36a7be2f84247d63e (patch)
treef91feb797faac05612f33213d14c009faf8b928b /scumm/script_v72he.cpp
parent7903943019c9883cd3c83cc0c4dd1a8c25d41410 (diff)
downloadscummvm-rg350-c61d834c6ea85296ceeb1df36a7be2f84247d63e.tar.gz
scummvm-rg350-c61d834c6ea85296ceeb1df36a7be2f84247d63e.tar.bz2
scummvm-rg350-c61d834c6ea85296ceeb1df36a7be2f84247d63e.zip
Always set file path separately in o72_openFile() so upper and lower case filenames are checked.
svn-id: r17761
Diffstat (limited to 'scumm/script_v72he.cpp')
-rw-r--r--scumm/script_v72he.cpp37
1 files changed, 21 insertions, 16 deletions
diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp
index 11f2d88851..3821666d77 100644
--- a/scumm/script_v72he.cpp
+++ b/scumm/script_v72he.cpp
@@ -518,7 +518,7 @@ void ScummEngine_v72he::readArrayFromIndexFile() {
}
}
-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 @@ void ScummEngine_v72he::convertFilePath(byte *dst) {
}
}
- 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 @@ void ScummEngine_v72he::o72_openFile() {
strcpy((char *)filename, buf1);
}
- convertFilePath(filename);
+ int r = convertFilePath(filename);
debug(0,"Final filename to %s", filename);
slot = -1;
@@ -1736,10 +1739,12 @@ void ScummEngine_v72he::o72_openFile() {
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);