summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2011-06-15 17:31:06 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2011-06-15 17:31:06 +0000
commit7fd9b4fba0d7e6d56aa8b38085db7ca8ac011c16 (patch)
tree6021776d553e2ac22b151ea000bc6137510443dd
parent2cc07055e43cc90813e8d5742b34928c488731a4 (diff)
Added support for starting softlist item directly without
marking image device to be mounted on. If soft item is found it will be loaded on first image device that have needed interface defined [Miodrag Milanovic]
-rw-r--r--src/emu/clifront.c51
-rw-r--r--src/emu/emuopts.c1
-rw-r--r--src/emu/emuopts.h2
3 files changed, 54 insertions, 0 deletions
diff --git a/src/emu/clifront.c b/src/emu/clifront.c
index 327e6a433bb..004be083019 100644
--- a/src/emu/clifront.c
+++ b/src/emu/clifront.c
@@ -180,6 +180,57 @@ 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) {
+ machine_config config(*system, m_options);
+ if (!config.devicelist().first(SOFTWARE_LIST))
+ throw emu_fatalerror(MAMERR_FATALERROR, "No software lists defined for this system\n");
+
+ bool found = FALSE;
+ 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 *swinfo = software_list_find(list, m_options.software_name(), NULL);
+ if (swinfo!=NULL) {
+ const device_image_interface *image = NULL;
+ software_part *part = software_find_part(swinfo, NULL, NULL);
+ // search for a device with the right interface
+ for (bool gotone = config.devicelist().first(image); gotone; gotone = image->next(image))
+ {
+ const char *interface = image->image_interface();
+ if (interface != NULL)
+ {
+ if (!strcmp(interface, part->interface_))
+ {
+ astring error;
+ m_options.set_value(image->brief_instance_name(), m_options.software_name(), OPTION_PRIORITY_CMDLINE, error);
+ assert(!error);
+ software_list_close(list);
+ break;
+ }
+ }
+ }
+ found = TRUE;
+ break;
+ }
+
+ }
+ software_list_close(list);
+ }
+ if (found) break;
+ }
+ }
+ if (!found)
+ 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/emuopts.c b/src/emu/emuopts.c
index 8cd688986c8..66d4154cfcb 100644
--- a/src/emu/emuopts.c
+++ b/src/emu/emuopts.c
@@ -52,6 +52,7 @@ const options_entry emu_options::s_option_entries[] =
{
// unadorned options - only a single one supported at the moment
{ OPTION_SYSTEMNAME, NULL, OPTION_STRING, NULL },
+ { OPTION_SOFTWARENAME, NULL, OPTION_STRING, NULL },
// config options
{ NULL, NULL, OPTION_HEADER, "CORE CONFIGURATION OPTIONS" },
diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h
index 13149d2b1c7..41e9ebf72c7 100644
--- a/src/emu/emuopts.h
+++ b/src/emu/emuopts.h
@@ -69,6 +69,7 @@ enum
// core options
#define OPTION_SYSTEMNAME core_options::unadorned(0)
+#define OPTION_SOFTWARENAME core_options::unadorned(1)
// core configuration options
#define OPTION_READCONFIG "readconfig"
@@ -217,6 +218,7 @@ public:
// core options
const char *system_name() const { return value(OPTION_SYSTEMNAME); }
+ const char *software_name() const { return value(OPTION_SOFTWARENAME); }
const game_driver *system() const;
void set_system_name(const char *name);