SCI: Changed K_FILEIO_FILE_EXISTS to check regular files too.

svn-id: r40724
This commit is contained in:
Walter van Niftrik 2009-05-19 11:30:51 +00:00
parent 42cd218400
commit 4d59f620f9
3 changed files with 14 additions and 12 deletions

View File

@ -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);

View File

@ -847,7 +847,7 @@ void ResourceManager::readResourcePatches(ResourceSource *source) {
ResourceSource *psrcPatch;
bool bAdd;
for (int i = kResourceTypeView; i < kResourceTypeInvalid; i ++) {
for (int i = kResourceTypeView; i < kResourceTypeAudio36; i ++) {
files.clear();
szResType = getResourceTypeName((ResourceType)i);
// SCI0 naming - type.nnn

View File

@ -285,7 +285,7 @@ static const char *sci1_default_knames[SCI1_KNAMES_DEFAULT_ENTRIES_NR] = {
/*0x82*/ "TextFonts",
/*0x83*/ "Record",
/*0x84*/ "PlayBack",
/*0x85*/ SCRIPT_UNKNOWN_FUNCTION_STRING,
/*0x85*/ "ShowMovie",
/*0x86*/ "SetVideoMode",
/*0x87*/ "SetQuitStr",
/*0x88*/ "DbugStr"