ti99: Replaced static_cast with dynamic_cast (mametesters 06824)

This commit is contained in:
Michael Zapf 2024-03-28 23:34:02 +01:00
parent 337e10a21f
commit bc7c4e397f
5 changed files with 25 additions and 13 deletions

View File

@ -452,7 +452,8 @@ bool ti99_cartridge_device::is_grom_idle()
void ti99_cartridge_device::device_config_complete()
{
m_connector = static_cast<cartridge_connector_device*>(owner());
m_connector = dynamic_cast<cartridge_connector_device*>(owner());
// owner is the empty_state during -listxml, so this will be nullptr
}
/*

View File

@ -244,7 +244,12 @@ bool gromport_device::is_grom_idle()
void gromport_device::device_config_complete()
{
m_connector = downcast<cartridge_connector_device*>(subdevices().first());
if (subdevices().first() != nullptr)
{
m_connector = dynamic_cast<cartridge_connector_device*>(subdevices().first());
if (m_connector == nullptr)
throw emu_fatalerror("gromport_device: cartridge connector not found");
}
}
INPUT_PORTS_START(gromport)
@ -283,7 +288,8 @@ void cartridge_connector_device::ready_line(int state)
void cartridge_connector_device::device_config_complete()
{
m_gromport = static_cast<gromport_device*>(owner());
m_gromport = dynamic_cast<gromport_device*>(owner());
// owner is the empty_state during -listxml, so this will be nullptr
}
} // end namespace bus::ti99::gromport

View File

@ -567,9 +567,10 @@ ROM_END
void corcomp_dcc_device::device_config_complete()
{
m_decpal = static_cast<ccfdc_dec_pal_device*>(subdevice(CCDCC_PALU2_TAG));
m_ctrlpal = static_cast<ccfdc_sel_pal_device*>(subdevice(CCDCC_PALU1_TAG));
connect_drives();
m_decpal = dynamic_cast<ccfdc_dec_pal_device*>(subdevice(CCDCC_PALU2_TAG));
m_ctrlpal = dynamic_cast<ccfdc_sel_pal_device*>(subdevice(CCDCC_PALU1_TAG));
if (m_decpal != nullptr)
connect_drives();
}
ioport_constructor corcomp_fdc_device::device_input_ports() const
@ -605,7 +606,8 @@ ccfdc_sel_pal_device::ccfdc_sel_pal_device(const machine_config &mconfig, device
void ccfdc_dec_pal_device::device_config_complete()
{
m_board = static_cast<corcomp_fdc_device*>(owner());
m_board = dynamic_cast<corcomp_fdc_device*>(owner());
// owner is the empty_state during -listxml, so this will be nullptr
}
/*
@ -707,8 +709,9 @@ int ccdcc_palu1_device::ready_out()
void ccdcc_palu1_device::device_config_complete()
{
m_board = static_cast<corcomp_fdc_device*>(owner());
m_decpal = static_cast<ccfdc_dec_pal_device*>(owner()->subdevice(CCDCC_PALU2_TAG));
m_board = dynamic_cast<corcomp_fdc_device*>(owner());
m_decpal = dynamic_cast<ccfdc_dec_pal_device*>(owner()->subdevice(CCDCC_PALU2_TAG));
// owner is the empty_state during -listxml, so this will be nullptr
}
// ============================================================================
@ -825,8 +828,8 @@ int ccfdc_palu6_device::ready_out()
void ccfdc_palu6_device::device_config_complete()
{
m_board = static_cast<corcomp_fdca_device*>(owner());
m_decpal = static_cast<ccfdc_dec_pal_device*>(owner()->subdevice(CCFDC_PALU12_TAG));
m_board = dynamic_cast<corcomp_fdca_device*>(owner());
m_decpal = dynamic_cast<ccfdc_dec_pal_device*>(owner()->subdevice(CCFDC_PALU12_TAG));
}
} // end namespace bus::ti99::peb

View File

@ -514,7 +514,8 @@ bool ddcc1_pal_device::cs259()
void ddcc1_pal_device::device_config_complete()
{
m_board = static_cast<myarc_fdc_device*>(owner());
m_board = dynamic_cast<myarc_fdc_device*>(owner());
// owner is the empty_state during -listxml, so this will be nullptr
}
} // end namespace bus::ti99::peb

View File

@ -697,7 +697,8 @@ void whtscsi_pld_device::update_line_states(int address, bool drq, bool irq)
void whtscsi_pld_device::device_config_complete()
{
m_board = static_cast<whtech_scsi_card_device*>(owner());
m_board = dynamic_cast<whtech_scsi_card_device*>(owner());
// owner is the empty_state during -listxml, so this will be nullptr
}
} // end namespace bus::ti99::peb