aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2016-08-25 22:05:24 +0200
committerWillem Jan Palenstijn2016-08-25 22:05:24 +0200
commit5734400a373cc696c52c3437400d32a5f1af4699 (patch)
tree3fe329c95df4f433f4e65b0e60188fbd9ca9dd19
parented461fba6512a289855f6f39f74163fe13bbcd87 (diff)
downloadscummvm-rg350-5734400a373cc696c52c3437400d32a5f1af4699.tar.gz
scummvm-rg350-5734400a373cc696c52c3437400d32a5f1af4699.tar.bz2
scummvm-rg350-5734400a373cc696c52c3437400d32a5f1af4699.zip
SCI: Make kFileIORename use wrapped filenames
This fixes deleting savegames in Phantasmagoria 1.
-rw-r--r--engines/sci/engine/kfile.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index e5b0aaf47a..e8b9d0461d 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -632,6 +632,15 @@ reg_t kFileIORename(EngineState *s, int argc, reg_t *argv) {
Common::String oldName = s->_segMan->getString(argv[0]);
Common::String newName = s->_segMan->getString(argv[1]);
+ // We don't fully implement all cases that could occur here, and
+ // assume the file to be renamed is a wrapped filename.
+ // Known usage: In Phant1 and KQ7 while deleting savegames.
+ // The scripts rewrite the dir file as a temporary file, and then
+ // rename it to the actual dir file.
+
+ oldName = g_sci->wrapFilename(oldName);
+ newName = g_sci->wrapFilename(newName);
+
// SCI1.1 returns 0 on success and a DOS error code on fail. SCI32
// returns -1 on fail. We just return -1 for all versions.
if (g_sci->getSaveFileManager()->renameSavefile(oldName, newName))