From 5057c1b5c845a9cc4620ee82e609074eea3d4c8a Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Fri, 23 Mar 2007 02:55:07 +0000 Subject: Change getFileSize opcode, to check for files via SaveFileManager too. Fixes loading the high score table in the mini game of SPY Fox 2. svn-id: r26279 --- engines/scumm/he/script_v80he.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'engines/scumm/he/script_v80he.cpp') diff --git a/engines/scumm/he/script_v80he.cpp b/engines/scumm/he/script_v80he.cpp index ca1c7fd839..1d7cc37e33 100644 --- a/engines/scumm/he/script_v80he.cpp +++ b/engines/scumm/he/script_v80he.cpp @@ -25,6 +25,7 @@ #include "common/config-file.h" #include "common/config-manager.h" +#include "common/savefile.h" #include "common/str.h" #include "scumm/actor.h" @@ -403,13 +404,20 @@ void ScummEngine_v80he::o80_getFileSize() { copyScriptString(filename, sizeof(filename)); convertFilePath(filename); - Common::File f; - if (!f.open((char *)filename)) { + Common::SeekableReadStream *f = _saveFileMan->openForLoading((const char *)filename); + if (!f) { + Common::File *file = new Common::File(); + file->open((const char *)filename, Common::File::kFileReadMode); + f = file; + } + + if (!f) { push(-1); } else { - push(f.size()); - f.close(); + push(f->size()); } + + delete f; } void ScummEngine_v80he::o80_stringToInt() { -- cgit v1.2.3