diff options
author | Filippos Karapetis | 2012-07-01 11:08:08 -0700 |
---|---|---|
committer | Filippos Karapetis | 2012-07-01 11:08:08 -0700 |
commit | 2c161796c5688a1f76dcf66f1e66eb9bcd1e0f23 (patch) | |
tree | 3bac116e107f2948388444cf26f8cf8a88bc3521 /engines | |
parent | d335b78003f3d28d1c9c9aeddf6a46ad1c5f4888 (diff) | |
parent | 659d0cfcc39721001f607e4ca51b8eb477708404 (diff) | |
download | scummvm-rg350-2c161796c5688a1f76dcf66f1e66eb9bcd1e0f23.tar.gz scummvm-rg350-2c161796c5688a1f76dcf66f1e66eb9bcd1e0f23.tar.bz2 scummvm-rg350-2c161796c5688a1f76dcf66f1e66eb9bcd1e0f23.zip |
Merge pull request #239 from bluegr/skipsavecompression
COMMON: Allow the savefile manager to create uncompressed saves
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/file.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/engines/sci/engine/file.cpp b/engines/sci/engine/file.cpp index 0d575f97dd..a0f7ebf4a2 100644 --- a/engines/sci/engine/file.cpp +++ b/engines/sci/engine/file.cpp @@ -57,11 +57,24 @@ namespace Sci { reg_t file_open(EngineState *s, const Common::String &filename, int mode, bool unwrapFilename) { Common::String englishName = g_sci->getSciLanguageString(filename, K_LANG_ENGLISH); + englishName.toLowercase(); + Common::String wrappedName = unwrapFilename ? g_sci->wrapFilename(englishName) : englishName; Common::SeekableReadStream *inFile = 0; Common::WriteStream *outFile = 0; Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager(); + bool isCompressed = true; + const SciGameId gameId = g_sci->getGameId(); + if ((gameId == GID_QFG1 || gameId == GID_QFG1VGA || gameId == GID_QFG2 || gameId == GID_QFG3) + && englishName.hasSuffix(".sav")) { + // QFG Characters are saved via the CharSave object. + // We leave them uncompressed so that they can be imported in later QFG + // games. + // Rooms/Scripts: QFG1: 601, QFG2: 840, QFG3/4: 52 + isCompressed = false; + } + if (mode == _K_FILE_MODE_OPEN_OR_FAIL) { // Try to open file, abort if not possible inFile = saveFileMan->openForLoading(wrappedName); @@ -74,12 +87,12 @@ reg_t file_open(EngineState *s, const Common::String &filename, int mode, bool u debugC(kDebugLevelFile, " -> file_open(_K_FILE_MODE_OPEN_OR_FAIL): failed to open file '%s'", englishName.c_str()); } else if (mode == _K_FILE_MODE_CREATE) { // Create the file, destroying any content it might have had - outFile = saveFileMan->openForSaving(wrappedName); + outFile = saveFileMan->openForSaving(wrappedName, isCompressed); if (!outFile) debugC(kDebugLevelFile, " -> 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 - outFile = saveFileMan->openForSaving(wrappedName); + outFile = saveFileMan->openForSaving(wrappedName, isCompressed); if (!outFile) debugC(kDebugLevelFile, " -> file_open(_K_FILE_MODE_CREATE): failed to create file '%s'", englishName.c_str()); |