diff options
author | 2011-04-27 05:11:18 +0000 | |
---|---|---|
committer | 2011-04-27 05:11:18 +0000 | |
commit | 919913f118760c0ca41ab63512bd5c106f6fd840 (patch) | |
tree | cd6c115c8e9c5280ac4bd16eabfe69c7341151c2 /src/emu/sound/ics2115.h | |
parent | 84f2c31f7d6f6c667427b1d60c83e6dc9f420d60 (diff) |
Collapsed device_config and device_t into one class. Updated all
existing modern devices and the legacy wrappers to work in this
environment. This in general greatly simplifies writing a modern
device. [Aaron Giles]
General notes:
* some more cleanup probably needs to happen behind this change,
but I needed to get it in before the next device modernization
or import from MESS :)
* new template function device_creator which automatically defines
the static function that creates the device; use this instead of
creating a static_alloc_device_config function
* added device_stop() method which is called at around the time
the previous device_t's destructor was called; if you auto_free
anything, do it here because the machine is gone when the
destructor is called
* changed the static_set_* calls to pass a device_t & instead of
a device_config *
* for many devices, the static config structure member names over-
lapped the device's names for devcb_* functions; in these cases
the members in the interface were renamed to have a _cb suffix
* changed the driver_enumerator to only cache 100 machine_configs
because caching them all took a ton of memory; fortunately this
implementation detail is completely hidden behind the
driver_enumerator interface
* got rid of the macros for creating derived classes; doing it
manually is now clean enough that it isn't worth hiding the
details in a macro
Diffstat (limited to 'src/emu/sound/ics2115.h')
-rw-r--r-- | src/emu/sound/ics2115.h | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/src/emu/sound/ics2115.h b/src/emu/sound/ics2115.h index 047f0009007..79fc0061276 100644 --- a/src/emu/sound/ics2115.h +++ b/src/emu/sound/ics2115.h @@ -17,7 +17,7 @@ MCFG_IRQ_FUNC(_irqf) #define MCFG_IRQ_FUNC(_irqf) \ - ics2115_device_config::static_set_irqf(device, _irqf); \ + ics2115_device::static_set_irqf(*device, _irqf); \ //************************************************************************** // TYPE DEFINITIONS @@ -87,38 +87,17 @@ struct ics2115_voice { void update_ramp(); }; -// ======================> ics2115_device_config - -class ics2115_device_config : public device_config, public device_config_sound_interface -{ - friend class ics2115_device; - - // construction/destruction - ics2115_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); - -public: - // allocators - static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); - virtual device_t *alloc_device(running_machine &machine) const; - - // inline configuration helpers - static void static_set_irqf(device_config *device, void (*irqf)(device_t *device, int state)); - -protected: - // inline data - void (*m_irq_func)(device_t *device, int state); -}; - // ======================> ics2115_device class ics2115_device : public device_t, public device_sound_interface { - friend class ics2115_device_config; - +public: // construction/destruction - ics2115_device(running_machine &_machine, const ics2115_device_config &config); + ics2115_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // inline configuration helpers + static void static_set_irqf(device_t &device, void (*irqf)(device_t *device, int state)); -public: static READ8_DEVICE_HANDLER(read); static WRITE8_DEVICE_HANDLER(write); //UINT8 read(offs_t offset); @@ -140,8 +119,6 @@ protected: void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); // internal state - const ics2115_device_config &m_config; - void (*m_irq_cb)(device_t *device, int state); UINT8 *m_rom; |