diff options
author | therealmogminer@gmail.com <therealmogminer@gmail.com> | 2015-11-19 13:45:40 +0100 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2016-01-23 17:30:14 +0100 |
commit | d617ff8b37ccb83c9cd62d55356b2657cf69cbd3 (patch) | |
tree | 37cb3227eb4e8e14327a33aa31d5bec9a387271e /src/devices/sound | |
parent | b74eab06c50e51c5b5862db33cbfde4e76d1caf6 (diff) |
Yet more this==NULL fixes
Diffstat (limited to 'src/devices/sound')
-rw-r--r-- | src/devices/sound/es5506.cpp | 37 | ||||
-rw-r--r-- | src/devices/sound/namco.cpp | 31 | ||||
-rw-r--r-- | src/devices/sound/namco.h | 3 | ||||
-rw-r--r-- | src/devices/sound/scsp.cpp | 16 | ||||
-rw-r--r-- | src/devices/sound/scsp.h | 1 | ||||
-rw-r--r-- | src/devices/sound/tms5110.cpp | 34 | ||||
-rw-r--r-- | src/devices/sound/tms5110.h | 3 |
7 files changed, 88 insertions, 37 deletions
diff --git a/src/devices/sound/es5506.cpp b/src/devices/sound/es5506.cpp index 282ee217e15..792da85298b 100644 --- a/src/devices/sound/es5506.cpp +++ b/src/devices/sound/es5506.cpp @@ -195,10 +195,39 @@ void es5506_device::device_start() m_stream = machine().sound().stream_alloc(*this, 0, 2 * channels, clock() / (16*32)); /* initialize the regions */ - m_region_base[0] = m_region0 ? (UINT16 *)machine().root_device().memregion(m_region0)->base() : nullptr; - m_region_base[1] = m_region1 ? (UINT16 *)machine().root_device().memregion(m_region1)->base() : nullptr; - m_region_base[2] = m_region2 ? (UINT16 *)machine().root_device().memregion(m_region2)->base() : nullptr; - m_region_base[3] = m_region3 ? (UINT16 *)machine().root_device().memregion(m_region3)->base() : nullptr; + m_region_base[0] = m_region_base[1] = m_region_base[2] = m_region_base[3] = nullptr; + if (m_region0) + { + memory_region *region0 = machine().root_device().memregion(m_region0); + if (region0 != nullptr) + { + m_region_base[0] = (UINT16 *)region0->base(); + } + } + if (m_region1) + { + memory_region *region1 = machine().root_device().memregion(m_region1); + if (region1 != nullptr) + { + m_region_base[1] = (UINT16 *)region1->base(); + } + } + if (m_region2) + { + memory_region *region2 = machine().root_device().memregion(m_region2); + if (region2 != nullptr) + { + m_region_base[2] = (UINT16 *)region2->base(); + } + } + if (m_region3) + { + memory_region *region3 = machine().root_device().memregion(m_region3); + if (region3 != nullptr) + { + m_region_base[3] = (UINT16 *)region3->base(); + } + } /* initialize the rest of the structure */ m_master_clock = clock(); diff --git a/src/devices/sound/namco.cpp b/src/devices/sound/namco.cpp index 070ae056597..cc71d81ab16 100644 --- a/src/devices/sound/namco.cpp +++ b/src/devices/sound/namco.cpp @@ -37,18 +37,19 @@ const device_type NAMCO_CUS30 = &device_creator<namco_cus30_device>; namco_audio_device::namco_audio_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__), - device_sound_interface(mconfig, *this), - m_last_channel(nullptr), - m_soundregs(nullptr), - m_wavedata(nullptr), - m_wave_size(0), - m_sound_enable(0), - m_stream(nullptr), - m_namco_clock(0), - m_sample_rate(0), - m_f_fracbits(0), - m_voices(0), - m_stereo(0) + , device_sound_interface(mconfig, *this) + , m_wave_region(*this, tag) + , m_last_channel(nullptr) + , m_soundregs(nullptr) + , m_wavedata(nullptr) + , m_wave_size(0) + , m_sound_enable(0) + , m_stream(nullptr) + , m_namco_clock(0) + , m_sample_rate(0) + , m_f_fracbits(0) + , m_voices(0) + , m_stereo(0) { } @@ -95,7 +96,7 @@ void namco_audio_device::device_start() logerror("Namco: freq fractional bits = %d: internal freq = %d, output freq = %d\n", m_f_fracbits, m_namco_clock, m_sample_rate); /* build the waveform table */ - build_decoded_waveform(region()->base()); + build_decoded_waveform(m_wave_region != NULL ? m_wave_region->base() : NULL); /* get stream channels */ if (m_stereo) @@ -109,7 +110,11 @@ void namco_audio_device::device_start() /* register with the save state system */ save_pointer(NAME(m_soundregs), 0x400); +<<<<<<< HEAD if (region() == nullptr) +======= + if (m_wave_region == NULL) +>>>>>>> Yet more this==NULL fixes save_pointer(NAME(m_wavedata), 0x400); save_item(NAME(m_voices)); diff --git a/src/devices/sound/namco.h b/src/devices/sound/namco.h index e79484e4f4a..9277ac9323b 100644 --- a/src/devices/sound/namco.h +++ b/src/devices/sound/namco.h @@ -53,6 +53,9 @@ protected: void update_namco_waveform(int offset, UINT8 data); UINT32 namco_update_one(stream_sample_t *buffer, int length, const INT16 *wave, UINT32 counter, UINT32 freq); + /* waveform region */ + optional_memory_region m_wave_region; + /* data about the sound system */ sound_channel m_channel_list[MAX_VOICES]; sound_channel *m_last_channel; diff --git a/src/devices/sound/scsp.cpp b/src/devices/sound/scsp.cpp index 7a20010714d..ac4020852af 100644 --- a/src/devices/sound/scsp.cpp +++ b/src/devices/sound/scsp.cpp @@ -149,6 +149,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_ram_region(*this, tag), m_BUFPTR(0), m_SCSPRAM(nullptr), m_SCSPRAM_LENGTH(0), @@ -515,13 +516,16 @@ void scsp_device::init() m_Master=0; } - m_SCSPRAM = region()->base(); - if (m_SCSPRAM) + if (m_ram_region) { - m_SCSPRAM_LENGTH = region()->bytes(); - m_DSP.SCSPRAM = (UINT16 *)m_SCSPRAM; - m_DSP.SCSPRAM_LENGTH = m_SCSPRAM_LENGTH/2; - m_SCSPRAM += m_roffset; + m_SCSPRAM = m_ram_region->base(); + if (m_SCSPRAM) + { + m_SCSPRAM_LENGTH = m_ram_region->bytes(); + m_DSP.SCSPRAM = (UINT16 *)m_SCSPRAM; + m_DSP.SCSPRAM_LENGTH = m_SCSPRAM_LENGTH/2; + m_SCSPRAM += m_roffset; + } } m_timerA = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(scsp_device::timerA_cb), this)); diff --git a/src/devices/sound/scsp.h b/src/devices/sound/scsp.h index 981936f37db..1ad46c7028d 100644 --- a/src/devices/sound/scsp.h +++ b/src/devices/sound/scsp.h @@ -104,6 +104,7 @@ private: int m_roffset; /* offset in the region */ devcb_write8 m_irq_cb; /* irq callback */ devcb_write_line m_main_irq_cb; + optional_memory_region m_ram_region; union { diff --git a/src/devices/sound/tms5110.cpp b/src/devices/sound/tms5110.cpp index b2472563c3a..6ac5628f135 100644 --- a/src/devices/sound/tms5110.cpp +++ b/src/devices/sound/tms5110.cpp @@ -1049,7 +1049,11 @@ static const unsigned int example_word_TEN[619]={ void tms5110_device::device_start() { - m_table = region()->base(); + m_table = NULL; + if (m_table_region != NULL) + { + m_table = m_table_region->base(); + } set_variant(TMS5110_IS_TMS5110A); @@ -1532,23 +1536,25 @@ const device_type TMS5110 = &device_creator<tms5110_device>; tms5110_device::tms5110_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, TMS5110, "TMS5110", tag, owner, clock, "tms5110", __FILE__), - device_sound_interface(mconfig, *this), - m_m0_cb(*this), - m_m1_cb(*this), - m_addr_cb(*this), - m_data_cb(*this), - m_romclk_cb(*this) + , device_sound_interface(mconfig, *this) + , m_table_region(*this, tag) + , m_m0_cb(*this) + , m_m1_cb(*this) + , m_addr_cb(*this) + , m_data_cb(*this) + , m_romclk_cb(*this) { } tms5110_device::tms5110_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) - : device_t(mconfig, type, name, tag, owner, clock, shortname, source), - device_sound_interface(mconfig, *this), - m_m0_cb(*this), - m_m1_cb(*this), - m_addr_cb(*this), - m_data_cb(*this), - m_romclk_cb(*this) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source) + , device_sound_interface(mconfig, *this) + , m_table_region(*this, tag) + , m_m0_cb(*this) + , m_m1_cb(*this) + , m_addr_cb(*this) + , m_data_cb(*this) + , m_romclk_cb(*this) { } diff --git a/src/devices/sound/tms5110.h b/src/devices/sound/tms5110.h index e36c57b2d50..2a53b218323 100644 --- a/src/devices/sound/tms5110.h +++ b/src/devices/sound/tms5110.h @@ -97,6 +97,9 @@ private: void parse_frame(); // internal state + /* table region */ + optional_memory_region m_table_region; + /* coefficient tables */ int m_variant; /* Variant of the 5110 - see tms5110.h */ |