/* Autostart `file_name', trying to auto-detect its type. */ int autostart_autodetect(const char *file_name, const char *program_name, unsigned int program_number, unsigned int runmode) { if (network_connected() || event_record_active() || event_playback_active() || file_name == NULL) { return -1; } if (!autostart_enabled) { log_error(autostart_log, "Autostart is not available on this setup."); return -1; } log_message(autostart_log, "Autodetecting image type of `%s'.", file_name); if (autostart_disk(file_name, program_name, program_number, runmode) == 0) { log_message(autostart_log, "`%s' recognized as disk image.", file_name); return 0; } if (machine_class != VICE_MACHINE_C64DTV && machine_class != VICE_MACHINE_SCPU64) { if (autostart_tape(file_name, program_name, program_number, runmode) == 0) { log_message(autostart_log, "`%s' recognized as tape image.", file_name); return 0; } } if (autostart_snapshot(file_name, program_name) == 0) { log_message(autostart_log, "`%s' recognized as snapshot image.", file_name); return 0; } if ((machine_class == VICE_MACHINE_C64) || (machine_class == VICE_MACHINE_C64SC) || (machine_class == VICE_MACHINE_SCPU64) ||(machine_class == VICE_MACHINE_C128)) { if (cartridge_attach_image(CARTRIDGE_CRT, file_name) == 0) { log_message(autostart_log, "`%s' recognized as cartridge image.", file_name); return 0; } } if (autostart_prg(file_name, runmode) == 0) { log_message(autostart_log, "`%s' recognized as program/p00 file.", file_name); return 0; } log_error(autostart_log, "`%s' is not a valid file.", file_name); return -1; }
static TUI_MENU_CALLBACK(attach_disk_callback) { const char *s; if (been_activated) { char *default_item, *directory; char *name, *file; unsigned int file_number = 0; s = file_system_get_disk_name((unsigned int)param); util_fname_split(s, &directory, &default_item); name = tui_file_selector("Attach a disk image", directory, "*.d64;*.d71;*.d81;*.g64;*.g41;*.x64;*.p64;*.d80;*.d82;*.d67;*.d1m;*.d2m;*.d4m;" "*.d6z;*.d7z;*.d8z;*.g6z;*.g4z;*.x6z;*.zip;*.gz;*.lzh", default_item, diskcontents_filesystem_read, &file, &file_number); if (file_number > 0) { if (autostart_disk(name, NULL, file_number, AUTOSTART_MODE_RUN) < 0) { tui_error("Cannot autostart disk image."); } else { *behavior = TUI_MENU_BEH_RESUME; } } else if (name != NULL && (s == NULL || strcasecmp(name, s) != 0) && file_system_attach_disk((int)param, name) < 0) { tui_error("Invalid disk image."); } lib_free(file); ui_update_menus(); lib_free(directory); lib_free(default_item); lib_free(name); } s = file_system_get_disk_name((unsigned int)param); if (s == NULL || *s == '\0') { return "(none)"; } else { return s; } }
/* Autostart `file_name', trying to auto-detect its type. */ int autostart_autodetect(const char *file_name, const char *program_name, unsigned int program_number, unsigned int runmode) { if (network_connected() || file_name == NULL) return -1; if (!autostart_enabled) { log_error(autostart_log, "Autostart is not available on this setup."); return -1; } log_message(autostart_log, "Autodetecting image type of `%s'.", file_name); if (autostart_disk(file_name, program_name, program_number, runmode) == 0) { log_message(autostart_log, "`%s' recognized as disk image.", file_name); check_for_label_file(file_name); return 0; } if (autostart_tape(file_name, program_name, program_number, runmode) == 0) { log_message(autostart_log, "`%s' recognized as tape image.", file_name); check_for_label_file(file_name); return 0; } if (autostart_snapshot(file_name, program_name) == 0) { log_message(autostart_log, "`%s' recognized as snapshot image.", file_name); check_for_label_file(file_name); return 0; } if (autostart_prg(file_name, runmode) == 0) { log_message(autostart_log, "`%s' recognized as program/p00 file.", file_name); check_for_label_file(file_name); return 0; } log_error(autostart_log, "`%s' is not a valid file.", file_name); return -1; }
/* Autostart `file_name', trying to auto-detect its type. */ int autostart_autodetect(const char *file_name, const char *program_name, unsigned int program_number, unsigned int runmode) { if (event_record_active() || event_playback_active() || file_name == NULL) return -1; if (!autostart_enabled) { //log_error(autostart_log, "Autostart is not available on this setup."); return -1; } //log_message(autostart_log, "Autodetecting image type of `%s'.", file_name); if (autostart_disk(file_name, program_name, program_number, runmode) == 0) { //log_message(autostart_log, "`%s' recognized as disk image.", file_name); return 0; } if (machine_class != VICE_MACHINE_C64DTV) { if (autostart_tape(file_name, program_name, program_number, runmode) == 0) { //log_message(autostart_log, "`%s' recognized as tape image.", file_name); return 0; } } if (autostart_snapshot(file_name, program_name) == 0) { //log_message(autostart_log, "`%s' recognized as snapshot image.", file_name); return 0; } if (autostart_prg(file_name, runmode) == 0) { //log_message(autostart_log, "`%s' recognized as program/p00 file.", file_name); return 0; } //log_error(autostart_log, "`%s' is not a valid file.", file_name); return -1; }