bool legacy_image_device_base::finish_load() { bool err = IMAGE_INIT_PASS; if (m_is_loading) { image_checkhash(); if (has_been_created() && m_config.get_legacy_config_fct(DEVINFO_FCT_IMAGE_CREATE)!=NULL) { err = call_create(m_create_format, m_create_args); if (err) { if (!m_err) m_err = IMAGE_ERROR_UNSPECIFIED; } } else { /* using device load */ err = call_load(); if (err) { if (!m_err) m_err = IMAGE_ERROR_UNSPECIFIED; } } } m_is_loading = FALSE; m_create_format = 0; m_create_args = NULL; m_init_phase = FALSE; return err; }
bool device_image_interface::finish_load() { bool err = IMAGE_INIT_PASS; if (m_is_loading) { image_checkhash(); if (has_been_created()) { err = call_create(m_create_format, m_create_args); if (err) { if (!m_err) m_err = IMAGE_ERROR_UNSPECIFIED; } } else { /* using device load */ err = call_load(); if (err) { if (!m_err) m_err = IMAGE_ERROR_UNSPECIFIED; } } } m_is_loading = FALSE; m_create_format = 0; m_create_args = NULL; m_init_phase = FALSE; return err; }
/* Initialize pio unit and open image */ bool ti_pio_attached_device::call_load() { ti_rs232_pio_device* card = static_cast<ti_rs232_pio_device*>(owner()); // tell whether the image is readable card->m_pio_readable = !has_been_created(); // tell whether the image is writable card->m_pio_writable = !is_readonly(); if (card->m_pio_write && card->m_pio_writable) card->m_pio_handshakein = false; // receiver ready else card->m_pio_handshakein = true; return false; // OK }
int legacy_floppy_image_device::internal_floppy_device_load(int create_format, util::option_resolution *create_args) { floperr_t err; const struct FloppyFormat *floppy_options; int floppy_flags, i; const char *extension; device_image_interface *image = nullptr; interface(image); /* figure out the floppy options */ floppy_options = m_config->formats; if (has_been_created()) { /* creating an image */ assert(create_format >= 0); err = floppy_create((void *) image, &image_ioprocs, &floppy_options[create_format], create_args, &m_floppy); if (err) goto error; } else { /* opening an image */ floppy_flags = !is_readonly() ? FLOPPY_FLAGS_READWRITE : FLOPPY_FLAGS_READONLY; extension = filetype(); err = floppy_open_choices((void *) image, &image_ioprocs, extension, floppy_options, floppy_flags, &m_floppy); if (err) goto error; } if (floppy_callbacks(m_floppy)->get_heads_per_disk && floppy_callbacks(m_floppy)->get_tracks_per_disk) { floppy_drive_set_geometry_absolute(floppy_get_tracks_per_disk(m_floppy),floppy_get_heads_per_disk(m_floppy)); } /* disk changed */ m_dskchg = CLEAR_LINE; return IMAGE_INIT_PASS; error: for (i = 0; i < ARRAY_LENGTH(errmap); i++) { if (err == errmap[i].ferr) seterror(errmap[i].ierr, errmap[i].message); } return IMAGE_INIT_FAIL; }
bool device_image_interface::finish_load() { bool err = IMAGE_INIT_PASS; if (m_is_loading) { image_checkhash(); if (m_from_swlist) call_display_info(); if (has_been_created() )// && get_legacy_fct(DEVINFO_FCT_IMAGE_CREATE) != NULL) { err = call_create(m_create_format, m_create_args); if (err) { if (!m_err) m_err = IMAGE_ERROR_UNSPECIFIED; } } else { /* using device load */ err = call_load(); if (err) { if (!m_err) m_err = IMAGE_ERROR_UNSPECIFIED; } } } m_is_loading = FALSE; m_create_format = 0; m_create_args = NULL; m_init_phase = FALSE; return err; }
bool cassette_image_device::call_load() { casserr_t err; int cassette_flags; const char *extension; int is_writable; device_image_interface *image = nullptr; interface(image); if ((has_been_created()) || (length() == 0)) { /* creating an image */ err = cassette_create((void *)image, &image_ioprocs, &wavfile_format, m_create_opts, CASSETTE_FLAG_READWRITE|CASSETTE_FLAG_SAVEONEXIT, &m_cassette); if (err) goto error; } else { /* opening an image */ do { is_writable = !is_readonly(); cassette_flags = is_writable ? (CASSETTE_FLAG_READWRITE|CASSETTE_FLAG_SAVEONEXIT) : CASSETTE_FLAG_READONLY; std::string fname; if (software_entry()==nullptr) { extension = filetype(); } else { fname = m_mame_file->filename(); int loc = fname.find_last_of('.'); if (loc!=-1) { extension = fname.substr(loc + 1,fname.length()-loc).c_str(); } else { extension = ""; } } err = cassette_open_choices((void *)image, &image_ioprocs, extension, m_formats, cassette_flags, &m_cassette); /* this is kind of a hack */ if (err && is_writable) make_readonly(); } while(err && is_writable); if (err) goto error; } /* set to default state, but only change the UI state */ change_state(m_default_state, CASSETTE_MASK_UISTATE); /* reset the position */ m_position = 0.0; m_position_time = device().machine().time().as_double(); /* default channel to 0, speed multiplier to 1 */ m_channel = 0; m_speed = 1; m_direction = 1; return IMAGE_INIT_PASS; error: image_error_t imgerr = IMAGE_ERROR_UNSPECIFIED; switch(err) { case CASSETTE_ERROR_INTERNAL: imgerr = IMAGE_ERROR_INTERNAL; break; case CASSETTE_ERROR_UNSUPPORTED: imgerr = IMAGE_ERROR_UNSUPPORTED; break; case CASSETTE_ERROR_OUTOFMEMORY: imgerr = IMAGE_ERROR_OUTOFMEMORY; break; case CASSETTE_ERROR_INVALIDIMAGE: imgerr = IMAGE_ERROR_INVALIDIMAGE; break; default: imgerr = IMAGE_ERROR_UNSPECIFIED; break; } image->seterror(imgerr, "" ); return IMAGE_INIT_FAIL; }