vgmplay don't crash on YM3438 songs [smf]

This commit is contained in:
smf- 2018-07-28 13:57:34 +01:00
parent 2612cd60c0
commit 2b8fc7d6f5
4 changed files with 14 additions and 2 deletions

View File

@ -42,7 +42,7 @@ void ym2612_device::device_timer(emu_timer &timer, device_timer_id id, int param
void ym2612_device::timer_handler(int c,int count,int clock)
{
if( count == 0 )
if( count == 0 || clock == 0 )
{ /* Reset FM Timer */
m_timer[c]->enable(false);
}

View File

@ -65,6 +65,15 @@ void rf5c68_device::device_start()
save_item(NAME(m_enable));
}
//-------------------------------------------------
// device_clock_changed
//-------------------------------------------------
void rf5c68_device::device_clock_changed()
{
m_stream->set_sample_rate(clock() / 384);
}
//-------------------------------------------------
// memory_space_config - return a description of
// any address spaces owned by this device

View File

@ -46,6 +46,7 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_clock_changed() override;
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;

View File

@ -1515,7 +1515,9 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state, load_file)
if (r32(0x10) & 0x40000000)
logerror("Warning: file requests an unsupported 2nd YM2413\n");
m_ym2612->set_unscaled_clock((version >= 0x110 ? r32(0x2c) : r32(0x10)) & ~0x40000000);
m_ym2612->set_unscaled_clock((version >= 0x110 ? r32(0x2c) : r32(0x10)) & ~0xc0000000);
if (version >= 0x110 && (r32(0x2c) & 0x80000000))
logerror("Warning: file requests an unsupported YM3438\n");
if (version >= 0x110 && (r32(0x2c) & 0x40000000))
logerror("Warning: file requests an unsupported 2nd YM2612\n");