diff --git a/src/emu/diexec.cpp b/src/emu/diexec.cpp index 972c3ecdf96..c7f4752bd6d 100644 --- a/src/emu/diexec.cpp +++ b/src/emu/diexec.cpp @@ -345,13 +345,12 @@ 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.isnull()) + if (!m_vblank_interrupt_screen) { - 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) - osd_printf_error("VBLANK interrupt references a non-existant screen tag\n"); + 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"); } if (!m_timed_interrupt.isnull() && m_timed_interrupt_period == attotime::zero) @@ -444,9 +443,7 @@ void device_execute_interface::interface_post_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)); - } // reconfigure periodic interrupts if (m_timed_interrupt_period != attotime::zero) diff --git a/src/emu/diexec.h b/src/emu/diexec.h index 3c1e17bd156..597f3186174 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).set_vblank_int(device_interrupt_delegate(&_class::_func, #_class "::" #_func, _devtag, (_class *)nullptr), _tag); #define MCFG_DEVICE_VBLANK_INT_REMOVE() \ - dynamic_cast(*device).set_vblank_int(device_interrupt_delegate(), nullptr); + dynamic_cast(*device).set_vblank_int(device_interrupt_delegate(), finder_base::DUMMY_TAG); #define MCFG_DEVICE_PERIODIC_INT_DRIVER(_class, _func, _rate) \ dynamic_cast(*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) \ diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp index 6434419c761..00a1a6435e7 100644 --- a/src/emu/screen.cpp +++ b/src/emu/screen.cpp @@ -630,12 +630,13 @@ void screen_device::device_validity_check(validity_checker &valid) const osd_printf_error("Invalid (zero) refresh rate\n"); texture_format texformat = !m_screen_update_ind16.isnull() ? TEXFORMAT_PALETTE16 : TEXFORMAT_RGB32; - if (m_palette != nullptr) + if (m_palette.finder_tag() != finder_base::DUMMY_TAG) { + if (!m_palette) + osd_printf_error("Screen references non-existent palette tag %s\n", m_palette.finder_tag()); + if (texformat == TEXFORMAT_RGB32) - { osd_printf_warning("Screen does not need palette defined\n"); - } } else if (texformat == TEXFORMAT_PALETTE16) { @@ -659,9 +660,7 @@ void screen_device::device_resolve_objects() // assign our format to the palette before it starts if (m_palette) - { m_palette->m_format = format(); - } } @@ -689,7 +688,7 @@ void screen_device::device_start() } // if we have a palette and it's not started, wait for it - if (m_palette != nullptr && !m_palette->device().started()) + if (m_palette && !m_palette->device().started()) throw device_missing_dependencies(); // configure bitmap formats and allocate screen bitmaps @@ -962,7 +961,7 @@ void screen_device::realloc_screen_bitmaps() item->m_bitmap.resize(effwidth, effheight); // re-set up textures - if (m_palette != nullptr) + if (m_palette) { m_bitmap[0].set_palette(m_palette->palette()); m_bitmap[1].set_palette(m_palette->palette()); @@ -1334,7 +1333,7 @@ void screen_device::register_screen_bitmap(bitmap_t &bitmap) // if allocating now, just do it bitmap.allocate(width(), height()); - if (m_palette != nullptr) + if (m_palette) bitmap.set_palette(m_palette->palette()); } diff --git a/src/emu/screen.h b/src/emu/screen.h index 508c0756e37..37aaccbfabc 100644 --- a/src/emu/screen.h +++ b/src/emu/screen.h @@ -309,7 +309,7 @@ private: screen_update_ind16_delegate m_screen_update_ind16; // screen update callback (16-bit palette) screen_update_rgb32_delegate m_screen_update_rgb32; // screen update callback (32-bit RGB) devcb_write_line m_screen_vblank; // screen vblank line callback - optional_device m_palette; // our palette + optional_device m_palette; // our palette u32 m_video_attributes; // flags describing the video system const char * m_svg_region; // the region in which the svg data is in