aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTravis Howell2008-11-17 11:09:57 +0000
committerTravis Howell2008-11-17 11:09:57 +0000
commitdf9a1baadcae2f0d31b30f03bf96db9610f740ca (patch)
treea256fdd947f814f8c5b7357e39aa1cc0a7257ba8 /engines
parent1067a2ec7786a61ad9cc1f69ec1d368a53ed75fa (diff)
downloadscummvm-rg350-df9a1baadcae2f0d31b30f03bf96db9610f740ca.tar.gz
scummvm-rg350-df9a1baadcae2f0d31b30f03bf96db9610f740ca.tar.bz2
scummvm-rg350-df9a1baadcae2f0d31b30f03bf96db9610f740ca.zip
Fix regressions in HE games, when slashes are used in filenames for file opcodes.
svn-id: r35105
Diffstat (limited to 'engines')
-rw-r--r--engines/scumm/he/script_v60he.cpp4
-rw-r--r--engines/scumm/he/script_v72he.cpp18
-rw-r--r--engines/scumm/he/script_v80he.cpp14
3 files changed, 22 insertions, 14 deletions
diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp
index 1e9581f9c2..e908670c83 100644
--- a/engines/scumm/he/script_v60he.cpp
+++ b/engines/scumm/he/script_v60he.cpp
@@ -1051,7 +1051,9 @@ void ScummEngine_v60he::o60_deleteFile() {
debug(1, "o60_deleteFile (\"%s\")", filename);
- _saveFileMan->removeSavefile(filename);
+ if (!_saveFileMan->listSavefiles(filename).empty()) {
+ _saveFileMan->removeSavefile(filename);
+ }
}
void ScummEngine_v60he::o60_rename() {
diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp
index 2fecc58bff..78be4399a4 100644
--- a/engines/scumm/he/script_v72he.cpp
+++ b/engines/scumm/he/script_v72he.cpp
@@ -1690,9 +1690,9 @@ void ScummEngine_v72he::o72_openFile() {
if (slot != -1) {
switch (mode) {
case 1:
- // TODO / FIXME: Consider using listSavefiles to avoid unneccessary openForLoading calls
- _hInFileTable[slot] = _saveFileMan->openForLoading(filename);
- if (_hInFileTable[slot] == 0) {
+ if (!_saveFileMan->listSavefiles(filename).empty()) {
+ _hInFileTable[slot] = _saveFileMan->openForLoading(filename);
+ } else {
Common::File *f = new Common::File();
f->open(filename);
if (!f->isOpen())
@@ -1702,7 +1702,9 @@ void ScummEngine_v72he::o72_openFile() {
}
break;
case 2:
- _hOutFileTable[slot] = _saveFileMan->openForSaving(filename);
+ if (!strchr(filename, '/')) {
+ _hOutFileTable[slot] = _saveFileMan->openForSaving(filename);
+ }
break;
default:
error("o72_openFile(): wrong open file mode %d", mode);
@@ -1824,7 +1826,9 @@ void ScummEngine_v72he::o72_deleteFile() {
debug(1, "o72_deleteFile(%s)", filename);
- _saveFileMan->removeSavefile(filename);
+ if (!_saveFileMan->listSavefiles(filename).empty()) {
+ _saveFileMan->removeSavefile(filename);
+ }
}
void ScummEngine_v72he::o72_rename() {
@@ -2091,8 +2095,8 @@ void ScummEngine_v72he::o72_readINI() {
// We set SaveGamePath in order to detect where it used
// in convertFilePath and to avoid warning about invalid
// path in Macintosh verisons.
- data = defineArray(0, kStringArray, 0, 0, 0, 1);
- memcpy(data, (const char *)"*", 1);
+ data = defineArray(0, kStringArray, 0, 0, 0, 2);
+ memcpy(data, (const char *)"*\\", 2);
} else {
const char *entry = (ConfMan.get((char *)option).c_str());
int len = resStrLen((const byte *)entry);
diff --git a/engines/scumm/he/script_v80he.cpp b/engines/scumm/he/script_v80he.cpp
index 46449d1683..a0a6ab1ef2 100644
--- a/engines/scumm/he/script_v80he.cpp
+++ b/engines/scumm/he/script_v80he.cpp
@@ -399,17 +399,19 @@ void ScummEngine_v80he::o80_createSound() {
}
void ScummEngine_v80he::o80_getFileSize() {
- byte filename[256];
+ byte buffer[256];
- copyScriptString(filename, sizeof(filename));
- convertFilePath(filename);
+ copyScriptString(buffer, sizeof(buffer));
+ const char *filename = (char *)buffer + convertFilePath(buffer);
- Common::SeekableReadStream *f = _saveFileMan->openForLoading((const char *)filename);
- if (!f) {
+ Common::SeekableReadStream *f = 0;
+ if (!_saveFileMan->listSavefiles(filename).empty()) {
+ f = _saveFileMan->openForLoading((const char *)filename);
+ } else {
Common::File *file = new Common::File();
file->open((const char *)filename);
if (!file->isOpen())
- delete f;
+ delete file;
else
f = file;
}