diff options
author | Filippos Karapetis | 2012-06-21 12:15:25 +0300 |
---|---|---|
committer | Filippos Karapetis | 2012-06-21 12:15:25 +0300 |
commit | eb8230988a413ffff3458f0cfade5a94c95940b1 (patch) | |
tree | 8d3d760345d0e0ef9f0a8e78b85ec55d0fbef5d1 /engines | |
parent | c9ace6426ebd4cac2777f199848dcfa5770b65ca (diff) | |
download | scummvm-rg350-eb8230988a413ffff3458f0cfade5a94c95940b1.tar.gz scummvm-rg350-eb8230988a413ffff3458f0cfade5a94c95940b1.tar.bz2 scummvm-rg350-eb8230988a413ffff3458f0cfade5a94c95940b1.zip |
SCI: Don't compress exported heroes in the Quest for Glory games
This allows them to be used by other games in the series not supported
by ScummVM (i.e. QFG4, QFG5 and the fanmade AGS version of QFG2)
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()); |