mirror of
https://github.com/holub/mame
synced 2025-06-29 23:48:56 +03:00
allow softlist software parts to use different interfaces:
- imgcntrl: don't assume first software part, find part with correct interface - swlist: check all software parts for matching interface when populating list of software lists - softlist_dev: check all software parts when finding approx matches
This commit is contained in:
parent
164d63d603
commit
080a944190
@ -145,29 +145,31 @@ void software_list_device::find_approx_matches(const std::string &name, int matc
|
||||
// iterate over our info (will cause a parse if needed)
|
||||
for (const software_info &swinfo : get_info())
|
||||
{
|
||||
const software_part &part = swinfo.parts().front();
|
||||
if ((interface == nullptr || part.matches_interface(interface)) && is_compatible(part) == SOFTWARE_IS_COMPATIBLE)
|
||||
for (const software_part &swpart : swinfo.parts())
|
||||
{
|
||||
// pick the best match between driver name and description
|
||||
int longpenalty = driver_list::penalty_compare(name.c_str(), swinfo.longname().c_str());
|
||||
int shortpenalty = driver_list::penalty_compare(name.c_str(), swinfo.shortname().c_str());
|
||||
int curpenalty = std::min(longpenalty, shortpenalty);
|
||||
|
||||
// insert into the sorted table of matches
|
||||
for (int matchnum = matches - 1; matchnum >= 0; matchnum--)
|
||||
if ((interface == nullptr || swpart.matches_interface(interface)) && is_compatible(swpart) == SOFTWARE_IS_COMPATIBLE)
|
||||
{
|
||||
// stop if we're worse than the current entry
|
||||
if (curpenalty >= penalty[matchnum])
|
||||
break;
|
||||
// pick the best match between driver name and description
|
||||
int longpenalty = driver_list::penalty_compare(name.c_str(), swinfo.longname().c_str());
|
||||
int shortpenalty = driver_list::penalty_compare(name.c_str(), swinfo.shortname().c_str());
|
||||
int curpenalty = std::min(longpenalty, shortpenalty);
|
||||
|
||||
// as long as this isn't the last entry, bump this one down
|
||||
if (matchnum < matches - 1)
|
||||
// insert into the sorted table of matches
|
||||
for (int matchnum = matches - 1; matchnum >= 0; matchnum--)
|
||||
{
|
||||
penalty[matchnum + 1] = penalty[matchnum];
|
||||
list[matchnum + 1] = list[matchnum];
|
||||
// stop if we're worse than the current entry
|
||||
if (curpenalty >= penalty[matchnum])
|
||||
break;
|
||||
|
||||
// as long as this isn't the last entry, bump this one down
|
||||
if (matchnum < matches - 1)
|
||||
{
|
||||
penalty[matchnum + 1] = penalty[matchnum];
|
||||
list[matchnum + 1] = list[matchnum];
|
||||
}
|
||||
list[matchnum] = &swinfo;
|
||||
penalty[matchnum] = curpenalty;
|
||||
}
|
||||
list[matchnum] = &swinfo;
|
||||
penalty[matchnum] = curpenalty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ void menu_control_device_image::handle()
|
||||
}
|
||||
else
|
||||
{
|
||||
m_swp = &m_swi->parts().front();
|
||||
m_swp = m_swi->find_part("", m_image.image_interface());
|
||||
load_software_part();
|
||||
}
|
||||
break;
|
||||
|
@ -354,8 +354,12 @@ void menu_software::populate(float &customtop, float &custombottom)
|
||||
{
|
||||
bool found = false;
|
||||
for (const software_info &swinfo : swlistdev.get_info())
|
||||
if (swinfo.parts().front().matches_interface(m_interface))
|
||||
found = true;
|
||||
for (const software_part &swpart : swinfo.parts())
|
||||
if (swpart.matches_interface(m_interface))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
if (found)
|
||||
item_append(swlistdev.description(), "", 0, (void *)&swlistdev);
|
||||
}
|
||||
@ -367,8 +371,12 @@ void menu_software::populate(float &customtop, float &custombottom)
|
||||
{
|
||||
bool found = false;
|
||||
for (const software_info &swinfo : swlistdev.get_info())
|
||||
if (swinfo.parts().front().matches_interface(m_interface))
|
||||
found = true;
|
||||
for (const software_part &swpart : swinfo.parts())
|
||||
if (swpart.matches_interface(m_interface))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
if (!have_compatible)
|
||||
|
Loading…
Reference in New Issue
Block a user