diff options
Diffstat (limited to 'src/emu/devdelegate.cpp')
-rw-r--r-- | src/emu/devdelegate.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/emu/devdelegate.cpp b/src/emu/devdelegate.cpp index 380f01180e2..0396b583706 100644 --- a/src/emu/devdelegate.cpp +++ b/src/emu/devdelegate.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Aaron Giles +// copyright-holders:Aaron Giles, Vas Crabb /*************************************************************************** devdelegate.c @@ -9,29 +9,26 @@ ***************************************************************************/ #include "emu.h" +#include "devdelegate.h" -//------------------------------------------------- -// bound_object - use the device name to locate -// a device relative to the given search root; -// fatal error if not found -//------------------------------------------------- +namespace emu { namespace detail { -delegate_late_bind &device_delegate_helper::bound_object(device_t &search_root) const +delegate_late_bind &device_delegate_helper::bound_object() const { - device_t *device = search_root.subdevice(m_device_name); - if (device == nullptr) - throw emu_fatalerror("Unable to locate device '%s' relative to '%s'\n", m_device_name, search_root.tag()); + if (!m_tag) + return m_base.get(); + device_t *const device(m_base.get().subdevice(m_tag)); + if (!device) + throw emu_fatalerror("Unable to locate device '%s' relative to '%s'\n", m_tag, m_base.get().tag()); return *device; } -//------------------------------------------------- -// safe_tag - return a tag string or (unknown) if -// the object is not valid -//------------------------------------------------- - -const char *device_delegate_helper::safe_tag(device_t *object) +void device_delegate_helper::set_tag(char const *tag) { - return (object != nullptr) ? object->tag() : "(unknown)"; + m_base = m_base.get().mconfig().current_device(); + m_tag = tag; } + +} } // namespace emu::detail |