diff options
Diffstat (limited to 'src/emu/devdelegate.cpp')
-rw-r--r-- | src/emu/devdelegate.cpp | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/src/emu/devdelegate.cpp b/src/emu/devdelegate.cpp index 380f01180e2..7f50f3112e1 100644 --- a/src/emu/devdelegate.cpp +++ b/src/emu/devdelegate.cpp @@ -1,37 +1,34 @@ // license:BSD-3-Clause -// copyright-holders:Aaron Giles +// copyright-holders:Aaron Giles, Vas Crabb /*************************************************************************** - devdelegate.c + devdelegate.cpp Delegates that are late-bound to MAME devices. ***************************************************************************/ #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::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 |