Fixed crash because nes_apu was always binding to root_device() before the n2a03 took over. (nw)

This commit is contained in:
smf- 2016-11-05 09:41:13 +00:00
parent aea3cef80a
commit 9d2dcbaea1
3 changed files with 2 additions and 21 deletions

View File

@ -71,8 +71,6 @@ void n2a03_device::device_start()
else
mintf = new mi_2a03_normal;
m_apu->set_tag_memory(tag());
init();
}

View File

@ -110,8 +110,7 @@ nesapu_device::nesapu_device(const machine_config &mconfig, const char *tag, dev
m_samps_per_sync(0),
m_buffer_size(0),
m_real_rate(0),
m_stream(nullptr),
m_cpu_tag("")
m_stream(nullptr)
{
for (auto & elem : m_noise_lut)
{
@ -134,13 +133,6 @@ nesapu_device::nesapu_device(const machine_config &mconfig, const char *tag, dev
}
}
void nesapu_device::set_tag_memory(const char *tag)
{
/* Initialize individual chips */
if (tag)
(m_APU.dpcm).memory = &machine().device(tag)->memory().space(AS_PROGRAM);
}
void nesapu_device::device_clock_changed()
{
calculate_rates();
@ -184,7 +176,7 @@ void nesapu_device::device_start()
{
create_noise(m_noise_lut, 13, NOISE_LONG);
set_tag_memory(m_cpu_tag);
(m_APU.dpcm).memory = &downcast<n2a03_device &>(*owner()).space(AS_PROGRAM);
calculate_rates();

View File

@ -50,9 +50,6 @@ public:
nesapu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
~nesapu_device() {}
static void set_cpu_tag(device_t &device, const char *tag) { downcast<nesapu_device &>(device).m_cpu_tag = tag; }
void set_tag_memory(const char *tag);
virtual void device_clock_changed() override;
DECLARE_READ8_MEMBER( read );
@ -78,8 +75,6 @@ private:
uint32 m_sync_times2[SYNCS_MAX2]; /* Samples per sync table */
sound_stream *m_stream;
const char *m_cpu_tag;
void calculate_rates();
void create_syncs(unsigned long sps);
int8 apu_square(square_t *chan);
@ -93,8 +88,4 @@ private:
extern const device_type NES_APU;
#define MCFG_NES_APU_CPU(_tag) \
nesapu_device::set_cpu_tag(*device, _tag);
#endif /* __NES_APU_H__ */