diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2018-05-21 10:15:00 -0400 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2018-05-21 10:15:07 -0400 |
commit | fe342b987759b3b157e46f9103c0341a3522a1ae (patch) | |
tree | 044a04a7c7f9d24b5b77cdf4374fe7a13529b2bc | |
parent | 6cd565fee52ed0f72ac2ad9d3b3f5cc8baaaad01 (diff) |
timer.cpp: Use siblingdevice instead of absolute tag lookup; add screen tag validation for scanline timers (nw)
-rw-r--r-- | src/devices/machine/timer.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/devices/machine/timer.cpp b/src/devices/machine/timer.cpp index 1108fe0927f..e4c0643ffa3 100644 --- a/src/devices/machine/timer.cpp +++ b/src/devices/machine/timer.cpp @@ -81,6 +81,10 @@ void timer_device::device_validity_check(validity_checker &valid) const osd_printf_warning("Scanline timer specified parameters for a periodic timer\n"); if (m_param != 0) osd_printf_warning("Scanline timer specified parameter which is ignored\n"); + if (m_screen_tag == nullptr) + osd_printf_error("Scanline timer has no screen specified\n"); + else if (dynamic_cast<screen_device *>(siblingdevice(m_screen_tag)) == nullptr) + osd_printf_error("Scanline timer specifies nonexistent screen %s\n", m_screen_tag); // if (m_first_vpos < 0) // osd_printf_error("Scanline timer specified invalid initial position\n"); // if (m_increment < 0) @@ -103,7 +107,7 @@ void timer_device::device_start() { // fetch the screen if (m_screen_tag != nullptr) - m_screen = machine().device<screen_device>(m_screen_tag); + m_screen = siblingdevice<screen_device>(m_screen_tag); // allocate the timer m_timer = timer_alloc(); |