MT06548 - yes, this should use required_device and optional_device, but I have limited time so custom validity check it is

This commit is contained in:
Vas Crabb 2017-12-29 00:44:54 +11:00
parent 762bfd13f9
commit 91aeae7e49
2 changed files with 21 additions and 1 deletions

View File

@ -70,7 +70,7 @@ namco_c148_device::namco_c148_device(const machine_config &mconfig, const char *
m_out_ext1_cb(*this),
m_out_ext2_cb(*this),
m_hostcpu_tag(nullptr),
m_linked_c148_tag(nullptr)
m_linked_c148_tag(finder_base::DUMMY_TAG)
{
}
@ -135,6 +135,25 @@ void namco_c148_device::device_reset()
m_irqlevel.cpu = 0;
}
//-------------------------------------------------
// device_validity_check - device-specific checks
//-------------------------------------------------
void namco_c148_device::device_validity_check(validity_checker &valid) const
{
device_t *const hostcpu = mconfig().root_device().subdevice(m_hostcpu_tag);
if (!hostcpu)
osd_printf_error("Host CPU device %s not found\n", m_hostcpu_tag ? m_hostcpu_tag : "<nullptr>");
else if (!dynamic_cast<cpu_device *>(hostcpu))
osd_printf_error("Host CPU device %s is not an instance of cpu_device\n", m_hostcpu_tag ? m_hostcpu_tag : "<nullptr>");
device_t *const linked_c148 = mconfig().root_device().subdevice(m_linked_c148_tag);
if ((finder_base::DUMMY_TAG != m_linked_c148_tag) && !linked_c148)
osd_printf_error("Linked C148 device %s not found\n", m_linked_c148_tag ? m_linked_c148_tag : "<nullptr>");
else if (linked_c148 && !dynamic_cast<namco_c148_device *>(linked_c148))
osd_printf_error("Linked C148 device %s is not an instance of c148_device\n", m_linked_c148_tag ? m_linked_c148_tag : "<nullptr>");
}
//**************************************************************************
// IRQ section
//**************************************************************************

View File

@ -109,6 +109,7 @@ protected:
// virtual void device_validity_check(validity_checker &valid) const;
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_validity_check(validity_checker &valid) const override;
private:
cpu_device *m_hostcpu; /**< reference to the host cpu */
namco_c148_device *m_linked_c148; /**< reference to linked master/slave c148 */