From ebf9b4a11dfa005a5f2cafb2bbada7ed5d1e3d85 Mon Sep 17 00:00:00 2001 From: AJR Date: Fri, 16 Feb 2018 00:09:40 -0500 Subject: saturn: Fix regression due to an unexpected CDDA dependency (nw) --- src/devices/machine/stvcd.cpp | 5 +++++ src/devices/machine/stvcd.h | 6 ++++-- src/devices/sound/scsp.cpp | 8 ++++---- src/devices/sound/scsp.h | 5 +++++ src/mame/drivers/saturn.cpp | 1 + src/mame/drivers/stv.cpp | 7 +++++-- 6 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/devices/machine/stvcd.cpp b/src/devices/machine/stvcd.cpp index dda6c3db574..3535f2aa135 100644 --- a/src/devices/machine/stvcd.cpp +++ b/src/devices/machine/stvcd.cpp @@ -94,6 +94,11 @@ void stvcd_device::device_start() { } +READ16_MEMBER(stvcd_device::channel_volume_r) +{ + return m_cdda->get_channel_volume(offset); +} + int stvcd_device::get_timing_command(void) { /* TODO: calculate timings based off command params */ diff --git a/src/devices/machine/stvcd.h b/src/devices/machine/stvcd.h index a20985fd394..6931edec867 100644 --- a/src/devices/machine/stvcd.h +++ b/src/devices/machine/stvcd.h @@ -20,8 +20,10 @@ class stvcd_device : public device_t public: stvcd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - DECLARE_READ32_MEMBER( stvcd_r ); - DECLARE_WRITE32_MEMBER( stvcd_w ); + DECLARE_READ32_MEMBER(stvcd_r); + DECLARE_WRITE32_MEMBER(stvcd_w); + + DECLARE_READ16_MEMBER(channel_volume_r); void set_tray_open(); void set_tray_close(); diff --git a/src/devices/sound/scsp.cpp b/src/devices/sound/scsp.cpp index 78ea2dc3d77..8c3e6782c09 100644 --- a/src/devices/sound/scsp.cpp +++ b/src/devices/sound/scsp.cpp @@ -33,8 +33,6 @@ #include "emu.h" #include "scsp.h" -#include "sound/cdda.h" - #define ICLIP16(x) (x<-32768)?-32768:((x>32767)?32767:x) @@ -150,6 +148,7 @@ scsp_device::scsp_device(const machine_config &mconfig, const char *tag, device_ m_roffset(0), m_irq_cb(*this), m_main_irq_cb(*this), + m_exts_cb(*this), m_BUFPTR(0), m_SCSPRAM(nullptr), m_SCSPRAM_LENGTH(0), @@ -211,6 +210,7 @@ void scsp_device::device_start() // set up the IRQ callbacks m_irq_cb.resolve_safe(); m_main_irq_cb.resolve_safe(); + m_exts_cb.resolve_safe(0); m_stream = machine().sound().stream_alloc(*this, 0, 2, 44100); } @@ -1056,9 +1056,9 @@ unsigned short scsp_device::r16(address_space &space, unsigned int addr) */ logerror("SCSP: Reading from EXTS register %08x\n",addr); if(addr == 0xee0) - v = machine().device("cdda")->get_channel_volume(0); + v = m_exts_cb(0); if(addr == 0xee2) - v = machine().device("cdda")->get_channel_volume(1); + v = m_exts_cb(1); } } return v; diff --git a/src/devices/sound/scsp.h b/src/devices/sound/scsp.h index 54aad08ae5e..e1e8b7656c4 100644 --- a/src/devices/sound/scsp.h +++ b/src/devices/sound/scsp.h @@ -24,6 +24,9 @@ #define MCFG_SCSP_MAIN_IRQ_CB(_devcb) \ devcb = &scsp_device::set_main_irq_callback(*device, DEVCB_##_devcb); +#define MCFG_SCSP_EXTS_CB(_devcb) \ + devcb = &scsp_device::set_exts_callback(*device, DEVCB_##_devcb); + class scsp_device : public device_t, public device_sound_interface @@ -34,6 +37,7 @@ public: static void set_roffset(device_t &device, int roffset) { downcast(device).m_roffset = roffset; } template static devcb_base &set_irq_callback(device_t &device, Object &&cb) { return downcast(device).m_irq_cb.set_callback(std::forward(cb)); } template static devcb_base &set_main_irq_callback(device_t &device, Object &&cb) { return downcast(device).m_main_irq_cb.set_callback(std::forward(cb)); } + template static devcb_base &set_exts_callback(device_t &device, Object &&cb) { return downcast(device).m_exts_cb.set_callback(std::forward(cb)); } // SCSP register access DECLARE_READ16_MEMBER( read ); @@ -103,6 +107,7 @@ private: int m_roffset; /* offset in the region */ devcb_write8 m_irq_cb; /* irq callback */ devcb_write_line m_main_irq_cb; + devcb_read16 m_exts_cb; union { diff --git a/src/mame/drivers/saturn.cpp b/src/mame/drivers/saturn.cpp index 3e8f1efa3ab..7d1ee0c6f75 100644 --- a/src/mame/drivers/saturn.cpp +++ b/src/mame/drivers/saturn.cpp @@ -839,6 +839,7 @@ MACHINE_CONFIG_START(sat_console_state::saturn) MCFG_SOUND_ADD("scsp", SCSP, 0) MCFG_SCSP_IRQ_CB(WRITE8(saturn_state, scsp_irq)) MCFG_SCSP_MAIN_IRQ_CB(DEVWRITELINE("scu", sega_scu_device, sound_req_w)) + MCFG_SCSP_EXTS_CB(DEVREAD16("stvcd", stvcd_device, channel_volume_r)) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp index 1d83e598a44..9835fc4f6c3 100644 --- a/src/mame/drivers/stv.cpp +++ b/src/mame/drivers/stv.cpp @@ -41,11 +41,9 @@ #include "cpu/m68000/m68000.h" #include "cpu/scudsp/scudsp.h" #include "cpu/sh/sh2.h" -#include "imagedev/chd_cd.h" #include "machine/smpc.h" #include "machine/stvcd.h" #include "machine/stvprot.h" -#include "sound/cdda.h" #include "sound/scsp.h" #include "screen.h" @@ -1129,13 +1127,18 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(stv_state::stvcd) stv(config); + MCFG_DEVICE_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(stvcd_mem) MCFG_DEVICE_MODIFY("slave") MCFG_CPU_PROGRAM_MAP(stvcd_mem) + MCFG_DEVICE_ADD("stvcd", STVCD, 0) //MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) //MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + + MCFG_DEVICE_MODIFY("scsp") + MCFG_SCSP_EXTS_CB(DEVREAD16("stvcd", stvcd_device, channel_volume_r)) MACHINE_CONFIG_END -- cgit v1.2.3