From e00c773d9529ba7915d1ef9443df289ef8eb34a5 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Tue, 10 Jan 2017 12:40:31 -0600 Subject: [PATCH] SCI32: Remove backslashes from PQ:SWAT extra save game files The original interpreter created subdirectories for each in-game profile, but copying this behaviour would add a lot of superfluous complexity to the save game system in ScummVM, and may not be portable to all supported platforms. Instead, when the game tries to save its files to a subdirectory, the backslash in the file name is replaced with an underscore so it can be created successfully on filesystems where backslash is an illegal file name character. This has a side-effect of causing all save games to be displayed under all profiles, instead of just the ones "belonging" to a particular profile, but this seems like a reasonable trade-off given that there is no reason to play this game with more than one profile. --- engines/sci/engine/kfile.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index 9d74ed174dc..7bc3c2d2125 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -427,6 +427,13 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) { return make_reg(0, handle); } } + } else if (g_sci->getGameId() == GID_PQSWAT) { + // PQSWAT tries to create subdirectories for each game profile + for (Common::String::iterator it = name.begin(); it != name.end(); ++it) { + if (*it == '\\') { + *it = '_'; + } + } } // See kMakeSaveCatName