fixup, improve validation (nw)

This commit is contained in:
Vas Crabb 2018-06-01 21:50:19 +10:00
parent d1f0520444
commit ff9123d8ef
4 changed files with 14 additions and 18 deletions

View File

@ -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 void device_execute_interface::interface_validity_check(validity_checker &valid) const
{ {
// validate the interrupts // validate the interrupts
if (!m_vblank_interrupt.isnull()) if (!m_vblank_interrupt_screen)
{ {
screen_device_iterator iter(device().mconfig().root_device()); if (m_vblank_interrupt_screen.finder_tag() != finder_base::DUMMY_TAG)
if (iter.first() == nullptr) osd_printf_error("VBLANK interrupt references non-existent screen tag %s\n", m_vblank_interrupt_screen.finder_tag());
osd_printf_error("VBLANK interrupt specified, but the driver is screenless\n"); else if (!m_vblank_interrupt.isnull())
else if (m_vblank_interrupt_screen == nullptr) osd_printf_error("VBLANK interrupt specified, but no screen configured\n");
osd_printf_error("VBLANK interrupt references a non-existant screen tag\n");
} }
if (!m_timed_interrupt.isnull() && m_timed_interrupt_period == attotime::zero) 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 // reconfingure VBLANK interrupts
if (m_vblank_interrupt_screen) if (m_vblank_interrupt_screen)
{
m_vblank_interrupt_screen->register_vblank_callback(vblank_state_delegate(&device_execute_interface::on_vblank, this)); m_vblank_interrupt_screen->register_vblank_callback(vblank_state_delegate(&device_execute_interface::on_vblank, this));
}
// reconfigure periodic interrupts // reconfigure periodic interrupts
if (m_timed_interrupt_period != attotime::zero) if (m_timed_interrupt_period != attotime::zero)

View File

@ -86,7 +86,7 @@ enum
#define MCFG_DEVICE_VBLANK_INT_DEVICE(_tag, _devtag, _class, _func) \ #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); 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() \ #define MCFG_DEVICE_VBLANK_INT_REMOVE() \
dynamic_cast<device_execute_interface &>(*device).set_vblank_int(device_interrupt_delegate(), nullptr); dynamic_cast<device_execute_interface &>(*device).set_vblank_int(device_interrupt_delegate(), finder_base::DUMMY_TAG);
#define MCFG_DEVICE_PERIODIC_INT_DRIVER(_class, _func, _rate) \ #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)); 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) \ #define MCFG_DEVICE_PERIODIC_INT_DEVICE(_devtag, _class, _func, _rate) \

View File

@ -630,12 +630,13 @@ void screen_device::device_validity_check(validity_checker &valid) const
osd_printf_error("Invalid (zero) refresh rate\n"); osd_printf_error("Invalid (zero) refresh rate\n");
texture_format texformat = !m_screen_update_ind16.isnull() ? TEXFORMAT_PALETTE16 : TEXFORMAT_RGB32; 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) if (texformat == TEXFORMAT_RGB32)
{
osd_printf_warning("Screen does not need palette defined\n"); osd_printf_warning("Screen does not need palette defined\n");
}
} }
else if (texformat == TEXFORMAT_PALETTE16) else if (texformat == TEXFORMAT_PALETTE16)
{ {
@ -659,9 +660,7 @@ void screen_device::device_resolve_objects()
// assign our format to the palette before it starts // assign our format to the palette before it starts
if (m_palette) if (m_palette)
{
m_palette->m_format = format(); 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 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(); throw device_missing_dependencies();
// configure bitmap formats and allocate screen bitmaps // configure bitmap formats and allocate screen bitmaps
@ -962,7 +961,7 @@ void screen_device::realloc_screen_bitmaps()
item->m_bitmap.resize(effwidth, effheight); item->m_bitmap.resize(effwidth, effheight);
// re-set up textures // re-set up textures
if (m_palette != nullptr) if (m_palette)
{ {
m_bitmap[0].set_palette(m_palette->palette()); m_bitmap[0].set_palette(m_palette->palette());
m_bitmap[1].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 // if allocating now, just do it
bitmap.allocate(width(), height()); bitmap.allocate(width(), height());
if (m_palette != nullptr) if (m_palette)
bitmap.set_palette(m_palette->palette()); bitmap.set_palette(m_palette->palette());
} }

View File

@ -309,7 +309,7 @@ private:
screen_update_ind16_delegate m_screen_update_ind16; // screen update callback (16-bit palette) 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) screen_update_rgb32_delegate m_screen_update_rgb32; // screen update callback (32-bit RGB)
devcb_write_line m_screen_vblank; // screen vblank line callback devcb_write_line m_screen_vblank; // screen vblank line callback
optional_device<palette_device> m_palette; // our palette optional_device<device_palette_interface> m_palette; // our palette
u32 m_video_attributes; // flags describing the video system u32 m_video_attributes; // flags describing the video system
const char * m_svg_region; // the region in which the svg data is in const char * m_svg_region; // the region in which the svg data is in