From 6913a50490fe87028ed94d305702d645f6e73f59 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 11 Jan 2012 09:43:53 +0000 Subject: [PATCH] Enabling load of multi part softlist items on all available device [Fabio Priuli] --- src/emu/clifront.c | 29 ++++++++++++++++------------- src/emu/emuopts.c | 2 +- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/emu/clifront.c b/src/emu/clifront.c index 1b848c0644f..00bc2dde8bf 100644 --- a/src/emu/clifront.c +++ b/src/emu/clifront.c @@ -180,7 +180,8 @@ int cli_frontend::execute(int argc, char **argv) if (system == NULL && strlen(m_options.system_name()) > 0) throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name()); - if (strlen(m_options.software_name()) > 0) { + if (strlen(m_options.software_name()) > 0) + { machine_config config(*system, m_options); if (!config.devicelist().first(SOFTWARE_LIST)) throw emu_fatalerror(MAMERR_FATALERROR, "Error: unknown option: %s\n", m_options.software_name()); @@ -193,14 +194,17 @@ int cli_frontend::execute(int argc, char **argv) if (list) { software_info *swinfo = software_list_find(list, m_options.software_name(), NULL); - if (swinfo!=NULL) { + if (swinfo != NULL) + { + // loop through all parts for (software_part *swpart = software_find_part(swinfo, NULL, NULL); swpart != NULL; swpart = software_part_next(swpart)) { const char *mount = software_part_get_feature(swpart, "automount"); - if (is_software_compatible(swpart, swlist)) { - if (mount==NULL || strcmp(mount,"no")!=0) { - // loop trough all parts - // search for a device with the right interface + if (is_software_compatible(swpart, swlist)) + { + if (mount == NULL || strcmp(mount,"no") != 0) + { + // search for an image device with the right interface const device_image_interface *image = NULL; for (bool gotone = config.devicelist().first(image); gotone; gotone = image->next(image)) { @@ -211,13 +215,14 @@ int cli_frontend::execute(int argc, char **argv) { const char *option = m_options.value(image->brief_instance_name()); // mount only if not already mounted - if (strlen(option)==0) { + if (strlen(option) == 0) + { astring val; val.printf("%s:%s:%s",swlist->list_name,m_options.software_name(),swpart->name); // call this in order to set slot devices according to mounting m_options.parse_slot_devices(argc, argv, option_errors, image->instance_name(), val.cstr()); + break; } - break; } } } @@ -225,16 +230,14 @@ int cli_frontend::execute(int argc, char **argv) found = TRUE; } } - software_list_close(list); - break; } - + software_list_close(list); } - software_list_close(list); if (found) break; } - if (!found) { + if (!found) + { software_display_matches(config.devicelist(),m_options, NULL,m_options.software_name()); throw emu_fatalerror(MAMERR_FATALERROR, ""); } diff --git a/src/emu/emuopts.c b/src/emu/emuopts.c index 3d08d3db051..7d7196fbfc0 100644 --- a/src/emu/emuopts.c +++ b/src/emu/emuopts.c @@ -366,7 +366,6 @@ void emu_options::remove_device_options() bool emu_options::parse_slot_devices(int argc, char *argv[], astring &error_string, const char *name, const char *value) { - remove_device_options(); bool isfirst = true; bool result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); while (add_slot_options(isfirst)) { @@ -399,6 +398,7 @@ bool emu_options::parse_command_line(int argc, char *argv[], astring &error_stri if (old_system_name != system_name()) { // remove any existing device options + remove_device_options(); result = parse_slot_devices(argc, argv, error_string, NULL, NULL); } return result;