示例#1
0
文件: diimage.c 项目: Eduardop/mame
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;
}
示例#2
0
文件: diimage.cpp 项目: keshbach/mame
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;
}