Exemplo n.º 1
0
bool device_image_interface::load_software_part(const std::string &identifier, const software_part *&swpart, std::string *list_name)
{
	// if no match has been found, we suggest similar shortnames
	software_list_device *swlist;
	swpart = find_software_item(identifier, true, &swlist);
	if (swpart == nullptr)
	{
		software_list_device::display_matches(device().machine().config(), image_interface(), identifier);
		return false;
	}

	// I'm not sure what m_init_phase is all about; but for now I'm preserving this behavior
	if (is_reset_on_load())
		set_init_phase();

	// Load the software part
	const char *swname = swpart->info().shortname().c_str();
	const rom_entry *start_entry = swpart->romdata().data();
	const software_list_loader &loader = get_software_list_loader();
	bool result = loader.load_software(*this, *swlist, swname, start_entry);

#ifdef UNUSED_VARIABLE
	// Tell the world which part we actually loaded
	std::string full_sw_name = string_format("%s:%s:%s", swlist.list_name(), swpart->info().shortname(), swpart->name());
#endif

	// check compatibility
	switch (swlist->is_compatible(*swpart))
	{
		case SOFTWARE_IS_COMPATIBLE:
			break;

		case SOFTWARE_IS_INCOMPATIBLE:
			swlist->popmessage("WARNING! the set %s might not work on this system due to incompatible filter(s) '%s'\n", swpart->info().shortname(), swlist->filter());
			break;

		case SOFTWARE_NOT_COMPATIBLE:
			swlist->popmessage("WARNING! the set %s might not work on this system due to missing filter(s) '%s'\n", swpart->info().shortname(), swlist->filter());
			break;
	}

	// check requirements and load those images
	const char *requirement = swpart->feature("requirement");
	if (requirement != nullptr)
	{
		const software_part *req_swpart = find_software_item(requirement, false);
		if (req_swpart != nullptr)
		{
			device_image_interface *req_image = software_list_device::find_mountable_image(device().mconfig(), *req_swpart);
			if (req_image != nullptr)
			{
				req_image->set_init_phase();
				req_image->load(requirement);
			}
		}
	}
	if (list_name != nullptr)
		*list_name = swlist->list_name();
	return result;
}
Exemplo n.º 2
0
bool device_image_interface::load_software_part(const char *path, software_part *&swpart)
{
	// if no match has been found, we suggest similar shortnames
	swpart = find_software_item(path, true);
	if (swpart == NULL)
	{
		software_list_device::display_matches(device().machine().config(), image_interface(), path);
		return false;
	}

	// Load the software part
	bool result = call_softlist_load(swpart->info().list(), swpart->info().shortname(), swpart->romdata());

	// Tell the world which part we actually loaded
	astring full_sw_name;
	full_sw_name.printf("%s:%s:%s", swpart->info().list().list_name(), swpart->info().shortname(), swpart->name());

	// check compatibility
	if (!swpart->is_compatible(swpart->info().list()))
		osd_printf_warning("WARNING! the set %s might not work on this system due to missing filter(s) '%s'\n", swpart->info().shortname(), swpart->info().list().filter());

	// check requirements and load those images
	const char *requirement = swpart->feature("requirement");
	if (requirement != NULL)
	{
		software_part *req_swpart = find_software_item(requirement, false);
		if (req_swpart != NULL)
		{
			image_interface_iterator imgiter(device().machine().root_device());
			for (device_image_interface *req_image = imgiter.first(); req_image != NULL; req_image = imgiter.next())
			{
				const char *interface = req_image->image_interface();
				if (interface != NULL)
				{
					if (req_swpart->matches_interface(interface))
					{
						const char *option = device().mconfig().options().value(req_image->brief_instance_name());
						// mount only if not already mounted
						if (strlen(option) == 0 && !req_image->filename())
						{
							req_image->set_init_phase();
							req_image->load(requirement);
						}
						break;
					}
				}
			}
		}
	}
	return result;
}
Exemplo n.º 3
0
bool device_image_interface::load_software_part(const char *path, const software_part *&swpart)
{
    // if no match has been found, we suggest similar shortnames
    swpart = find_software_item(path, true);
    if (swpart == nullptr)
    {
        software_list_device::display_matches(device().machine().config(), image_interface(), path);
        return false;
    }

    // Load the software part
    software_list_device &swlist = swpart->info().list();
    bool result = call_softlist_load(swlist, swpart->info().shortname().c_str(), swpart->romdata());

    // Tell the world which part we actually loaded
    std::string full_sw_name = string_format("%s:%s:%s", swlist.list_name(), swpart->info().shortname(), swpart->name());

    // check compatibility
    switch (swpart->is_compatible(swlist))
    {
    case SOFTWARE_IS_COMPATIBLE:
        break;

    case SOFTWARE_IS_INCOMPATIBLE:
        swlist.popmessage("WARNING! the set %s might not work on this system due to incompatible filter(s) '%s'\n", swpart->info().shortname(), swlist.filter());
        break;

    case SOFTWARE_NOT_COMPATIBLE:
        swlist.popmessage("WARNING! the set %s might not work on this system due to missing filter(s) '%s'\n", swpart->info().shortname(), swlist.filter());
        break;
    }

    // check requirements and load those images
    const char *requirement = swpart->feature("requirement");
    if (requirement != nullptr)
    {
        const software_part *req_swpart = find_software_item(requirement, false);
        if (req_swpart != nullptr)
        {
            device_image_interface *req_image = req_swpart->find_mountable_image(device().mconfig());
            if (req_image != nullptr)
            {
                req_image->set_init_phase();
                req_image->load(requirement);
            }
        }
    }
    return result;
}
Exemplo n.º 4
0
void device_image_interface::software_get_default_slot(astring &result, const char *default_card_slot)
{
	const char *path = device().mconfig().options().value(instance_name());
	result.reset();
	if (strlen(path) > 0)
	{
		result.cpy(default_card_slot);
		software_part *swpart = find_software_item(path, true);
		if (swpart != NULL)
		{
			const char *slot = swpart->feature("slot");
			if (slot != NULL)
				result.cpy(slot);
		}
	}
}
Exemplo n.º 5
0
std::string device_image_interface::software_get_default_slot(const char *default_card_slot) const
{
	const char *path = device().mconfig().options().value(instance_name());
	std::string result;
	if (*path != '\0')
	{
		result.assign(default_card_slot);
		const software_part *swpart = find_software_item(path, true);
		if (swpart != nullptr)
		{
			const char *slot = swpart->feature("slot");
			if (slot != nullptr)
				result.assign(slot);
		}
	}
	return result;
}