/* Activate full drive emulation. */ int drive_enable(drive_context_t *drv) { int i, drive_true_emulation = 0; unsigned int dnr; drive_t *drive; unsigned int enabled_drives = 0; dnr = drv->mynumber; drive = drv->drive; /* This must come first, because this might be called before the drive initialization. */ if (!rom_loaded) return -1; resources_get_int("DriveTrueEmulation", &drive_true_emulation); /* Always disable kernal traps. */ if (!drive_true_emulation) return 0; if (drive->type == DRIVE_TYPE_NONE) return 0; /* Recalculate drive geometry. */ if (drive->image != NULL) drive_image_attach(drive->image, dnr + 8); drivecpu_wake_up(drv); /* Make sure the UI is updated. */ for (i = 0; i < DRIVE_NUM; i++) { unsigned int the_drive; the_drive = 1 << i; if (drive_context[i]->drive->enable) { enabled_drives |= the_drive; drive_context[i]->drive->old_led_status = -1; drive_context[i]->drive->old_half_track = -1; } } /* FIXME: this doesn't care about dual drives anymore */ drive_set_active_led_color(drive->type, dnr); ui_enable_drive_status(enabled_drives, drive_led_color); #if 0 /* this is the old code not respecting more than 2 drives */ ui_enable_drive_status((drive_context[0]->drive->enable ? UI_DRIVE_ENABLE_0 : 0) | ((drive_context[1]->drive->enable || (drive_context[0]->drive->enable && drive_check_dual(drive_context[0]->drive->type)) ) ? UI_DRIVE_ENABLE_1 : 0), drive_led_color); #endif return 0; }
/* Disable full drive emulation. */ void drive_disable(drive_context_t *drv) { int i, drive_true_emulation = 0; unsigned int dnr; drive_t *drive; unsigned int enabled_drives = 0; dnr = drv->mynumber; drive = drv->drive; /* This must come first, because this might be called before the true drive initialization. */ drive->enable = 0; resources_get_int("DriveTrueEmulation", &drive_true_emulation); if (rom_loaded) { drivecpu_sleep(drv); machine_drive_port_default(drv); drive_gcr_data_writeback(drive); } /* Make sure the UI is updated. */ for (i = 0; i < DRIVE_NUM; i++) { unsigned int the_drive; the_drive = 1 << i; if (drive_context[i]->drive->enable) { enabled_drives |= the_drive; drive_context[i]->drive->old_led_status = -1; drive_context[i]->drive->old_half_track = -1; } } ui_enable_drive_status(enabled_drives, drive_led_color); #if 0 ui_enable_drive_status((drive_context[0]->drive->enable ? UI_DRIVE_ENABLE_0 : 0) | ((drive_context[1]->drive->enable || (drive_context[0]->drive->enable && drive_check_dual(drive_context[0]->drive->type)) ) ? UI_DRIVE_ENABLE_1 : 0), drive_led_color); /* ui_enable_drive_status((drive_context[0]->drive->enable ? UI_DRIVE_ENABLE_0 : 0) | (drive_context[1]->drive->enable ? UI_DRIVE_ENABLE_1 : 0), drive_led_color); */ #endif }
void ui_display_drive_current_image(unsigned int drive_number, const char *image) { int i; char *name; int num_app_shells = get_num_shells(); if (console_mode) { return; } /* FIXME: Allow more than two drives. */ if (drive_number >= NUM_DRIVES) { return; } strcpy(&(last_attached_images[drive_number][0]), image); util_fname_split(&(last_attached_images[drive_number][0]), NULL, &name); if (strcmp(name, "") == 0) { lib_free(name); name = util_concat("<", _("empty"), ">", NULL); } for (i = 0; i < num_app_shells; i++) { gtk_widget_set_tooltip_text(GTK_WIDGET(gtk_widget_get_parent(gtk_widget_get_parent(app_shells[i].drive_status[drive_number].box))), name); } lib_free(name); ui_enable_drive_status(enabled_drives, drive_active_led); }
void ui_init_drive_status_widget(void) { int i; /* This is necessary because the status might have been set before we actually open the canvas window. e.g. by commandline */ ui_enable_drive_status(enabled_drives, drive_active_led); /* make sure that all drive status widgets are initialized. This is needed for proper dual disk/dual led drives (8050, 8250). */ for (i = 0; i < NUM_DRIVES; i++) { ui_display_drive_led(i, 1000, 1000); } }
void drive_enable_update_ui(drive_context_t *drv) { int i; unsigned int enabled_drives = 0; for (i = 0; i < DRIVE_NUM; i++) { unsigned int the_drive; drive_t *drive = drive_context[i]->drive; the_drive = 1 << i; if (drive->enable || (drive->drive0 && drive->drive0->enable)) { enabled_drives |= the_drive; drive->old_led_status = -1; drive->old_half_track = -1; } } ui_enable_drive_status(enabled_drives, drive_led_color); }