From 17aa09603a67d89879ecc6778ca9e7916db279c0 Mon Sep 17 00:00:00 2001 From: smf- Date: Sat, 25 Aug 2012 22:04:22 +0000 Subject: [PATCH] use device_t.static_set_static_config --- src/emu/machine/am53cf96.c | 16 ++++++++++------ src/emu/machine/am53cf96.h | 8 +++----- src/emu/machine/wd33c93.c | 16 ++++++++++------ src/emu/machine/wd33c93.h | 8 +++----- 4 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/emu/machine/am53cf96.c b/src/emu/machine/am53cf96.c index 586529f7190..01278f584f5 100644 --- a/src/emu/machine/am53cf96.c +++ b/src/emu/machine/am53cf96.c @@ -162,6 +162,16 @@ am53cf96_device::am53cf96_device(const machine_config &mconfig, const char *tag, { } +void am53cf96_device::device_config_complete() +{ + // inherit a copy of the static data + const AM53CF96interface *intf = reinterpret_cast(static_config()); + if (intf != NULL) + { + *static_cast(this) = *intf; + } +} + void am53cf96_device::device_start() { memset(scsi_regs, 0, sizeof(scsi_regs)); @@ -186,12 +196,6 @@ void am53cf96_device::device_start() m_transfer_timer = timer_alloc( TIMER_TRANSFER ); } -void am53cf96_device::static_set_interface(device_t &device, const AM53CF96interface &interface) -{ - am53cf96_device &am53cf96 = downcast(device); - static_cast(am53cf96) = interface; -} - // retrieve data from the SCSI controller void am53cf96_device::dma_read_data(int bytes, UINT8 *pData) { diff --git a/src/emu/machine/am53cf96.h b/src/emu/machine/am53cf96.h index 695f48bfd8b..83dbc7a934b 100644 --- a/src/emu/machine/am53cf96.h +++ b/src/emu/machine/am53cf96.h @@ -15,9 +15,9 @@ struct AM53CF96interface void (*irq_callback)(running_machine &machine); /* irq callback */ }; -#define MCFG_AM53CF96_ADD( _tag, _interface ) \ +#define MCFG_AM53CF96_ADD( _tag, _config ) \ MCFG_DEVICE_ADD( _tag, AM53CF96, 0 ) \ - am53cf96_device::static_set_interface(*device, _interface); + MCFG_DEVICE_CONFIG(_config) // 53CF96 register set enum @@ -48,9 +48,6 @@ public: // construction/destruction am53cf96_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - // inline configuration helpers - static void static_set_interface(device_t &device, const AM53CF96interface &interface); - DECLARE_READ8_MEMBER(read); DECLARE_WRITE8_MEMBER(write); @@ -59,6 +56,7 @@ public: protected: // device-level overrides + virtual void device_config_complete(); virtual void device_start(); virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); diff --git a/src/emu/machine/wd33c93.c b/src/emu/machine/wd33c93.c index 4f5723c24e7..3b2f6da292f 100644 --- a/src/emu/machine/wd33c93.c +++ b/src/emu/machine/wd33c93.c @@ -744,6 +744,16 @@ wd33c93_device::wd33c93_device(const machine_config &mconfig, const char *tag, d { } +void wd33c93_device::device_config_complete() +{ + // inherit a copy of the static data + const WD33C93interface *intf = reinterpret_cast(static_config()); + if (intf != NULL) + { + *static_cast(this) = *intf; + } +} + void wd33c93_device::device_start() { memset(®s, 0, sizeof(regs)); @@ -772,12 +782,6 @@ void wd33c93_device::device_start() save_item( NAME( read_pending ) ); } -void wd33c93_device::static_set_interface(device_t &device, const WD33C93interface &interface) -{ - wd33c93_device &wd33c93 = downcast(device); - static_cast(wd33c93) = interface; -} - void wd33c93_device::get_dma_data( int bytes, UINT8 *pData ) { int len = bytes; diff --git a/src/emu/machine/wd33c93.h b/src/emu/machine/wd33c93.h index e4b23bad385..654618b5853 100644 --- a/src/emu/machine/wd33c93.h +++ b/src/emu/machine/wd33c93.h @@ -52,9 +52,9 @@ enum #define TEMP_INPUT_LEN 262144 #define FIFO_SIZE 12 -#define MCFG_WD33C93_ADD( _tag, _interface ) \ +#define MCFG_WD33C93_ADD( _tag, _config ) \ MCFG_DEVICE_ADD( _tag, WD33C93, 0 ) \ - wd33c93_device::static_set_interface(*device, _interface); + MCFG_DEVICE_CONFIG(_config) class wd33c93_device : public device_t, public WD33C93interface @@ -63,9 +63,6 @@ public: // construction/destruction wd33c93_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - // inline configuration helpers - static void static_set_interface(device_t &device, const WD33C93interface &interface); - DECLARE_READ8_MEMBER(read); DECLARE_WRITE8_MEMBER(write); @@ -76,6 +73,7 @@ public: protected: // device-level overrides + virtual void device_config_complete(); virtual void device_start(); virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);