megacdcd: Eliminate machine().device (nw)

This commit is contained in:
AJR 2019-05-16 21:33:24 -04:00
parent 7445de12e3
commit 31bc949682
4 changed files with 21 additions and 15 deletions

View File

@ -1054,6 +1054,7 @@ void ngcd_state::neocd(machine_config &config)
// temporary until things are cleaned up
LC89510_TEMP(config, m_tempcdc, 0); // cd controller
m_tempcdc->set_cdrom_tag("cdrom");
m_tempcdc->set_is_neoCD(true);
m_tempcdc->set_type1_interrupt_callback(FUNC(ngcd_state::interrupt_callback_type1), this);
m_tempcdc->set_type2_interrupt_callback(FUNC(ngcd_state::interrupt_callback_type2), this);

View File

@ -303,6 +303,8 @@ void sega_segacd_device::device_add_mconfig(machine_config &config)
// temporary until things are cleaned up
LC89510_TEMP(config, m_lc89510_temp, 0); // cd controller
m_lc89510_temp->set_cdc_do_dma_callback(FUNC(sega_segacd_device::SegaCD_CDC_Do_DMA), this); // hack
m_lc89510_temp->set_cdrom_tag("^cdrom");
m_lc89510_temp->set_68k_tag(m_scdcpu);
TIMER(config, m_stopwatch_timer).configure_generic(timer_device::expired_delegate()); //stopwatch timer
TIMER(config, m_stamp_timer).configure_generic(FUNC(sega_segacd_device::stamp_timer_callback));

View File

@ -98,17 +98,17 @@
#define CHECK_SCD_LV5_INTERRUPT \
if (segacd_irq_mask & 0x20) \
{ \
machine.device(":segacd:segacd_68k")->execute().set_input_line(5, HOLD_LINE); \
m_68k->set_input_line(5, HOLD_LINE); \
}
#define CHECK_SCD_LV4_INTERRUPT \
if (segacd_irq_mask & 0x10) \
{ \
machine.device(":segacd:segacd_68k")->execute().set_input_line(4, HOLD_LINE); \
m_68k->set_input_line(4, HOLD_LINE); \
}
#define CHECK_SCD_LV4_INTERRUPT_A \
if (segacd_irq_mask & 0x10) \
{ \
machine().device(":segacd:segacd_68k")->execute().set_input_line(4, HOLD_LINE); \
m_68k->set_input_line(4, HOLD_LINE); \
}
@ -135,6 +135,9 @@ DEFINE_DEVICE_TYPE(LC89510_TEMP, lc89510_temp_device, "lc89510_temp", "lc89510_t
lc89510_temp_device::lc89510_temp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, LC89510_TEMP, tag, owner, clock)
, m_cdrom(*this, finder_base::DUMMY_TAG)
, m_cdda(*this, "cdda")
, m_68k(*this, finder_base::DUMMY_TAG)
{
segacd_dma_callback = segacd_dma_delegate(FUNC(lc89510_temp_device::Fake_CDC_Do_DMA), this);
type1_interrupt_callback = interrupt_delegate(FUNC(lc89510_temp_device::dummy_interrupt_callback), this);
@ -173,8 +176,6 @@ void lc89510_temp_device::device_start()
type1_interrupt_callback.bind_relative_to(*owner());
type2_interrupt_callback.bind_relative_to(*owner());
type3_interrupt_callback.bind_relative_to(*owner());
m_cdda = (cdda_device*)subdevice("cdda");
}
void lc89510_temp_device::device_reset()
@ -1105,16 +1106,12 @@ void lc89510_temp_device::reset_cd(void)
lc89510_Reset();
{
cdrom_image_device *cddevice = machine().device<cdrom_image_device>("cdrom");
if ( cddevice )
segacd.cd = m_cdrom->get_cdrom_file();
if ( segacd.cd )
{
segacd.cd = cddevice->get_cdrom_file();
if ( segacd.cd )
{
segacd.toc = cdrom_get_toc( segacd.cd );
m_cdda->set_cdrom(segacd.cd);
m_cdda->stop_audio(); //stop any pending CD-DA
}
segacd.toc = cdrom_get_toc( segacd.cd );
m_cdda->set_cdrom(segacd.cd);
m_cdda->stop_audio(); //stop any pending CD-DA
}
}

View File

@ -23,6 +23,9 @@ public:
template <typename... T> void set_cdc_do_dma_callback(T &&... args) { segacd_dma_callback = segacd_dma_delegate(std::forward<T>(args)...); }
template <typename T> void set_cdrom_tag(T &&tag) { m_cdrom.set_tag(std::forward<T>(tag)); }
template <typename T> void set_68k_tag(T &&tag) { m_68k.set_tag(std::forward<T>(tag)); }
lc89510_temp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@ -79,7 +82,11 @@ protected:
void dummy_interrupt_callback(void);
required_device<cdrom_image_device> m_cdrom;
required_device<cdda_device> m_cdda;
// HACK for neoCD handling
optional_device<cpu_device> m_68k;
bool is_neoCD;
@ -159,7 +166,6 @@ protected:
bool CDD_Import(running_machine& machine);
uint16_t segacd_irq_mask;
cdda_device* m_cdda;
/* NeoCD */
uint16_t nff0002;