void device_image_interface::update_names(const device_type device_type, const char *inst, const char *brief)
{
	image_interface_iterator iter(device().mconfig().root_device());
	int count = 0;
	int index = -1;
	for (const device_image_interface *image = iter.first(); image != NULL; image = iter.next())
	{
		if (this == image)
			index = count;
		if ((image->image_type() == image_type() && device_type==NULL) || (device_type==image->device().type()))
			count++;
	}
	const char *inst_name = (device_type!=NULL) ? inst : device_typename(image_type());
	const char *brief_name = (device_type!=NULL) ? brief : device_brieftypename(image_type());
	if (count > 1)
	{
		m_instance_name.printf("%s%d", inst_name , index + 1);
		m_brief_instance_name.printf("%s%d", brief_name, index + 1);
	}
	else
	{
		m_instance_name = inst_name;
		m_brief_instance_name = brief_name;
	}
}
Exemple #2
0
void device_image_interface::update_names()
{
	image_interface_iterator iter(device().mconfig().root_device());
	int count = 0;
	int index = -1;
	for (const device_image_interface *image = iter.first(); image != NULL; image = iter.next())
	{
		if (this == image)
			index = count;
		if (image->image_type() == image_type())
			count++;
	}
	if (count > 1)
	{
		m_instance_name.printf("%s%d", device_typename(image_type()), index + 1);
		m_brief_instance_name.printf("%s%d", device_brieftypename(image_type()), index + 1);
	}
	else
	{
		m_instance_name = device_typename(image_type());
		m_brief_instance_name = device_brieftypename(image_type());
	}
}
void device_image_interface::update_names()
{
	const device_image_interface *image = NULL;
	int count = 0;
	int index = -1;

	for (bool gotone = device().mconfig().devicelist().first(image); gotone; gotone = image->next(image))
	{
		if (this == image)
			index = count;
		if (image->image_type() == image_type())
			count++;
	}
	if (count > 1) {
		m_instance_name.printf("%s%d", device_typename(image_type()), index + 1);
		m_brief_instance_name.printf("%s%d", device_brieftypename(image_type()), index + 1);
	}
	else
	{
		m_instance_name = device_typename(image_type());
		m_brief_instance_name = device_brieftypename(image_type());
	}
}
Exemple #4
0
void device_image_interface::update_names(const device_type device_type, const char *inst, const char *brief)
{
	int count = 0;
	int index = -1;
	for (const device_image_interface &image : image_interface_iterator(device().mconfig().root_device()))
	{
		if (this == &image)
			index = count;
		if ((image.image_type() == image_type() && device_type == nullptr) || (device_type == image.device().type()))
			count++;
	}
	const char *inst_name = (device_type!=nullptr) ? inst : device_typename(image_type());
	const char *brief_name = (device_type!=nullptr) ? brief : device_brieftypename(image_type());
	if (count > 1)
	{
		m_instance_name = string_format("%s%d", inst_name, index + 1);
		m_brief_instance_name = string_format("%s%d", brief_name, index + 1);
	}
	else
	{
		m_instance_name = inst_name;
		m_brief_instance_name = brief_name;
	}
}
void legacy_image_device_config_base::device_config_complete()
{
	const device_config_image_interface *image = NULL;
	int count = 0;
	int index = -1;
    image_device_format **formatptr;
    image_device_format *format;
    formatptr = &m_formatlist;
    int cnt = 0;

	m_type = static_cast<iodevice_t>(get_legacy_config_int(DEVINFO_INT_IMAGE_TYPE));
	m_readable = get_legacy_config_int(DEVINFO_INT_IMAGE_READABLE)!=0;
	m_writeable = get_legacy_config_int(DEVINFO_INT_IMAGE_WRITEABLE)!=0;
	m_creatable = get_legacy_config_int(DEVINFO_INT_IMAGE_CREATABLE)!=0;
	m_must_be_loaded = get_legacy_config_int(DEVINFO_INT_IMAGE_MUST_BE_LOADED)!=0;
	m_reset_on_load = get_legacy_config_int(DEVINFO_INT_IMAGE_RESET_ON_LOAD)!=0;
	m_has_partial_hash = get_legacy_config_int(DEVINFO_FCT_IMAGE_PARTIAL_HASH)!=0;

	m_interface_name = get_legacy_config_string(DEVINFO_STR_IMAGE_INTERFACE);

	m_file_extensions = get_legacy_config_string(DEVINFO_STR_IMAGE_FILE_EXTENSIONS);

	m_create_option_guide = reinterpret_cast<const option_guide *>(get_legacy_config_ptr(DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE));

    int format_count = get_legacy_config_int(DEVINFO_INT_IMAGE_CREATE_OPTCOUNT);

	for (int i = 0; i < format_count; i++)
	{
		// only add if creatable
		if (get_legacy_config_string(DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + i)) {
			// allocate a new format
			format = global_alloc_clear(image_device_format);

			// populate it
			format->m_index       = cnt;
			format->m_name        = get_legacy_config_string(DEVINFO_STR_IMAGE_CREATE_OPTNAME + i);
			format->m_description = get_legacy_config_string(DEVINFO_STR_IMAGE_CREATE_OPTDESC + i);
			format->m_extensions  = get_legacy_config_string(DEVINFO_STR_IMAGE_CREATE_OPTEXTS + i);
			format->m_optspec     = get_legacy_config_string(DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + i);

			// and append it to the list
			*formatptr = format;
			formatptr = &format->m_next;
			cnt++;
		}
	}

	for (bool gotone = device_config::m_machine_config.m_devicelist.first(image); gotone; gotone = image->next(image))
	{
		if (this == image)
			index = count;
		if (image->image_type_direct() == m_type)
			count++;
	}
	if (count > 1) {
		m_instance_name.printf("%s%d", device_typename(m_type), index + 1);
		m_brief_instance_name.printf("%s%d", device_brieftypename(m_type), index + 1);
	}
	else
	{
		m_instance_name = device_typename(m_type);
		m_brief_instance_name = device_brieftypename(m_type);
	}
	// Override in case of hardcoded values
	if (strlen(get_legacy_config_string(DEVINFO_STR_IMAGE_INSTANCE_NAME))>0) {
		m_instance_name = get_legacy_config_string(DEVINFO_STR_IMAGE_INSTANCE_NAME);
	}
	if (strlen(get_legacy_config_string(DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME))>0) {
		m_brief_instance_name = get_legacy_config_string(DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME);
	}
}