aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2010-01-01 10:08:14 +0000
committerMartin Kiewitz2010-01-01 10:08:14 +0000
commitb1b6555cb51393928f8c3afc31906c8db998de54 (patch)
treeb439aecaa95f24b9bfcb139e76d629b28bdaa6db /engines
parentca83c13ec98a3ccd4f71d74c2e2554fc874a7113 (diff)
downloadscummvm-rg350-b1b6555cb51393928f8c3afc31906c8db998de54.tar.gz
scummvm-rg350-b1b6555cb51393928f8c3afc31906c8db998de54.tar.bz2
scummvm-rg350-b1b6555cb51393928f8c3afc31906c8db998de54.zip
SCI: implement kFOpen (OPEN_OR_CREATE), makes it possible to save character data at the end of qfg1ega
svn-id: r46814
Diffstat (limited to 'engines')
-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());
}