diff options
author | Willem Jan Palenstijn | 2016-08-11 19:29:34 +0200 |
---|---|---|
committer | Willem Jan Palenstijn | 2016-08-11 19:29:34 +0200 |
commit | 6d9ed09897e859c95caadf0b6d0139e49d2c0e03 (patch) | |
tree | 87add49dbb3f18d4f1b873e0a61367a403936372 /engines/sci/engine | |
parent | 401b34bf4505e9d43596a8e9c8c4322c1e6d96a5 (diff) | |
download | scummvm-rg350-6d9ed09897e859c95caadf0b6d0139e49d2c0e03.tar.gz scummvm-rg350-6d9ed09897e859c95caadf0b6d0139e49d2c0e03.tar.bz2 scummvm-rg350-6d9ed09897e859c95caadf0b6d0139e49d2c0e03.zip |
SCI32: Don't use autosave.cat in Torin
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/kfile.cpp | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index bb86e693f2..3bcadd143c 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -251,6 +251,25 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) { return SIGNAL_REG; } + // Torin's autosave system checks for the presence of autosave.cat + // by opening it. Since we don't use .cat files, we instead check + // for autosave.000 or autosave.001. + // + // This has the added benefit of not detecting an SSCI autosave.cat + // accompanying SSCI autosave files that we wouldn't be able to load. + if (g_sci->getGameId() == GID_TORIN && name == "autosave.cat") { + Common::String pattern = g_sci->wrapFilename("autosave.###"); + Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager(); + bool exists = !saveFileMan->listSavefiles(pattern).empty(); + if (exists) { + // Dummy handle. Torin only checks if this is SIGNAL_REG, + // and calls kFileIOClose on it. + return make_reg(0, VIRTUALFILE_HANDLE_SCI32SAVE); + } else { + return SIGNAL_REG; + } + } + if (name.empty()) { // Happens many times during KQ1 (e.g. when typing something) debugC(kDebugLevelFile, "Attempted to open a file with an empty filename"); @@ -707,7 +726,7 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) { // their own slots and .cat file. // The autosave system uses autosave.000 and autosave.001. // It also checks the presence of autosave.cat to determine if it should - // show the chapter selection menu on startup. + // show the chapter selection menu on startup. (See kFileIOOpen.) bool torinAutosave = g_sci->getGameId() == GID_TORIN && game_id == "Autosave"; if (argv[0].isNull()) { @@ -833,14 +852,6 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) { delete out; } - if (torinAutosave && !s->r_acc.isNull()) { - // Create autosave.cat so that the game can detect the presence - // of autosaves. - Common::WriteStream *t; - t = saveFileMan->openForSaving(g_sci->wrapFilename("autosave.cat")); - delete t; - } - return s->r_acc; } |