GFXDECODE_END static MACHINE_START( lgp ) { discinfo = laserdisc_init(LASERDISC_TYPE_LDV1000, get_disk_handle(0), 0); return; }
static DEVICE_IMAGE_LOAD(cdrom) { dev_cdrom_t *cdrom = get_safe_token(&image.device()); chd_error err = (chd_error)0; chd_file *chd = NULL; astring tempstring; if (image.software_entry() == NULL) { err = chd_open_file( image.image_core_file(), CHD_OPEN_READ, NULL, &chd ); /* CDs are never writeable */ if ( err ) goto error; } else { chd = get_disk_handle(image.device().machine, image.device().subtag(tempstring,"cdrom")); } /* open the CHD file */ cdrom->cdrom_handle = cdrom_open( chd ); if ( ! cdrom->cdrom_handle ) goto error; return IMAGE_INIT_PASS; error: if ( chd ) chd_close( chd ); if ( err ) image.seterror( IMAGE_ERROR_UNSPECIFIED, chd_get_error_string( err ) ); return IMAGE_INIT_FAIL; }
static MACHINE_START( alg ) { discinfo = laserdisc_init(LASERDISC_TYPE_LDP1450, get_disk_handle(0), 1); serial_timer = timer_alloc(response_timer); serial_timer_active = FALSE; return 0; }
static chd_file *get_disc(const device_config *device) { mame_file *image_file = NULL; chd_file *image_chd = NULL; mame_path *path; /* open a path to the ROMs and find the first CHD file */ path = mame_openpath(mame_options(), OPTION_ROMPATH); if (path != NULL) { const osd_directory_entry *dir; /* iterate while we get new objects */ while ((dir = mame_readpath(path)) != NULL) { int length = strlen(dir->name); /* look for files ending in .chd */ if (length > 4 && dir->name[length - 4] == '.' && tolower(dir->name[length - 3]) == 'c' && tolower(dir->name[length - 2]) == 'h' && tolower(dir->name[length - 1]) == 'd') { file_error filerr; chd_error chderr; /* open the file itself via our search path */ filerr = mame_fopen(SEARCHPATH_IMAGE, dir->name, OPEN_FLAG_READ, &image_file); if (filerr == FILERR_NONE) { /* try to open the CHD */ chderr = chd_open_file(mame_core_file(image_file), CHD_OPEN_READ, NULL, &image_chd); if (chderr == CHDERR_NONE) { set_disk_handle(device->machine, "laserdisc", image_file, image_chd); filename = astring_dupc(dir->name); add_exit_callback(device->machine, free_string); break; } /* close the file on failure */ mame_fclose(image_file); image_file = NULL; } } } mame_closepath(path); } /* if we failed, pop a message and exit */ if (image_file == NULL) fatalerror("No valid image file found!\n"); return get_disk_handle(device->machine, "laserdisc"); }
int harddisk_image_device::internal_load_hd() { astring tempstring; chd_error err = CHDERR_NONE; m_chd = NULL; if (m_hard_disk_handle) hard_disk_close(m_hard_disk_handle); /* open the CHD file */ if (software_entry() != NULL) { m_chd = get_disk_handle(device().machine(), device().subtag(tempstring,"harddriv")); } else { err = m_origchd.open(*image_core_file(), true); if (err == CHDERR_NONE) { m_chd = &m_origchd; } else if (err == CHDERR_FILE_NOT_WRITEABLE) { err = m_origchd.open(*image_core_file(), false); if (err == CHDERR_NONE) { err = open_disk_diff(device().machine().options(), basename_noext(), m_origchd, m_diffchd); if (err == CHDERR_NONE) { m_chd = &m_diffchd; } } } } if (m_chd != NULL) { /* open the hard disk file */ m_hard_disk_handle = hard_disk_open(m_chd); if (m_hard_disk_handle != NULL) return IMAGE_INIT_PASS; } /* if we had an error, close out the CHD */ m_origchd.close(); m_diffchd.close(); m_chd = NULL; seterror(IMAGE_ERROR_UNSPECIFIED, chd_file::error_string(err)); return IMAGE_INIT_FAIL; }
void cdrom_image_device::device_start() { // try to locate the CHD from a DISK_REGION chd_file *chd = get_disk_handle( machine(), owner()->tag() ); if( chd != NULL ) { m_cdrom_handle = cdrom_open( chd ); } else { m_cdrom_handle = NULL; } }
void laserdisc_device::init_disc() { // get a handle to the disc to play if (!m_getdisc_callback.isnull()) m_disc = m_getdisc_callback(*this); else m_disc = get_disk_handle(machine(), tag()); // set default parameters m_width = 720; m_height = 240; m_fps_times_1million = 59940000; m_samplerate = 48000; // get the disc metadata and extract the ld m_chdtracks = 0; m_maxtrack = VIRTUAL_LEAD_IN_TRACKS + MAX_TOTAL_TRACKS + VIRTUAL_LEAD_OUT_TRACKS; if (m_disc != NULL) { // require the A/V codec and nothing else if (m_disc->compression(0) != CHD_CODEC_AVHUFF || m_disc->compression(1) != CHD_CODEC_NONE) throw emu_fatalerror("Laserdisc video must be compressed with the A/V codec!"); // read the metadata astring metadata; chd_error err = m_disc->read_metadata(AV_METADATA_TAG, 0, metadata); if (err != CHDERR_NONE) throw emu_fatalerror("Non-A/V CHD file specified"); // extract the metadata int fps, fpsfrac, interlaced, channels; if (sscanf(metadata, AV_METADATA_FORMAT, &fps, &fpsfrac, &m_width, &m_height, &interlaced, &channels, &m_samplerate) != 7) throw emu_fatalerror("Invalid metadata in CHD file"); else m_fps_times_1million = fps * 1000000 + fpsfrac; // require interlaced video if (!interlaced) throw emu_fatalerror("Laserdisc video must be interlaced!"); // determine the maximum track and allocate a frame buffer UINT32 totalhunks = m_disc->hunk_count(); m_chdtracks = totalhunks / 2; // allocate memory for the precomputed per-frame metadata err = m_disc->read_metadata(AV_LD_METADATA_TAG, 0, m_vbidata); if (err != CHDERR_NONE || m_vbidata.count() != totalhunks * VBI_PACKED_BYTES) throw emu_fatalerror("Precomputed VBI metadata missing or incorrect size"); } m_maxtrack = MAX(m_maxtrack, VIRTUAL_LEAD_IN_TRACKS + VIRTUAL_LEAD_OUT_TRACKS + m_chdtracks); }
void ata_flash_pccard_device::device_start() { UINT32 metalength; memset(m_cis, 0xff, 512); astring drive_tag; subtag(drive_tag, "drive_0"); m_chd_file = get_disk_handle(machine(), drive_tag); if(m_chd_file != NULL) { m_chd_file->read_metadata(PCMCIA_CIS_METADATA_TAG, 0, m_cis, 512, metalength); } }
void diablo_image_device::device_start() { m_chd = nullptr; // try to locate the CHD from a DISK_REGION chd_file *handle = get_disk_handle(machine(), tag()); if (handle != nullptr) { m_hard_disk_handle = hard_disk_open(handle); } else { m_hard_disk_handle = nullptr; } }
void harddisk_image_device::device_start() { m_chd = NULL; // try to locate the CHD from a DISK_REGION chd_file *handle = get_disk_handle(machine(), tag()); if (handle != NULL) { m_hard_disk_handle = hard_disk_open(handle); } else { m_hard_disk_handle = NULL; } }
chd_file *ldplayer_state::get_disc() { // open a path to the ROMs and find the first CHD file file_enumerator path(machine().options().media_path()); // iterate while we get new objects const osd_directory_entry *dir; emu_file *image_file = NULL; chd_file *image_chd = NULL; while ((dir = path.next()) != NULL) { int length = strlen(dir->name); // look for files ending in .chd if (length > 4 && dir->name[length - 4] == '.' && tolower(dir->name[length - 3]) == 'c' && tolower(dir->name[length - 2]) == 'h' && tolower(dir->name[length - 1]) == 'd') { // open the file itself via our search path image_file = auto_alloc(machine(), emu_file(machine().options().media_path(), OPEN_FLAG_READ)); file_error filerr = image_file->open(dir->name); if (filerr == FILERR_NONE) { // try to open the CHD chd_error chderr = chd_open_file(*image_file, CHD_OPEN_READ, NULL, &image_chd); if (chderr == CHDERR_NONE) { set_disk_handle(machine(), "laserdisc", *image_file, *image_chd); m_filename.cpy(dir->name); break; } } // close the file on failure auto_free(machine(), image_file); image_file = NULL; } } // if we failed, pop a message and exit if (image_file == NULL) throw emu_fatalerror("No valid image file found!\n"); return get_disk_handle(machine(), "laserdisc"); }
// global functions void stvcd_reset(void) { state = STATE_UNK; hirqmask = 0xffff; hirqreg = 0; cr1 = 'C'; cr2 = ('D'<<8) | 'B'; cr3 = ('L'<<8) | 'O'; cr4 = ('C'<<8) | 'K'; cd_stat = 0; if (curdir != (direntryT *)NULL) free((void *)curdir); curdir = (direntryT *)NULL; // no directory yet // reset flag vars buffull = sectorstore = 0; freeblocks = 200; // open device if (cdrom) { cdrom_close(cdrom); cdrom = (cdrom_file *)NULL; } #ifdef MESS cdrom = mess_cd_get_cdrom_file_by_number(0); #else cdrom = cdrom_open(get_disk_handle(0)); #endif memset(databuf, 0, (512*1024)); dbufptr = 0; dbuflen = 0; wordsread = 0; if (cdrom) { logerror("Opened CD-ROM successfully, reading root directory\n"); read_new_dir(0xffffff); // read root directory } }
chd_file *ldplayer_state::get_disc() { bool found = FALSE; // open a path to the ROMs and find the first CHD file file_enumerator path(machine().options().media_path()); // iterate while we get new objects const osd_directory_entry *dir; while ((dir = path.next()) != NULL) { int length = strlen(dir->name); // look for files ending in .chd if (length > 4 && dir->name[length - 4] == '.' && tolower(dir->name[length - 3]) == 'c' && tolower(dir->name[length - 2]) == 'h' && tolower(dir->name[length - 1]) == 'd') { // open the file itself via our search path emu_file image_file(machine().options().media_path(), OPEN_FLAG_READ); file_error filerr = image_file.open(dir->name); if (filerr == FILERR_NONE) { astring fullpath(image_file.fullpath()); image_file.close(); // try to open the CHD if (set_disk_handle(machine(), "laserdisc", fullpath) == CHDERR_NONE) { m_filename.cpy(dir->name); found = TRUE; break; } } } } // if we failed, pop a message and exit if (found == FALSE) throw emu_fatalerror("No valid image file found!\n"); return get_disk_handle(machine(), "laserdisc"); }
void am53cf96_init( struct AM53CF96interface *interface ) { const struct hard_disk_info *hdinfo; // save interface pointer for later intf = interface; memset(scsi_regs, 0, sizeof(scsi_regs)); // try to open the disk if (interface->device == AM53CF96_DEVICE_HDD) { disk = hard_disk_open(get_disk_handle(0)); if (!disk) { logerror("53cf96: no disk found!\n"); } else { hdinfo = hard_disk_get_info(disk); if (hdinfo->sectorbytes != 512) { logerror("53cf96: Error! invalid sector size %d\n", hdinfo->sectorbytes); } } } else if (interface->device == AM53CF96_DEVICE_CDROM) { logerror("53cf96: CDROM not yet supported!\n"); } else { logerror("53cf96: unknown device type!\n"); } state_save_register_UINT8("53cf96", 0, "registers", scsi_regs, 32); state_save_register_UINT8("53cf96", 0, "fifo", fifo, 16); state_save_register_UINT8("53cf96", 0, "fifo pointer", &fptr, 1); state_save_register_UINT8("53cf96", 0, "last scsi-2 command", &last_cmd, 1); state_save_register_UINT8("53cf96", 0, "transfer state", &xfer_state, 1); state_save_register_int("53cf96", 0, "current lba", &lba); state_save_register_int("53cf96", 0, "blocks to read", &blocks); }
bool cdrom_image_device::call_load() { chd_error err = (chd_error)0; chd_file *chd = NULL; astring tempstring; if (m_cdrom_handle) cdrom_close(m_cdrom_handle); if (software_entry() == NULL) { if (strstr(m_image_name,".chd") && is_loaded()) { err = m_self_chd.open( *image_core_file() ); /* CDs are never writeable */ if ( err ) goto error; chd = &m_self_chd; } } else { chd = get_disk_handle(device().machine(), device().subtag(tempstring,"cdrom")); } /* open the CHD file */ if (chd) { m_cdrom_handle = cdrom_open( chd ); } else { m_cdrom_handle = cdrom_open( m_image_name ); } if ( ! m_cdrom_handle ) goto error; return IMAGE_INIT_PASS; error: if ( chd && chd == &m_self_chd ) m_self_chd.close( ); if ( err ) seterror( IMAGE_ERROR_UNSPECIFIED, chd_file::error_string( err ) ); return IMAGE_INIT_FAIL; }
} static WRITE32_HANDLER(rf5c296_mem_w) { taitogn_state *state = space->machine().driver_data<taitogn_state>(); if(offset >= 0x140 && offset <= 0x144) { UINT8 key[5]; int pos = (offset - 0x140)*2; UINT8 v, k; if(ACCESSING_BITS_16_23) { v = data >> 16; pos++; } else v = data; chd_get_metadata(get_disk_handle(space->machine(), ":card"), HARD_DISK_KEY_METADATA_TAG, 0, key, 5, 0, 0, 0); k = pos < 5 ? key[pos] : 0; if(v == k) state->m_locked &= ~(1 << pos); else state->m_locked |= 1 << pos; if (!state->m_locked) { ide_set_gnet_readlock (space->machine().device(":card"), 0); } } } // Flash handling static UINT32 gen_flash_r(intelfsh16_device *device, offs_t offset, UINT32 mem_mask)
int ide_controller_init(int which, struct ide_interface *intf) { /* we only support one hard disk right now; get a handle to it */ return ide_controller_init_custom(which, intf, get_disk_handle(0)); }
static MACHINE_START( cliffhgr ) { discinfo = laserdisc_init(LASERDISC_TYPE_PR8210, get_disk_handle(0), 0); irq_timer = timer_alloc(cliff_irq_callback, NULL); }