trunk/src/emu/imagedev/harddriv.c
| r18464 | r18465 | |
| 101 | 101 | void harddisk_image_device::device_start() |
| 102 | 102 | { |
| 103 | 103 | m_chd = NULL; |
| 104 | | m_hard_disk_handle = NULL; |
| 104 | |
| 105 | // try to locate the CHD from a DISK_REGION |
| 106 | chd_file *handle = get_disk_handle(machine(), owner()->tag()); |
| 107 | if (handle != NULL) |
| 108 | { |
| 109 | m_hard_disk_handle = hard_disk_open(handle); |
| 110 | } |
| 111 | else |
| 112 | { |
| 113 | m_hard_disk_handle = NULL; |
| 114 | } |
| 105 | 115 | } |
| 106 | 116 | |
| 117 | void harddisk_image_device::device_stop() |
| 118 | { |
| 119 | if (m_hard_disk_handle) |
| 120 | hard_disk_close(m_hard_disk_handle); |
| 121 | } |
| 122 | |
| 107 | 123 | bool harddisk_image_device::call_load() |
| 108 | 124 | { |
| 109 | 125 | int our_result; |
| r18464 | r18465 | |
| 224 | 240 | |
| 225 | 241 | m_chd = NULL; |
| 226 | 242 | |
| 243 | if (m_hard_disk_handle) |
| 244 | hard_disk_close(m_hard_disk_handle); |
| 245 | |
| 227 | 246 | /* open the CHD file */ |
| 228 | 247 | if (software_entry() != NULL) |
| 229 | 248 | { |
trunk/src/emu/imagedev/chd_cd.c
| r18464 | r18465 | |
| 84 | 84 | |
| 85 | 85 | void cdrom_image_device::device_start() |
| 86 | 86 | { |
| 87 | | m_cdrom_handle = NULL; |
| 87 | // try to locate the CHD from a DISK_REGION |
| 88 | chd_file *chd = get_disk_handle( machine(), owner()->tag() ); |
| 89 | if( chd != NULL ) |
| 90 | { |
| 91 | m_cdrom_handle = cdrom_open( chd ); |
| 92 | } |
| 93 | else |
| 94 | { |
| 95 | m_cdrom_handle = NULL; |
| 96 | } |
| 88 | 97 | } |
| 89 | 98 | |
| 99 | void cdrom_image_device::device_stop() |
| 100 | { |
| 101 | if (m_cdrom_handle) |
| 102 | cdrom_close(m_cdrom_handle); |
| 103 | } |
| 104 | |
| 90 | 105 | bool cdrom_image_device::call_load() |
| 91 | 106 | { |
| 92 | 107 | chd_error err = (chd_error)0; |
| 93 | 108 | chd_file *chd = NULL; |
| 94 | 109 | astring tempstring; |
| 95 | 110 | |
| 111 | if (m_cdrom_handle) |
| 112 | cdrom_close(m_cdrom_handle); |
| 113 | |
| 96 | 114 | if (software_entry() == NULL) |
| 97 | 115 | { |
| 98 | 116 | if (strstr(m_image_name,".chd") && is_loaded()) { |
trunk/src/emu/machine/scsihd.c
| r18464 | r18465 | |
| 35 | 35 | { |
| 36 | 36 | scsihle_device::device_reset(); |
| 37 | 37 | |
| 38 | | is_image_device = true; |
| 39 | | disk = subdevice<harddisk_image_device>("image")->get_hard_disk_file(); |
| 40 | | if( !disk ) |
| 41 | | { |
| 42 | | // try to locate the CHD from a DISK_REGION |
| 43 | | chd_file *handle = get_disk_handle(machine(), tag()); |
| 44 | | if (handle != NULL) |
| 45 | | { |
| 46 | | is_image_device = false; |
| 47 | | disk = hard_disk_open(handle); |
| 48 | | } |
| 49 | | } |
| 50 | | |
| 51 | 38 | lba = 0; |
| 52 | 39 | blocks = 0; |
| 53 | 40 | sectorbytes = 512; |
| 54 | 41 | |
| 42 | disk = subdevice<harddisk_image_device>("image")->get_hard_disk_file(); |
| 55 | 43 | if (!disk) |
| 56 | 44 | { |
| 57 | 45 | logerror("%s SCSIHD: no HD found!\n", tag()); |
| r18464 | r18465 | |
| 64 | 52 | } |
| 65 | 53 | } |
| 66 | 54 | |
| 67 | | void scsihd_device::device_stop() |
| 68 | | { |
| 69 | | if (!is_image_device) |
| 70 | | { |
| 71 | | if( disk ) |
| 72 | | { |
| 73 | | hard_disk_close( disk ); |
| 74 | | } |
| 75 | | } |
| 76 | | } |
| 77 | | |
| 78 | 55 | static MACHINE_CONFIG_FRAGMENT(scsi_harddisk) |
| 79 | 56 | MCFG_HARDDISK_ADD("image") |
| 80 | 57 | MACHINE_CONFIG_END |
trunk/src/emu/machine/scsicd.c
| r18464 | r18465 | |
| 49 | 49 | { |
| 50 | 50 | scsihle_device::device_reset(); |
| 51 | 51 | |
| 52 | | is_file = TRUE; |
| 53 | 52 | cdrom = subdevice<cdrom_image_device>("image")->get_cdrom_file(); |
| 54 | 53 | if( !cdrom ) |
| 55 | 54 | { |
| 56 | | // try to locate the CHD from a DISK_REGION |
| 57 | | chd_file *chd = get_disk_handle( machine(), tag() ); |
| 58 | | if( chd != NULL ) |
| 59 | | { |
| 60 | | is_file = FALSE; |
| 61 | | cdrom = cdrom_open( chd ); |
| 62 | | } |
| 63 | | } |
| 64 | | |
| 65 | | if( !cdrom ) |
| 66 | | { |
| 67 | 55 | logerror( "SCSICD %s: no CD found!\n", tag() ); |
| 68 | 56 | } |
| 69 | 57 | |
| r18464 | r18465 | |
| 76 | 64 | play_err_flag = 0; |
| 77 | 65 | } |
| 78 | 66 | |
| 79 | | void scsicd_device::device_stop() |
| 80 | | { |
| 81 | | if (!is_file) |
| 82 | | { |
| 83 | | if( cdrom ) |
| 84 | | { |
| 85 | | cdrom_close( cdrom ); |
| 86 | | } |
| 87 | | } |
| 88 | | } |
| 89 | | |
| 90 | 67 | cdrom_interface scsicd_device::cd_intf = { 0, 0 }; |
| 91 | 68 | |
| 92 | 69 | static MACHINE_CONFIG_FRAGMENT(scsi_cdrom) |