summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author cam900 <dbtlrchl@naver.com>2018-12-02 00:04:10 +0900
committer ajrhacker <ajrhacker@users.noreply.github.com>2018-12-01 10:04:10 -0500
commit90ff2b28f63cceb922812c5f13472b2ca4e681dd (patch)
tree60635bb08b999d524a4472116a43aef36d49b1e0
parent071215ecd39566c29cfe4dc251b02b8b010b0299 (diff)
scsp.cpp : Add save states, Correct bool (#4357)
* scsp.cpp : Add save states, Correct bool * scsp.cpp : Fix postload functions
-rw-r--r--src/devices/sound/scsp.cpp87
-rw-r--r--src/devices/sound/scsp.h3
-rw-r--r--src/devices/sound/scspdsp.cpp4
-rw-r--r--src/devices/sound/scspdsp.h2
4 files changed, 93 insertions, 3 deletions
diff --git a/src/devices/sound/scsp.cpp b/src/devices/sound/scsp.cpp
index 89945492c06..b2744200d4b 100644
--- a/src/devices/sound/scsp.cpp
+++ b/src/devices/sound/scsp.cpp
@@ -214,6 +214,93 @@ void scsp_device::device_start()
// Stereo output with EXTS0,1 Input (External digital audio output)
m_stream = machine().sound().stream_alloc(*this, 2, 2, clock() / 512);
+
+ for (int slot = 0; slot < 32; slot++)
+ {
+ for (int i = 0; i < 0x10; i++)
+ save_item(NAME(m_Slots[slot].udata.data[i]), (i << 8) | slot);
+
+ save_item(NAME(m_Slots[slot].Backwards), slot);
+ save_item(NAME(m_Slots[slot].active), slot);
+ save_item(NAME(m_Slots[slot].cur_addr), slot);
+ save_item(NAME(m_Slots[slot].nxt_addr), slot);
+ save_item(NAME(m_Slots[slot].step), slot);
+ save_item(NAME(m_Slots[slot].EG.volume), slot);
+ save_item(NAME(m_Slots[slot].EG.step), slot);
+ save_item(NAME(m_Slots[slot].EG.AR), slot);
+ save_item(NAME(m_Slots[slot].EG.D1R), slot);
+ save_item(NAME(m_Slots[slot].EG.D2R), slot);
+ save_item(NAME(m_Slots[slot].EG.RR), slot);
+ save_item(NAME(m_Slots[slot].EG.DL), slot);
+ save_item(NAME(m_Slots[slot].EG.EGHOLD), slot);
+ save_item(NAME(m_Slots[slot].EG.LPLINK), slot);
+ save_item(NAME(m_Slots[slot].PLFO.phase), slot);
+ save_item(NAME(m_Slots[slot].PLFO.phase_step), slot);
+ save_item(NAME(m_Slots[slot].ALFO.phase), slot);
+ save_item(NAME(m_Slots[slot].ALFO.phase_step), slot);
+ }
+
+ for (int i = 0; i < 0x30/2; i++)
+ {
+ save_item(NAME(m_udata.data[i]), i);
+ }
+
+ save_item(NAME(m_RINGBUF));
+ save_item(NAME(m_BUFPTR));
+#if SCSP_FM_DELAY
+ save_item(NAME(m_DELAYBUF));
+ save_item(NAME(m_DELAYPTR));
+#endif
+
+ save_item(NAME(m_IrqTimA));
+ save_item(NAME(m_IrqTimBC));
+ save_item(NAME(m_IrqMidi));
+
+ save_item(NAME(m_MidiOutW));
+ save_item(NAME(m_MidiOutR));
+ save_item(NAME(m_MidiStack));
+ save_item(NAME(m_MidiW));
+ save_item(NAME(m_MidiR));
+
+ save_item(NAME(m_TimPris));
+ save_item(NAME(m_TimCnt));
+
+ save_item(NAME(m_dma.dmea));
+ save_item(NAME(m_dma.drga));
+ save_item(NAME(m_dma.dtlg));
+ save_item(NAME(m_dma.dgate));
+ save_item(NAME(m_dma.ddir));
+
+ save_item(NAME(m_mcieb));
+ save_item(NAME(m_mcipd));
+
+ save_item(NAME(m_DSP.RBP));
+ save_item(NAME(m_DSP.RBL));
+ save_item(NAME(m_DSP.COEF));
+ save_item(NAME(m_DSP.MADRS));
+ save_item(NAME(m_DSP.MPRO));
+ save_item(NAME(m_DSP.TEMP));
+ save_item(NAME(m_DSP.MEMS));
+ save_item(NAME(m_DSP.DEC));
+ save_item(NAME(m_DSP.MIXS));
+ save_item(NAME(m_DSP.EXTS));
+ save_item(NAME(m_DSP.EFREG));
+ save_item(NAME(m_DSP.Stopped));
+ save_item(NAME(m_DSP.Updated));
+ save_item(NAME(m_DSP.LastStep));
+}
+
+//-------------------------------------------------
+// device_post_load - called after loading a saved state
+//-------------------------------------------------
+
+void scsp_device::device_post_load()
+{
+ for (int slot = 0; slot < 32; slot++)
+ Compute_LFO(&m_Slots[slot]);
+
+ m_stream->set_output_gain(0,MVOL() / 15.0);
+ m_stream->set_output_gain(1,MVOL() / 15.0);
}
//-------------------------------------------------
diff --git a/src/devices/sound/scsp.h b/src/devices/sound/scsp.h
index 94a9162f15c..836086fac78 100644
--- a/src/devices/sound/scsp.h
+++ b/src/devices/sound/scsp.h
@@ -20,6 +20,8 @@ class scsp_device : public device_t,
public device_rom_interface
{
public:
+ static constexpr feature_type imperfect_features() { return feature::SOUND; } // DSP incorrections, etc
+
scsp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 22'579'200);
auto irq_cb() { return m_irq_cb.bind(); }
@@ -36,6 +38,7 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
+ virtual void device_post_load() override;
virtual void device_clock_changed() override;
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/scspdsp.cpp b/src/devices/sound/scspdsp.cpp
index 931a334de52..a30f3af65d3 100644
--- a/src/devices/sound/scspdsp.cpp
+++ b/src/devices/sound/scspdsp.cpp
@@ -62,7 +62,7 @@ void SCSPDSP::Init()
{
std::memset(this, 0, sizeof(*this));
RBL = 0x8000;
- Stopped = 1;
+ Stopped = true;
}
void SCSPDSP::Step()
@@ -325,7 +325,7 @@ void SCSPDSP::SetSample(int32_t sample, int SEL, int MXL)
void SCSPDSP::Start()
{
- Stopped = 0;
+ Stopped = false;
int i;
for (i = 127; i >= 0; --i)
{
diff --git a/src/devices/sound/scspdsp.h b/src/devices/sound/scspdsp.h
index 4b3dbc111a7..980935de9c0 100644
--- a/src/devices/sound/scspdsp.h
+++ b/src/devices/sound/scspdsp.h
@@ -29,7 +29,7 @@ struct SCSPDSP
//output
int16_t EFREG[16]; //EFREG, 16 bit signed
- int Stopped;
+ bool Stopped;
int LastStep;
void Init();