saturn: Fix regression due to an unexpected CDDA dependency (nw)

This commit is contained in:
AJR 2018-02-16 00:09:40 -05:00
parent de30d96e4c
commit ebf9b4a11d
6 changed files with 24 additions and 8 deletions

View File

@ -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 */

View File

@ -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();

View File

@ -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_device>("cdda")->get_channel_volume(0);
v = m_exts_cb(0);
if(addr == 0xee2)
v = machine().device<cdda_device>("cdda")->get_channel_volume(1);
v = m_exts_cb(1);
}
}
return v;

View File

@ -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<scsp_device &>(device).m_roffset = roffset; }
template <class Object> static devcb_base &set_irq_callback(device_t &device, Object &&cb) { return downcast<scsp_device &>(device).m_irq_cb.set_callback(std::forward<Object>(cb)); }
template <class Object> static devcb_base &set_main_irq_callback(device_t &device, Object &&cb) { return downcast<scsp_device &>(device).m_main_irq_cb.set_callback(std::forward<Object>(cb)); }
template <class Object> static devcb_base &set_exts_callback(device_t &device, Object &&cb) { return downcast<scsp_device &>(device).m_exts_cb.set_callback(std::forward<Object>(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
{

View File

@ -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)

View File

@ -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