diff options
author | mooglyguy <therealmogminer@gmail.com> | 2018-06-03 21:13:28 +0200 |
---|---|---|
committer | mooglyguy <therealmogminer@gmail.com> | 2018-06-03 21:13:50 +0200 |
commit | daa92575c4e1242a4a85b35df03428c95065dd4f (patch) | |
tree | 0c503728bad5672987692f0d6ad7a2cbb6446d50 | |
parent | 0015f48a7527ebef1e5c3439abf0fdce2e6b5b50 (diff) |
Point conceded; it is not, at this point, sensible to make m_vblank_interrupt_screen a finder. Indeed, the need for it should be removed from diexec entirely. nw
-rw-r--r-- | src/emu/diexec.cpp | 25 | ||||
-rw-r--r-- | src/emu/diexec.h | 8 |
2 files changed, 20 insertions, 13 deletions
diff --git a/src/emu/diexec.cpp b/src/emu/diexec.cpp index c7f4752bd6d..4eaef193c61 100644 --- a/src/emu/diexec.cpp +++ b/src/emu/diexec.cpp @@ -46,7 +46,7 @@ device_execute_interface::device_execute_interface(const machine_config &mconfig : device_interface(device, "execute") , m_scheduler(nullptr) , m_disabled(false) - , m_vblank_interrupt_screen(*this, finder_base::DUMMY_TAG) + , m_vblank_interrupt_screen(nullptr) , m_timed_interrupt_period(attotime::zero) , m_nextexec(nullptr) , m_timedint_timer(nullptr) @@ -345,13 +345,14 @@ void device_execute_interface::execute_set_input(int linenum, int state) void device_execute_interface::interface_validity_check(validity_checker &valid) const { // validate the interrupts - if (!m_vblank_interrupt_screen) + if (m_vblank_interrupt.isnull()) { - if (m_vblank_interrupt_screen.finder_tag() != finder_base::DUMMY_TAG) - osd_printf_error("VBLANK interrupt references non-existent screen tag %s\n", m_vblank_interrupt_screen.finder_tag()); - else if (!m_vblank_interrupt.isnull()) - osd_printf_error("VBLANK interrupt specified, but no screen configured\n"); - } + screen_device_iterator iter(device().mconfig().root_device()); + if (iter.first() == nullptr) + osd_printf_error("VBLANK interrupt specified, but the driver is screenless\n"); + else if (m_vblank_interrupt_screen != nullptr && device().siblingdevice(m_vblank_interrupt_screen) == nullptr) + osd_printf_error("VBLANK interrupt references a non-existant screen tag '%s'\n", m_vblank_interrupt_screen); + } if (!m_timed_interrupt.isnull() && m_timed_interrupt_period == attotime::zero) osd_printf_error("Timed interrupt handler specified with 0 period\n"); @@ -442,8 +443,14 @@ void device_execute_interface::interface_post_reset() elem.reset(); // reconfingure VBLANK interrupts - if (m_vblank_interrupt_screen) - m_vblank_interrupt_screen->register_vblank_callback(vblank_state_delegate(&device_execute_interface::on_vblank, this)); + if (m_vblank_interrupt_screen != nullptr) + { + // get the screen that will trigger the VBLANK + screen_device * screen = device().siblingdevice<screen_device>(m_vblank_interrupt_screen); + + assert(screen != nullptr); + screen->register_vblank_callback(vblank_state_delegate(&device_execute_interface::on_vblank, this)); + } // reconfigure periodic interrupts if (m_timed_interrupt_period != attotime::zero) diff --git a/src/emu/diexec.h b/src/emu/diexec.h index 597f3186174..dd3c5c54727 100644 --- a/src/emu/diexec.h +++ b/src/emu/diexec.h @@ -86,7 +86,7 @@ enum #define MCFG_DEVICE_VBLANK_INT_DEVICE(_tag, _devtag, _class, _func) \ dynamic_cast<device_execute_interface &>(*device).set_vblank_int(device_interrupt_delegate(&_class::_func, #_class "::" #_func, _devtag, (_class *)nullptr), _tag); #define MCFG_DEVICE_VBLANK_INT_REMOVE() \ - dynamic_cast<device_execute_interface &>(*device).set_vblank_int(device_interrupt_delegate(), finder_base::DUMMY_TAG); + dynamic_cast<device_execute_interface &>(*device).set_vblank_int(device_interrupt_delegate(), nullptr); #define MCFG_DEVICE_PERIODIC_INT_DRIVER(_class, _func, _rate) \ dynamic_cast<device_execute_interface &>(*device).set_periodic_int(device_interrupt_delegate(&_class::_func, #_class "::" #_func, DEVICE_SELF, (_class *)nullptr), attotime::from_hz(_rate)); #define MCFG_DEVICE_PERIODIC_INT_DEVICE(_devtag, _class, _func, _rate) \ @@ -140,10 +140,10 @@ public: // inline configuration helpers void set_disable() { m_disabled = true; } - template <typename Object, typename T> void set_vblank_int(Object &&cb, T &&tag, int rate = 0) + template <typename Object> void set_vblank_int(Object &&cb, const char *tag, int rate = 0) { m_vblank_interrupt = std::forward<Object>(cb); - m_vblank_interrupt_screen.set_tag(std::forward<T>(tag)); + m_vblank_interrupt_screen = tag; } template <typename Object> void set_periodic_int(Object &&cb, const attotime &rate) { @@ -290,7 +290,7 @@ private: // configuration bool m_disabled; // disabled from executing? device_interrupt_delegate m_vblank_interrupt; // for interrupts tied to VBLANK - optional_device<screen_device> m_vblank_interrupt_screen; // the screen that causes the VBLANK interrupt + const char * m_vblank_interrupt_screen; // the screen that causes the VBLANK interrupt device_interrupt_delegate m_timed_interrupt; // for interrupts not tied to VBLANK attotime m_timed_interrupt_period; // period for periodic interrupts |