mirror of
https://github.com/holub/mame
synced 2025-05-28 08:33:05 +03:00
Display approximate matches if softlist item is not found (no whatsnew)
This commit is contained in:
parent
7fd9b4fba0
commit
2e4ce7091e
@ -228,8 +228,56 @@ int cli_frontend::execute(int argc, char **argv)
|
||||
if (found) break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
if (!found) {
|
||||
const device_image_interface *image = NULL;
|
||||
for (bool gotone = config.devicelist().first(image); gotone; gotone = image->next(image))
|
||||
{
|
||||
const char *interface = image->image_interface();
|
||||
if (interface != NULL)
|
||||
{
|
||||
for (device_t *swlists = config.devicelist().first(SOFTWARE_LIST); swlists != NULL; swlists = swlists->typenext())
|
||||
{
|
||||
software_list_config *swlist = (software_list_config *)downcast<const legacy_device_base *>(swlists)->inline_config();
|
||||
|
||||
for (int i = 0; i < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; i++)
|
||||
{
|
||||
if (swlist->list_name[i] && *swlist->list_name[i])
|
||||
{
|
||||
software_list *list = software_list_open(m_options, swlist->list_name[i], FALSE, NULL);
|
||||
|
||||
if (list)
|
||||
{
|
||||
software_info *matches[10] = { 0 };
|
||||
int softnum;
|
||||
|
||||
software_list_parse(list, list->error_proc, NULL);
|
||||
// get the top 5 approximate matches for the selected device interface (i.e. only carts for cartslot, etc.)
|
||||
software_list_find_approx_matches(list, m_options.software_name(), ARRAY_LENGTH(matches), matches, image->image_interface());
|
||||
|
||||
if (matches[0] != 0)
|
||||
{
|
||||
if (swlist->list_type == SOFTWARE_LIST_ORIGINAL_SYSTEM)
|
||||
mame_printf_error("* Software list \"%s\" (%s) matches: \n", swlist->list_name[i], software_list_get_description(list));
|
||||
else
|
||||
mame_printf_error("* Compatible software list \"%s\" (%s) matches: \n", swlist->list_name[i], software_list_get_description(list));
|
||||
|
||||
// print them out
|
||||
for (softnum = 0; softnum < ARRAY_LENGTH(matches); softnum++)
|
||||
if (matches[softnum] != NULL)
|
||||
mame_printf_error("%-18s%s\n", matches[softnum]->shortname, matches[softnum]->longname);
|
||||
|
||||
mame_printf_error("\n");
|
||||
}
|
||||
software_list_close(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
throw emu_fatalerror(MAMERR_FATALERROR, "Software item '%s' can not be found in any list\n",m_options.software_name());
|
||||
}
|
||||
}
|
||||
// otherwise just run the game
|
||||
m_result = mame_execute(m_options, m_osd);
|
||||
|
@ -114,6 +114,7 @@ const char *software_part_get_feature(software_part *part, const char *feature_n
|
||||
|
||||
bool load_software_part(device_image_interface *image, const char *path, software_info **sw_info, software_part **sw_part, char **full_sw_name);
|
||||
|
||||
void software_list_find_approx_matches(software_list *swlist, const char *name, int matches, software_info **list, const char* interface);
|
||||
|
||||
/*********************************************************************
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user