summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author smf- <smf-@users.noreply.github.com>2018-07-28 12:54:08 +0100
committer smf- <smf-@users.noreply.github.com>2018-07-28 12:54:08 +0100
commit2612cd60c0e18173b1476413959280214141bf2a (patch)
treebdd0f577ea154a98ed3e2ec81faa10cf448e0bb2
parent982077e1614c82a6328cb96afbc621a607a6d950 (diff)
vgmplay: Fixed K054539 [smf]
-rw-r--r--src/devices/sound/k054539.cpp5
-rw-r--r--src/devices/sound/k054539.h1
-rw-r--r--src/mame/drivers/vgmplay.cpp8
3 files changed, 12 insertions, 2 deletions
diff --git a/src/devices/sound/k054539.cpp b/src/devices/sound/k054539.cpp
index 862f8e2f175..35f45bf4fa6 100644
--- a/src/devices/sound/k054539.cpp
+++ b/src/devices/sound/k054539.cpp
@@ -535,6 +535,11 @@ void k054539_device::device_start()
init_chip();
}
+void k054539_device::device_clock_changed()
+{
+ stream->set_sample_rate(clock() / 384);
+}
+
void k054539_device::device_reset()
{
regs[0x22c] = 0;
diff --git a/src/devices/sound/k054539.h b/src/devices/sound/k054539.h
index a8a6507963a..0b79173f205 100644
--- a/src/devices/sound/k054539.h
+++ b/src/devices/sound/k054539.h
@@ -67,6 +67,7 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
+ virtual void device_clock_changed() override;
virtual void device_reset() override;
virtual void device_post_load() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
diff --git a/src/mame/drivers/vgmplay.cpp b/src/mame/drivers/vgmplay.cpp
index 790dadc3ab8..5e9cea25ac7 100644
--- a/src/mame/drivers/vgmplay.cpp
+++ b/src/mame/drivers/vgmplay.cpp
@@ -885,7 +885,7 @@ void vgmplay_device::execute_run()
case 0xd3: {
pulse_act_led(LED_K054539);
- uint16_t offset = m_file->read_byte(m_pc+1) << 16 | m_file->read_byte(m_pc+2);
+ uint16_t offset = m_file->read_byte(m_pc+1) << 8 | m_file->read_byte(m_pc+2);
if (offset & 0x8000)
m_io->write_byte(A_K054539B + (offset & 0x3ff), m_file->read_byte(m_pc+3));
else
@@ -1611,6 +1611,8 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state, load_file)
if (version >= 0x161 && data_start >= 0xa0 && (r32(0x9c) & 0x40000000))
logerror("Warning: file requests an unsupported 2nd K051649\n");
+ m_k054539[0]->set_clock_scale(384); // HACK: VGMs contain 48,000 instead of 18,432,000
+ m_k054539[1]->set_clock_scale(384); // HACK: VGMs contain 48,000 instead of 18,432,000
m_k054539[0]->set_unscaled_clock(version >= 0x161 && data_start >= 0xa4 ? r32(0xa0) & ~0x40000000 : 0);
m_k054539[1]->set_unscaled_clock(version >= 0x161 && data_start >= 0xa4 && (r32(0xa0) & 0x40000000) ? r32(0xa0) & ~0x40000000 : 0);
@@ -1627,7 +1629,9 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state, load_file)
m_pokey[0]->set_unscaled_clock(version >= 0x161 && data_start >= 0xb4 ? r32(0xb0) & ~0x40000000 : 0);
m_pokey[1]->set_unscaled_clock(version >= 0x161 && data_start >= 0xb4 && (r32(0xb0) & 0x40000000) ? r32(0xb0) & ~0x40000000 : 0);
- m_qsound->set_unscaled_clock(version >= 0x161 && data_start >= 0xb8 ? r32(0xb4) * 15 : 0); // * 15 multipler for correct pitch
+
+ m_qsound->set_clock_scale(15); // HACK: VGMs contain 4,000,000 instead of 60,000,000
+ m_qsound->set_unscaled_clock(version >= 0x161 && data_start >= 0xb8 ? r32(0xb4) : 0);
if (version >= 0x151 && data_start >= 0xbc && r32(0xb8))
logerror("Warning: file requests an unsupported SCSP\n");