aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kfile.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 1c45333561..796f5d4089 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -138,13 +138,13 @@ void file_open(EngineState *s, const char *filename, int mode) {
warning("file_open(_K_FILE_MODE_CREATE) failed to create file '%s'", englishName.c_str());
} else if (mode == _K_FILE_MODE_OPEN_OR_CREATE) {
// Try to open file, create it if it doesn't exist
-
- // This has been disabled, as it's not used anywhere. Furthermore, it's not
- // quite clear what should happen if the given file already exists... open
- // it for appending? Or (more likely), open it for reading *and* writing?
- // We may have to clone the file for that, etc., see also the long comment
- // at the start of this file.
- error("file_open(_K_FILE_MODE_OPEN_OR_CREATE) File creation currently not supported (filename '%s')", englishName.c_str());
+ outFile = saveFileMan->openForSaving(wrappedName);
+ if (!outFile)
+ warning("file_open(_K_FILE_MODE_CREATE) failed to create file '%s'", englishName.c_str());
+ // QfG1 opens the character export file with _K_FILE_MODE_CREATE first, closes it immediately and opens it again
+ // with this here
+ // Perhaps other games use this for read access as well
+ // I guess changing this whole code into using virtual files and writing them after close would be more appropriate
} else {
error("file_open: unsupported mode %d (filename '%s')", mode, englishName.c_str());
}