Enabling load of multi part softlist items on all available device [Fabio Priuli]

This commit is contained in:
Miodrag Milanovic 2012-01-11 09:43:53 +00:00
parent 9f1c1efe74
commit 6913a50490
2 changed files with 17 additions and 14 deletions

View File

@ -180,7 +180,8 @@ int cli_frontend::execute(int argc, char **argv)
if (system == NULL && strlen(m_options.system_name()) > 0) if (system == NULL && strlen(m_options.system_name()) > 0)
throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name()); 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); machine_config config(*system, m_options);
if (!config.devicelist().first(SOFTWARE_LIST)) if (!config.devicelist().first(SOFTWARE_LIST))
throw emu_fatalerror(MAMERR_FATALERROR, "Error: unknown option: %s\n", m_options.software_name()); 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) if (list)
{ {
software_info *swinfo = software_list_find(list, m_options.software_name(), NULL); 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)) 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"); const char *mount = software_part_get_feature(swpart, "automount");
if (is_software_compatible(swpart, swlist)) { if (is_software_compatible(swpart, swlist))
if (mount==NULL || strcmp(mount,"no")!=0) { {
// loop trough all parts if (mount == NULL || strcmp(mount,"no") != 0)
// search for a device with the right interface {
// search for an image device with the right interface
const device_image_interface *image = NULL; const device_image_interface *image = NULL;
for (bool gotone = config.devicelist().first(image); gotone; gotone = image->next(image)) for (bool gotone = config.devicelist().first(image); gotone; gotone = image->next(image))
{ {
@ -211,30 +215,29 @@ int cli_frontend::execute(int argc, char **argv)
{ {
const char *option = m_options.value(image->brief_instance_name()); const char *option = m_options.value(image->brief_instance_name());
// mount only if not already mounted // mount only if not already mounted
if (strlen(option)==0) { if (strlen(option) == 0)
{
astring val; astring val;
val.printf("%s:%s:%s",swlist->list_name,m_options.software_name(),swpart->name); 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 // 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()); m_options.parse_slot_devices(argc, argv, option_errors, image->instance_name(), val.cstr());
}
break; break;
} }
} }
} }
} }
}
found = TRUE; found = TRUE;
} }
} }
software_list_close(list);
break;
}
} }
software_list_close(list); software_list_close(list);
}
if (found) break; if (found) break;
} }
if (!found) { if (!found)
{
software_display_matches(config.devicelist(),m_options, NULL,m_options.software_name()); software_display_matches(config.devicelist(),m_options, NULL,m_options.software_name());
throw emu_fatalerror(MAMERR_FATALERROR, ""); throw emu_fatalerror(MAMERR_FATALERROR, "");
} }

View File

@ -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) 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 isfirst = true;
bool result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); bool result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
while (add_slot_options(isfirst)) { 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()) if (old_system_name != system_name())
{ {
// remove any existing device options // remove any existing device options
remove_device_options();
result = parse_slot_devices(argc, argv, error_string, NULL, NULL); result = parse_slot_devices(argc, argv, error_string, NULL, NULL);
} }
return result; return result;