summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/mconfig.c
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2012-02-11 16:15:39 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2012-02-11 16:15:39 +0000
commit5596c512fc7f049a22b5faef0a8146686f90e332 (patch)
tree2b8027be3d35184c9189ddd64c27342b50bf02c1 /src/emu/mconfig.c
parent5cb480e748ded154c4a4198c24844795c2e6090e (diff)
Sync core fixes from MESS done by OG (nw)
Diffstat (limited to 'src/emu/mconfig.c')
-rw-r--r--src/emu/mconfig.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/emu/mconfig.c b/src/emu/mconfig.c
index 60b9fc72be7..bd2d236b5c7 100644
--- a/src/emu/mconfig.c
+++ b/src/emu/mconfig.c
@@ -141,6 +141,33 @@ screen_device *machine_config::first_screen() const
device_t *machine_config::device_add(device_t *owner, const char *tag, device_type type, UINT32 clock)
{
+ const char *orig_tag = tag;
+
+ // if the device path is absolute, start from the root
+ if (tag[0] == ':')
+ {
+ tag++;
+ owner = m_root_device;
+ }
+
+ // go down the path until we're done with it
+ while (strchr(tag, ':'))
+ {
+ const char *next = strchr(tag, ':');
+ assert(next != tag);
+ astring part(tag, next-tag);
+ device_t *curdevice;
+ for (curdevice = owner->m_subdevice_list.first(); curdevice != NULL; curdevice = curdevice->next())
+ if (part == curdevice->m_basetag)
+ break;
+ if (!curdevice)
+ throw emu_fatalerror("Could not find %s when looking up path for device %s\n",
+ part.cstr(), orig_tag);
+ owner = curdevice;
+ tag = next+1;
+ }
+ assert(tag[0]);
+
// if there's an owner, let the owner do the work
if (owner != NULL)
return owner->add_subdevice(type, tag, clock);