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; }
image_init_result harddisk_image_device::internal_load_hd() { chd_error err = CHDERR_NONE; m_chd = nullptr; if (m_hard_disk_handle) hard_disk_close(m_hard_disk_handle); /* open the CHD file */ if (software_entry() != nullptr) { m_chd = machine().rom_load().get_disk_handle(device().subtag("harddriv").c_str()); } 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 != nullptr) { /* open the hard disk file */ m_hard_disk_handle = hard_disk_open(m_chd); if (m_hard_disk_handle != nullptr) return image_init_result::PASS; } /* if we had an error, close out the CHD */ m_origchd.close(); m_diffchd.close(); m_chd = nullptr; seterror(IMAGE_ERROR_UNSPECIFIED, chd_file::error_string(err)); return image_init_result::FAIL; }