From 7b1df2174db623b7b6b36bea48d9c36a4a0d4cb3 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Tue, 5 Jan 2016 19:44:45 +0100 Subject: SCI: fix compatibility issue in kFileIO Allow 0xFFFF as invalid file handle again for kFileIO calls Fan game "Dating Pool" opens a non-existant file at the start and tries to read it, even though it shouldn't do the latter. The sciAudio adjustments changed our behavior to error() out in such a case. This commit changes it back to our old behavior to only print out a warning. --- engines/sci/engine/file.cpp | 2 +- engines/sci/engine/file.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'engines/sci/engine') diff --git a/engines/sci/engine/file.cpp b/engines/sci/engine/file.cpp index 49e6e1716d..a602cb4503 100644 --- a/engines/sci/engine/file.cpp +++ b/engines/sci/engine/file.cpp @@ -129,7 +129,7 @@ reg_t file_open(EngineState *s, const Common::String &filename, int mode, bool u } FileHandle *getFileFromHandle(EngineState *s, uint handle) { - if (handle == 0 || handle >= VIRTUALFILE_HANDLE_START) { + if ((handle == 0) || ((handle >= VIRTUALFILE_HANDLE_START) && (handle <= VIRTUALFILE_HANDLE_END))) { error("Attempt to use invalid file handle (%d)", handle); return 0; } diff --git a/engines/sci/engine/file.h b/engines/sci/engine/file.h index f43958c5ab..54627d5228 100644 --- a/engines/sci/engine/file.h +++ b/engines/sci/engine/file.h @@ -45,6 +45,7 @@ enum { #define VIRTUALFILE_HANDLE_SCI32SAVE 32100 #define PHANTASMAGORIA_SAVEGAME_INDEX "phantsg.dir" #define VIRTUALFILE_HANDLE_SCIAUDIO 32300 +#define VIRTUALFILE_HANDLE_END 32300 struct SavegameDesc { int16 id; -- cgit v1.2.3