summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2011-06-15 17:51:47 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2011-06-15 17:51:47 +0000
commit2e4ce7091e4a125f023500592df3d9ecf36ba41e (patch)
tree20f13578ed9e7235e5c393c09548186fc674ddb7 /src
parent7fd9b4fba0d7e6d56aa8b38085db7ca8ac011c16 (diff)
Display approximate matches if softlist item is not found (no whatsnew)
Diffstat (limited to 'src')
-rw-r--r--src/emu/clifront.c50
-rw-r--r--src/emu/softlist.h1
2 files changed, 50 insertions, 1 deletions
diff --git a/src/emu/clifront.c b/src/emu/clifront.c
index 004be083019..3842a6ab718 100644
--- a/src/emu/clifront.c
+++ b/src/emu/clifront.c
@@ -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);
diff --git a/src/emu/softlist.h b/src/emu/softlist.h
index 8e539119c1d..92ebc2f2b0f 100644
--- a/src/emu/softlist.h
+++ b/src/emu/softlist.h
@@ -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);
/*********************************************************************