diff options
author | Walter van Niftrik | 2009-05-19 11:30:51 +0000 |
---|---|---|
committer | Walter van Niftrik | 2009-05-19 11:30:51 +0000 |
commit | 4d59f620f9fdc1dfd7ccd6c7d30a0b5de480eb20 (patch) | |
tree | 5f1ed94ad4ed5a8b795e7d7546578afbe22fdf02 /engines/sci/engine | |
parent | 42cd21840055d97315eac8b78f110010e5270d2d (diff) | |
download | scummvm-rg350-4d59f620f9fdc1dfd7ccd6c7d30a0b5de480eb20.tar.gz scummvm-rg350-4d59f620f9fdc1dfd7ccd6c7d30a0b5de480eb20.tar.bz2 scummvm-rg350-4d59f620f9fdc1dfd7ccd6c7d30a0b5de480eb20.zip |
SCI: Changed K_FILEIO_FILE_EXISTS to check regular files too.
svn-id: r40724
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/kfile.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index a27268798f..557b72997a 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -836,17 +836,19 @@ reg_t kFileIO(EngineState *s, int funct_nr, int argc, reg_t *argv) { } case K_FILEIO_FILE_EXISTS : { char *name = kernel_dereference_char_pointer(s, argv[1], 0); - // TODO: Transform the name given by the scripts to us, e.g. by - // prepending TARGET- - // TODO: We may have to also check for a regular file with the - // given name, using File::exists(). Really depends on *how* - // scripts use this opcode. Need more test data... - Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager(); - bool exists = !saveFileMan->listSavefiles(name).empty(); - s->r_acc = make_reg(0, exists); - debug(3, "K_FILEIO_FILE_EXISTS(%s) -> %d", name, s->r_acc.offset); - break; + // Check for regular file + bool exists = Common::File::exists(name); + + if (!exists) { + // TODO: Transform the name given by the scripts to us, e.g. by + // prepending TARGET- + Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager(); + exists = !saveFileMan->listSavefiles(name).empty(); + } + + debug(3, "K_FILEIO_FILE_EXISTS(%s) -> %d", name, exists); + return make_reg(0, exists); } default : error("Unknown FileIO() sub-command: %d\n", func_nr); |