mirror of
https://github.com/holub/mame
synced 2025-10-06 17:08:28 +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)
|
// iterate over our info (will cause a parse if needed)
|
||||||
for (const software_info &swinfo : get_info())
|
for (const software_info &swinfo : get_info())
|
||||||
{
|
{
|
||||||
const software_part &part = swinfo.parts().front();
|
for (const software_part &swpart : swinfo.parts())
|
||||||
if ((interface == nullptr || part.matches_interface(interface)) && is_compatible(part) == SOFTWARE_IS_COMPATIBLE)
|
|
||||||
{
|
{
|
||||||
// pick the best match between driver name and description
|
if ((interface == nullptr || swpart.matches_interface(interface)) && is_compatible(swpart) == SOFTWARE_IS_COMPATIBLE)
|
||||||
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--)
|
|
||||||
{
|
{
|
||||||
// stop if we're worse than the current entry
|
// pick the best match between driver name and description
|
||||||
if (curpenalty >= penalty[matchnum])
|
int longpenalty = driver_list::penalty_compare(name.c_str(), swinfo.longname().c_str());
|
||||||
break;
|
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
|
// insert into the sorted table of matches
|
||||||
if (matchnum < matches - 1)
|
for (int matchnum = matches - 1; matchnum >= 0; matchnum--)
|
||||||
{
|
{
|
||||||
penalty[matchnum + 1] = penalty[matchnum];
|
// stop if we're worse than the current entry
|
||||||
list[matchnum + 1] = list[matchnum];
|
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
|
else
|
||||||
{
|
{
|
||||||
m_swp = &m_swi->parts().front();
|
m_swp = m_swi->find_part("", m_image.image_interface());
|
||||||
load_software_part();
|
load_software_part();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -354,8 +354,12 @@ void menu_software::populate(float &customtop, float &custombottom)
|
|||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (const software_info &swinfo : swlistdev.get_info())
|
for (const software_info &swinfo : swlistdev.get_info())
|
||||||
if (swinfo.parts().front().matches_interface(m_interface))
|
for (const software_part &swpart : swinfo.parts())
|
||||||
found = true;
|
if (swpart.matches_interface(m_interface))
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (found)
|
if (found)
|
||||||
item_append(swlistdev.description(), "", 0, (void *)&swlistdev);
|
item_append(swlistdev.description(), "", 0, (void *)&swlistdev);
|
||||||
}
|
}
|
||||||
@ -367,8 +371,12 @@ void menu_software::populate(float &customtop, float &custombottom)
|
|||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (const software_info &swinfo : swlistdev.get_info())
|
for (const software_info &swinfo : swlistdev.get_info())
|
||||||
if (swinfo.parts().front().matches_interface(m_interface))
|
for (const software_part &swpart : swinfo.parts())
|
||||||
found = true;
|
if (swpart.matches_interface(m_interface))
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
if (!have_compatible)
|
if (!have_compatible)
|
||||||
|
Loading…
Reference in New Issue
Block a user