diff --git a/src/mame/audio/atarijsa.h b/src/mame/audio/atarijsa.h index 0bcc1d26d44..f8cef0ca4a4 100644 --- a/src/mame/audio/atarijsa.h +++ b/src/mame/audio/atarijsa.h @@ -38,22 +38,22 @@ DECLARE_DEVICE_TYPE(ATARI_JSA_IIIS, atari_jsa_iiis_device) #define MCFG_ATARI_JSA_I_ADD(_tag, _intcb) \ MCFG_DEVICE_ADD(_tag, ATARI_JSA_I, 0) \ - devcb = &atari_jsa_i_device::static_set_main_int_cb(*device, DEVCB_##_intcb); + devcb = &downcast(*device).set_main_int_cb(DEVCB_##_intcb); #define MCFG_ATARI_JSA_II_ADD(_tag, _intcb) \ MCFG_DEVICE_ADD(_tag, ATARI_JSA_II, 0) \ - devcb = &atari_jsa_ii_device::static_set_main_int_cb(*device, DEVCB_##_intcb); + devcb = &downcast(*device).set_main_int_cb(DEVCB_##_intcb); #define MCFG_ATARI_JSA_III_ADD(_tag, _intcb) \ MCFG_DEVICE_ADD(_tag, ATARI_JSA_III, 0) \ - devcb = &atari_jsa_iii_device::static_set_main_int_cb(*device, DEVCB_##_intcb); + devcb = &downcast(*device).set_main_int_cb(DEVCB_##_intcb); #define MCFG_ATARI_JSA_IIIS_ADD(_tag, _intcb) \ MCFG_DEVICE_ADD(_tag, ATARI_JSA_IIIS, 0) \ - devcb = &atari_jsa_iiis_device::static_set_main_int_cb(*device, DEVCB_##_intcb); + devcb = &downcast(*device).set_main_int_cb(DEVCB_##_intcb); #define MCFG_ATARI_JSA_TEST_PORT(_port, _bitnum) \ - devcb = &atari_jsa_base_device::static_set_test_read_cb(*device, DEVCB_IOPORT(_port)); \ + devcb = &downcast(*device).set_test_read_cb(DEVCB_IOPORT(_port)); \ MCFG_DEVCB_RSHIFT(_bitnum); @@ -83,9 +83,9 @@ protected: atari_jsa_base_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, uint32_t clock, int channels); public: - // static configuration - template static devcb_base &static_set_test_read_cb(device_t &device, Object &&cb) { return downcast(device).m_test_read_cb.set_callback(std::forward(cb)); } - template static devcb_base &static_set_main_int_cb(device_t &device, Object &&cb) { return downcast(device).m_main_int_cb.set_callback(std::forward(cb)); } + // configuration + template devcb_base &set_test_read_cb(Object &&cb) { return m_test_read_cb.set_callback(std::forward(cb)); } + template devcb_base &set_main_int_cb(Object &&cb) { return m_main_int_cb.set_callback(std::forward(cb)); } // getters m6502_device &soundcpu() const { return *m_jsacpu; } diff --git a/src/mame/audio/cage.h b/src/mame/audio/cage.h index a731567f970..38f67fe4349 100644 --- a/src/mame/audio/cage.h +++ b/src/mame/audio/cage.h @@ -19,10 +19,10 @@ #define CAGE_IRQ_REASON_BUFFER_EMPTY (2) #define MCFG_ATARI_CAGE_IRQ_CALLBACK(_write) \ - devcb = &atari_cage_device::set_irqhandler_callback(*device, DEVCB_##_write); + devcb = &downcast(*device).set_irqhandler_callback(DEVCB_##_write); #define MCFG_ATARI_CAGE_SPEEDUP(_speedup) \ - atari_cage_device::static_set_speedup(*device, _speedup); + downcast(*device).set_speedup(_speedup); class atari_cage_device : public device_t { @@ -30,8 +30,8 @@ public: // construction/destruction atari_cage_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - static void static_set_speedup(device_t &device, offs_t speedup) { downcast(device).m_speedup = speedup; } - template static devcb_base &set_irqhandler_callback(device_t &device, Object &&cb) { return downcast(device).m_irqhandler.set_callback(std::forward(cb)); } + void set_speedup(offs_t speedup) { m_speedup = speedup; } + template devcb_base &set_irqhandler_callback(Object &&cb) { return m_irqhandler.set_callback(std::forward(cb)); } void reset_w(int state); diff --git a/src/mame/audio/dcs.h b/src/mame/audio/dcs.h index e53ff616242..66423fe73be 100644 --- a/src/mame/audio/dcs.h +++ b/src/mame/audio/dcs.h @@ -17,18 +17,18 @@ #include "machine/timer.h" #define MCFG_DCS2_AUDIO_DRAM_IN_MB(_dram_in_mb) \ - dcs_audio_device::static_set_dram_in_mb(*device, _dram_in_mb); + downcast(*device).set_dram_in_mb(_dram_in_mb); #define MCFG_DCS2_AUDIO_POLLING_OFFSET(_polling_offset) \ - dcs_audio_device::static_set_polling_offset(*device, _polling_offset); + downcast(*device).set_polling_offset(_polling_offset); class dcs_audio_device : public device_t { public: // for dcs2 (int dram_in_mb, offs_t polling_offset) - static void static_set_dram_in_mb(device_t &device, int dram_in_mb) { downcast(device).m_dram_in_mb = dram_in_mb; } - static void static_set_polling_offset(device_t &device, offs_t polling_offset) { downcast(device).m_polling_offset = polling_offset; } + void set_dram_in_mb(int dram_in_mb) { m_dram_in_mb = dram_in_mb; } + void set_polling_offset(offs_t polling_offset) { m_polling_offset = polling_offset; } void set_auto_ack(int state); diff --git a/src/mame/audio/dsbz80.h b/src/mame/audio/dsbz80.h index a176e3cf918..43f2b0c9fcd 100644 --- a/src/mame/audio/dsbz80.h +++ b/src/mame/audio/dsbz80.h @@ -15,7 +15,7 @@ MCFG_DEVICE_ADD(_tag, DSBZ80, 0) #define MCFG_DSBZ80_RXD_HANDLER(_devcb) \ - devcb = &dsbz80_device::set_rxd_handler(*device, DEVCB_##_devcb); + devcb = &downcast(*device).set_rxd_handler(DEVCB_##_devcb); //************************************************************************** // TYPE DEFINITIONS @@ -27,8 +27,8 @@ public: // construction/destruction dsbz80_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - // static configuration - template static devcb_base &set_rxd_handler(device_t &device, _Object &&object) { return downcast(device).m_rxd_handler.set_callback(std::forward<_Object>(object)); } + // configuration + template devcb_base &set_rxd_handler(device_t &device, Object &&object) { return m_rxd_handler.set_callback(std::forward(object)); } required_device m_ourcpu; required_device m_uart; diff --git a/src/mame/audio/gottlieb.cpp b/src/mame/audio/gottlieb.cpp index 3880398d853..069b08bf1a6 100644 --- a/src/mame/audio/gottlieb.cpp +++ b/src/mame/audio/gottlieb.cpp @@ -416,17 +416,6 @@ gottlieb_sound_r2_device::gottlieb_sound_r2_device(const machine_config &mconfig } -//------------------------------------------------- -// static_enable_cobram3_mods - enable changes -// for cobram3 -//------------------------------------------------- - -void gottlieb_sound_r2_device::static_enable_cobram3_mods(device_t &device) -{ - downcast(device).m_cobram3_mod = true; -} - - //------------------------------------------------- // write - handle an external command write //------------------------------------------------- diff --git a/src/mame/audio/gottlieb.h b/src/mame/audio/gottlieb.h index 4b444185879..b61639eccc4 100644 --- a/src/mame/audio/gottlieb.h +++ b/src/mame/audio/gottlieb.h @@ -30,7 +30,7 @@ DECLARE_DEVICE_TYPE(GOTTLIEB_SOUND_REV2, gottlieb_sound_r2_device) //************************************************************************** #define MCFG_GOTTLIEB_ENABLE_COBRAM3_MODS() \ - gottlieb_sound_r2_device::static_enable_cobram3_mods(*device); + downcast(*device).enable_cobram3_mods(); //************************************************************************** @@ -137,8 +137,8 @@ public: // construction/destruction gottlieb_sound_r2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - // static configuration helpers - static void static_enable_cobram3_mods(device_t &device); + // configuration helpers + void enable_cobram3_mods() { m_cobram3_mod = true; } // read/write DECLARE_WRITE8_MEMBER( write ); diff --git a/src/mame/audio/lynx.cpp b/src/mame/audio/lynx.cpp index 0571d1205fd..e50a932acf1 100644 --- a/src/mame/audio/lynx.cpp +++ b/src/mame/audio/lynx.cpp @@ -114,12 +114,6 @@ lynx2_sound_device::lynx2_sound_device(const machine_config &mconfig, const char { } -void lynx_sound_device::set_timer_delegate(device_t &device, timer_delegate cb) -{ - lynx_sound_device &dev = downcast(device); - dev.m_timer_delegate = cb; -} - //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- diff --git a/src/mame/audio/lynx.h b/src/mame/audio/lynx.h index 0d660ce3224..389b7fd6669 100644 --- a/src/mame/audio/lynx.h +++ b/src/mame/audio/lynx.h @@ -16,7 +16,7 @@ public: DECLARE_READ8_MEMBER(read); DECLARE_WRITE8_MEMBER(write); void count_down(int nr); - static void set_timer_delegate(device_t &device, timer_delegate cb); + template void set_timer_delegate(Object&& cb) { m_timer_delegate = std::forward(cb); } protected: struct LYNX_AUDIO { @@ -84,7 +84,7 @@ DECLARE_DEVICE_TYPE(LYNX2_SND, lynx2_sound_device) #define MCFG_LYNX_SND_SET_TIMER( _class, _method) \ - lynx_sound_device::set_timer_delegate(*device, lynx_sound_device::timer_delegate(&_class::_method, #_class "::" #_method, nullptr, (_class *)nullptr)); + downcast(*device).set_timer_delegate(lynx_sound_device::timer_delegate(&_class::_method, #_class "::" #_method, nullptr, (_class *)nullptr)); #endif // MAME_AUDIO_LYNX_H diff --git a/src/mame/audio/namco52.h b/src/mame/audio/namco52.h index 0c53522d0b3..a720ce7b573 100644 --- a/src/mame/audio/namco52.h +++ b/src/mame/audio/namco52.h @@ -10,19 +10,19 @@ MCFG_DEVICE_ADD(_tag, NAMCO_52XX, _clock) #define MCFG_NAMCO_52XX_DISCRETE(_tag) \ - namco_52xx_device::set_discrete(*device, "^" _tag); + downcast(*device).set_discrete("^" _tag); #define MCFG_NAMCO_52XX_BASENODE(_node) \ - namco_52xx_device::set_basenote(*device, _node); + downcast(*device).set_basenote(_node); #define MCFG_NAMCO_52XX_EXT_CLOCK(_clock) \ - namco_52xx_device::set_extclock(*device, _clock); + downcast(*device).set_extclock(_clock); #define MCFG_NAMCO_52XX_ROMREAD_CB(_devcb) \ - devcb = &namco_52xx_device::set_romread_callback(*device, DEVCB_##_devcb); + devcb = &downcast(*device).set_romread_callback(DEVCB_##_devcb); #define MCFG_NAMCO_52XX_SI_CB(_devcb) \ - devcb = &namco_52xx_device::set_si_callback(*device, DEVCB_##_devcb); + devcb = &downcast(*device).set_si_callback(DEVCB_##_devcb); class namco_52xx_device : public device_t @@ -30,11 +30,11 @@ class namco_52xx_device : public device_t public: namco_52xx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - static void set_discrete(device_t &device, const char *tag) { downcast(device).m_discrete.set_tag(tag); } - static void set_basenote(device_t &device, int node) { downcast(device).m_basenode = node; } - static void set_extclock(device_t &device, attoseconds_t clk) { downcast(device).m_extclock = clk; } - template static devcb_base &set_romread_callback(device_t &device, Object &&cb) { return downcast(device).m_romread.set_callback(std::forward(cb)); } - template static devcb_base &set_si_callback(device_t &device, Object &&cb) { return downcast(device).m_si.set_callback(std::forward(cb)); } + void set_discrete(const char *tag) { m_discrete.set_tag(tag); } + void set_basenote(int node) { m_basenode = node; } + void set_extclock(attoseconds_t clk) { m_extclock = clk; } + template devcb_base &set_romread_callback(Object &&cb) { return m_romread.set_callback(std::forward(cb)); } + template devcb_base &set_si_callback(Object &&cb) { return m_si.set_callback(std::forward(cb)); } DECLARE_WRITE8_MEMBER(write); diff --git a/src/mame/audio/namco54.h b/src/mame/audio/namco54.h index 8fb5fe58362..4bc86b7c221 100644 --- a/src/mame/audio/namco54.h +++ b/src/mame/audio/namco54.h @@ -11,10 +11,10 @@ MCFG_DEVICE_ADD(_tag, NAMCO_54XX, _clock) #define MCFG_NAMCO_54XX_DISCRETE(_tag) \ - namco_54xx_device::set_discrete(*device, "^" _tag); + downcast(*device).set_discrete("^" _tag); #define MCFG_NAMCO_54XX_BASENODE(_node) \ - namco_54xx_device::set_basenote(*device, _node); + downcast(*device).set_basenote(_node); class namco_54xx_device : public device_t @@ -22,8 +22,8 @@ class namco_54xx_device : public device_t public: namco_54xx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - static void set_discrete(device_t &device, const char *tag) { downcast(device).m_discrete.set_tag(tag); } - static void set_basenote(device_t &device, int node) { downcast(device).m_basenode = node; } + void set_discrete(const char *tag) { m_discrete.set_tag(tag); } + void set_basenote(int node) { m_basenode = node; } DECLARE_READ8_MEMBER( K_r ); DECLARE_READ8_MEMBER( R0_r ); diff --git a/src/mame/audio/rad_eu3a05.h b/src/mame/audio/rad_eu3a05.h index 55a98a6e183..8dcd61927a4 100644 --- a/src/mame/audio/rad_eu3a05.h +++ b/src/mame/audio/rad_eu3a05.h @@ -5,7 +5,7 @@ #define MAME_AUDIO_RAD_EU3A05_H #define MCFG_RADICA6502_SOUND_SPACE_READ_CB(_devcb) \ - devcb = &radica6502_sound_device::set_space_read_callback(*device, DEVCB_##_devcb); + devcb = &downcast(*device).set_space_read_callback(DEVCB_##_devcb); //************************************************************************** // TYPE DEFINITIONS @@ -18,7 +18,7 @@ class radica6502_sound_device : public device_t, public device_sound_interface public: radica6502_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template static devcb_base &set_space_read_callback(device_t &device, Object &&cb) { return downcast(device).m_space_read_cb.set_callback(std::forward(cb)); } + template devcb_base &set_space_read_callback(Object &&cb) { return m_space_read_cb.set_callback(std::forward(cb)); } DECLARE_WRITE8_MEMBER(radicasi_sound_addr_w); DECLARE_READ8_MEMBER(radicasi_sound_addr_r); diff --git a/src/mame/audio/s11c_bg.cpp b/src/mame/audio/s11c_bg.cpp index 0d7d2842feb..cf4d4a75ff9 100644 --- a/src/mame/audio/s11c_bg.cpp +++ b/src/mame/audio/s11c_bg.cpp @@ -97,12 +97,6 @@ void s11c_bg_device::device_reset() m_cpu->set_input_line(INPUT_LINE_RESET,PULSE_LINE); } -void s11c_bg_device::static_set_romregion(device_t &device, const char *tag) -{ - s11c_bg_device &cpuboard = downcast(device); - cpuboard.m_regiontag = tag; -} - WRITE_LINE_MEMBER( s11c_bg_device::ym2151_irq_w) { if(state == CLEAR_LINE) diff --git a/src/mame/audio/s11c_bg.h b/src/mame/audio/s11c_bg.h index 41b443551f2..d51bf213513 100644 --- a/src/mame/audio/s11c_bg.h +++ b/src/mame/audio/s11c_bg.h @@ -18,7 +18,7 @@ #define MCFG_S11C_BG_ROM_REGION(_region) \ - s11c_bg_device::static_set_romregion(*device, _region); + downcast(*device).set_romregion(_region); class s11c_bg_device : public device_t, @@ -42,7 +42,7 @@ public: void ctrl_w(uint8_t data); void data_w(uint8_t data); - static void static_set_romregion(device_t &device, const char *tag); + void set_romregion(const char *tag) { m_regiontag = tag; } void s11c_bg_map(address_map &map); protected: diff --git a/src/mame/audio/segam1audio.h b/src/mame/audio/segam1audio.h index 5b793d388b6..c31349b5ea2 100644 --- a/src/mame/audio/segam1audio.h +++ b/src/mame/audio/segam1audio.h @@ -19,7 +19,7 @@ MCFG_DEVICE_ADD(_tag, SEGAM1AUDIO, 0) #define MCFG_SEGAM1AUDIO_RXD_HANDLER(_devcb) \ - devcb = &segam1audio_device::set_rxd_handler(*device, DEVCB_##_devcb); + devcb = &downcast(*device).set_rxd_handler(DEVCB_##_devcb); //************************************************************************** @@ -32,8 +32,8 @@ public: // construction/destruction segam1audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - // static configuration - template static devcb_base &set_rxd_handler(device_t &device, Object &&cb) { return downcast(device).m_rxd_handler.set_callback(std::forward(cb)); } + // configuration + template devcb_base &set_rxd_handler(Object &&cb) { return m_rxd_handler.set_callback(std::forward(cb)); } DECLARE_WRITE16_MEMBER(m1_snd_mpcm_bnk1_w); DECLARE_WRITE16_MEMBER(m1_snd_mpcm_bnk2_w); diff --git a/src/mame/audio/seibu.cpp b/src/mame/audio/seibu.cpp index f981c8b818c..255402bdb05 100644 --- a/src/mame/audio/seibu.cpp +++ b/src/mame/audio/seibu.cpp @@ -87,17 +87,6 @@ seibu_sound_device::seibu_sound_device(const machine_config &mconfig, const char { } -void seibu_sound_device::static_set_cpu_tag(device_t &device, const char *tag) -{ - downcast(device).m_sound_cpu.set_tag(tag); - downcast(device).m_sound_rom.set_tag(tag); -} - -void seibu_sound_device::static_set_rombank_tag(device_t &device, const char *tag) -{ - downcast(device).m_rom_bank.set_tag(tag); -} - //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- diff --git a/src/mame/audio/seibu.h b/src/mame/audio/seibu.h index 451ef63fc96..af28ba6cc2d 100644 --- a/src/mame/audio/seibu.h +++ b/src/mame/audio/seibu.h @@ -44,11 +44,15 @@ public: seibu_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); ~seibu_sound_device() {} - // static configuration - static void static_set_cpu_tag(device_t &device, const char *tag); - static void static_set_rombank_tag(device_t &device, const char *tag); - template static devcb_base &set_ym_read_callback(device_t &device, _Object object) { return downcast(device).m_ym_read_cb.set_callback(object); } - template static devcb_base &set_ym_write_callback(device_t &device, _Object object) { return downcast(device).m_ym_write_cb.set_callback(object); } + // configuration + void set_cpu_tag(const char *tag) + { + m_sound_cpu.set_tag(tag); + m_sound_rom.set_tag(tag); + } + void set_rombank_tag(const char *tag) { m_rom_bank.set_tag(tag); } + template devcb_base &set_ym_read_callback(Object&& object) { return m_ym_read_cb.set_callback(std::forward(object)); } + template devcb_base &set_ym_write_callback(Object&& object) { return m_ym_write_cb.set_callback(std::forward(object)); } DECLARE_READ8_MEMBER( main_r ); DECLARE_WRITE8_MEMBER( main_w ); @@ -178,16 +182,16 @@ DECLARE_DEVICE_TYPE(SEIBU_ADPCM, seibu_adpcm_device) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) #define MCFG_SEIBU_SOUND_CPU(_audiocputag) \ - seibu_sound_device::static_set_cpu_tag(*device, "^" _audiocputag); + downcast(*device).set_cpu_tag("^" _audiocputag); #define MCFG_SEIBU_SOUND_ROMBANK(_banktag) \ - seibu_sound_device::static_set_rombank_tag(*device, "^" _banktag); + downcast(*device).set_rombank_tag("^" _banktag); #define MCFG_SEIBU_SOUND_YM_READ_CB(_devcb) \ - devcb = &seibu_sound_device::set_ym_read_callback(*device, DEVCB_##_devcb); + devcb = &downcast(*device).set_ym_read_callback(DEVCB_##_devcb); #define MCFG_SEIBU_SOUND_YM_WRITE_CB(_devcb) \ - devcb = &seibu_sound_device::set_ym_write_callback(*device, DEVCB_##_devcb); + devcb = &downcast(*device).set_ym_write_callback(DEVCB_##_devcb); /**************************************************************************/ diff --git a/src/mame/audio/svis_snd.h b/src/mame/audio/svis_snd.h index 2896559e240..3640505636a 100644 --- a/src/mame/audio/svis_snd.h +++ b/src/mame/audio/svis_snd.h @@ -19,7 +19,7 @@ #define SVISION_SND_IRQ_MEMBER(_name) void _name(void) #define SVISION_SND_IRQ_CB(_class, _method) \ - svision_sound_device::set_irq_callback(*device, svision_sound_device::irq_delegate(&_class::_method, #_class "::" #_method, this)); + downcast(*device).set_irq_callback(svision_sound_device::irq_delegate(&_class::_method, #_class "::" #_method, this)); // ======================> svision_sound_device @@ -30,8 +30,8 @@ public: svision_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - // static configuration - static void set_irq_callback(device_t &device, irq_delegate callback) { downcast(device).m_irq_cb = callback; } + // configuration + template void set_irq_callback(Object&& callback) { m_irq_cb = std::forward(callback); } DECLARE_WRITE8_MEMBER( sounddma_w ); DECLARE_WRITE8_MEMBER( noise_w ); diff --git a/src/mame/audio/taitosnd.h b/src/mame/audio/taitosnd.h index d2b140d201f..e78ec5ab519 100644 --- a/src/mame/audio/taitosnd.h +++ b/src/mame/audio/taitosnd.h @@ -9,10 +9,10 @@ //************************************************************************** #define MCFG_TC0140SYT_MASTER_CPU(_tag) \ - tc0140syt_device::set_master_tag(*device, "^" _tag); + downcast(*device).set_master_tag("^" _tag); #define MCFG_TC0140SYT_SLAVE_CPU(_tag) \ - tc0140syt_device::set_slave_tag(*device, "^" _tag); + downcast(*device).set_slave_tag("^" _tag); #define MCFG_PC060HA_MASTER_CPU(_tag) MCFG_TC0140SYT_MASTER_CPU(_tag) #define MCFG_PC060HA_SLAVE_CPU(_tag) MCFG_TC0140SYT_SLAVE_CPU(_tag) @@ -29,8 +29,8 @@ class tc0140syt_device : public device_t public: tc0140syt_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - static void set_master_tag(device_t &device, const char *tag) { downcast(device).m_mastercpu.set_tag(tag); } - static void set_slave_tag(device_t &device, const char *tag) { downcast(device).m_slavecpu.set_tag(tag); } + void set_master_tag(const char *tag) { m_mastercpu.set_tag(tag); } + void set_slave_tag(const char *tag) { m_slavecpu.set_tag(tag); } // MASTER (4-bit bus) control functions DECLARE_WRITE8_MEMBER( master_port_w ); diff --git a/src/mame/audio/tvc.h b/src/mame/audio/tvc.h index c94b620e2c0..b91a103d784 100644 --- a/src/mame/audio/tvc.h +++ b/src/mame/audio/tvc.h @@ -12,7 +12,7 @@ #pragma once #define MCFG_TVC_SOUND_SNDINT_CALLBACK(_write) \ - devcb = &tvc_sound_device::set_sndint_wr_callback(*device, DEVCB_##_write); + devcb = &downcast(*device).set_sndint_wr_callback(DEVCB_##_write); //************************************************************************** // TYPE DEFINITIONS @@ -26,7 +26,7 @@ public: // construction/destruction tvc_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template static devcb_base &set_sndint_wr_callback(device_t &device, Object &&cb) { return downcast(device).m_write_sndint.set_callback(std::forward(cb)); } + template devcb_base &set_sndint_wr_callback(Object &&cb) { return m_write_sndint.set_callback(std::forward(cb)); } DECLARE_WRITE8_MEMBER(write); void reset_divider(); diff --git a/src/mame/audio/wpcsnd.cpp b/src/mame/audio/wpcsnd.cpp index e487b46316f..d602055ff68 100644 --- a/src/mame/audio/wpcsnd.cpp +++ b/src/mame/audio/wpcsnd.cpp @@ -104,12 +104,6 @@ void wpcsnd_device::device_reset() m_reply_available = false; } -void wpcsnd_device::static_set_romregion(device_t &device, const char *tag) -{ - wpcsnd_device &cpuboard = downcast(device); - cpuboard.m_rom.set_tag(tag); -} - WRITE_LINE_MEMBER( wpcsnd_device::ym2151_irq_w) { m_cpu->set_input_line(M6809_FIRQ_LINE,state ? ASSERT_LINE : CLEAR_LINE); diff --git a/src/mame/audio/wpcsnd.h b/src/mame/audio/wpcsnd.h index 9b4de964969..dcace2cfccc 100644 --- a/src/mame/audio/wpcsnd.h +++ b/src/mame/audio/wpcsnd.h @@ -17,7 +17,7 @@ #define MCFG_WPC_ROM_REGION(_region) \ - wpcsnd_device::static_set_romregion(*device, _region); + downcast(*device).set_romregion(_region); #define MCFG_WPC_SOUND_REPLY_CALLBACK(_reply) \ downcast(device)->set_reply_callback(DEVCB_##_reply); @@ -49,7 +49,7 @@ public: uint8_t ctrl_r(); uint8_t data_r(); - static void static_set_romregion(device_t &device, const char *tag); + void set_romregion(const char *tag) { m_rom.set_tag(tag); } // callbacks template void set_reply_callback(Reply &&cb) { m_reply_cb.set_callback(std::forward(cb)); } diff --git a/src/mame/audio/zaccaria.h b/src/mame/audio/zaccaria.h index b6f9b5301fc..cf33aa9388b 100644 --- a/src/mame/audio/zaccaria.h +++ b/src/mame/audio/zaccaria.h @@ -25,7 +25,7 @@ DECLARE_DEVICE_TYPE(ZACCARIA_1B11142, zac1b11142_audio_device) //************************************************************************** #define MCFG_ZACCARIA_1B11142_SET_ACS_CALLBACK(_devcb) \ - devcb = &zac1b11142_audio_device::static_set_acs_cb(*device, DEVCB_##_devcb); + devcb = &downcast(device).set_acs_cb(DEVCB_##_devcb); @@ -84,8 +84,7 @@ protected: class zac1b11142_audio_device : public zac1b111xx_melody_base { public: - template static devcb_base &static_set_acs_cb(device_t &device, Object &&cb) - { return downcast(device).m_acs_cb.set_callback(std::forward(cb)); } + template devcb_base &set_acs_cb(device_t &device, Object &&cb) { return m_acs_cb.set_callback(std::forward(cb)); } zac1b11142_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); diff --git a/src/mame/includes/apollo.h b/src/mame/includes/apollo.h index d0cc410db1b..ab4a2dd3174 100644 --- a/src/mame/includes/apollo.h +++ b/src/mame/includes/apollo.h @@ -685,7 +685,7 @@ DECLARE_DEVICE_TYPE(APOLLO_MONO19I, apollo_graphics_19i) //************************************************************************** #define MCFG_APOLLO_STDIO_TX_CALLBACK(_cb) \ - devcb = &apollo_stdio_device::set_tx_cb(*device, DEVCB_##_cb); + devcb = &downcast(*device).set_tx_cb(DEVCB_##_cb); //************************************************************************** // TYPE DEFINITIONS @@ -700,9 +700,9 @@ public: apollo_stdio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template static devcb_base &set_tx_cb(device_t &device, _Object object) + template devcb_base &set_tx_cb(Object &&object) { - return downcast (device).m_tx_w.set_callback(object); + return m_tx_w.set_callback(std::forward(object)); } devcb_write_line m_tx_w; diff --git a/src/mame/includes/hp48.h b/src/mame/includes/hp48.h index 221d8f85742..924a12f51e1 100644 --- a/src/mame/includes/hp48.h +++ b/src/mame/includes/hp48.h @@ -191,11 +191,11 @@ public: // construction/destruction hp48_port_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - static void set_port_config(device_t &device, int port, int module, int max_size) + void set_port_config(int port, int module, int max_size) { - downcast(device).m_port = port; - downcast(device).m_module = module; - downcast(device).m_max_size = max_size; + m_port = port; + m_module = module; + m_max_size = max_size; } // image-level overrides @@ -231,6 +231,6 @@ DECLARE_DEVICE_TYPE(HP48_PORT, hp48_port_image_device) #define MCFG_HP48_PORT_ADD(_tag, _port, _module, _max_size) \ MCFG_DEVICE_ADD(_tag, HP48_PORT, 0) \ - hp48_port_image_device::set_port_config(*device, _port, _module, _max_size); + downcast(*device).set_port_config(_port, _module, _max_size); #endif // MAME_INCLUDES_HP84_H diff --git a/src/mame/includes/nb1413m3.h b/src/mame/includes/nb1413m3.h index 0e1f9631bc2..30d62a002f1 100644 --- a/src/mame/includes/nb1413m3.h +++ b/src/mame/includes/nb1413m3.h @@ -125,7 +125,7 @@ enum { }; #define MCFG_NB1413M3_TYPE(_type) \ - nb1413m3_device::set_type(*device, _type); + downcast(*device).set_type(_type); class nb1413m3_device : public device_t { @@ -133,8 +133,8 @@ public: nb1413m3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); ~nb1413m3_device() {} - // (static) configuration helpers - static void set_type(device_t &device, int type) { downcast(device).m_nb1413m3_type = type; } + // configuration helpers + void set_type(int type) { m_nb1413m3_type = type; } enum { diff --git a/src/mame/includes/slapstic.h b/src/mame/includes/slapstic.h index 7fd6b907299..eb476a02422 100644 --- a/src/mame/includes/slapstic.h +++ b/src/mame/includes/slapstic.h @@ -111,10 +111,10 @@ enum #define MCFG_SLAPSTIC_NUM(_chipnum) \ - atari_slapstic_device::static_set_chipnum(*device, _chipnum); + downcast(*device).set_chipnum(_chipnum); #define MCFG_SLAPSTIC_68K_ACCESS(_type) \ - atari_slapstic_device::static_set_access68k(*device, _type); + downcast(*device).set_access68k(_type); @@ -132,17 +132,9 @@ public: int alt2_kludge(address_space &space, offs_t offset); - static void static_set_access68k(device_t &device, int type) - { - atari_slapstic_device &dev = downcast(device); - dev.access_68k = type; - } + void set_access68k(int type) { access_68k = type; } - static void static_set_chipnum(device_t &device, int chipnum) - { - atari_slapstic_device &dev = downcast(device); - dev.m_chipnum = chipnum; - } + void set_chipnum(int chipnum) { m_chipnum = chipnum; } int m_chipnum; diff --git a/src/mame/includes/xbox_pci.h b/src/mame/includes/xbox_pci.h index 8acf6acc7f0..431fe3f2e15 100644 --- a/src/mame/includes/xbox_pci.h +++ b/src/mame/includes/xbox_pci.h @@ -17,7 +17,7 @@ public: nv2a_host_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual void map_extra(uint64_t memory_window_start, uint64_t memory_window_end, uint64_t memory_offset, address_space *memory_space, uint64_t io_window_start, uint64_t io_window_end, uint64_t io_offset, address_space *io_space) override; - void set_cpu_tag(const char *_cpu_tag); + void set_cpu_tag(const char *cpu_tag); protected: virtual void device_start() override; @@ -80,7 +80,7 @@ public: mcpx_smbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); void register_device(int address, std::function callback) { if (address < 128) smbusst.devices[address] = callback; } - template static devcb_base &set_interrupt_handler(device_t &device, _Object object) { return downcast(device).m_interrupt_handler.set_callback(object); } + template devcb_base &set_interrupt_handler(Object object) { return m_interrupt_handler.set_callback(object); } DECLARE_READ32_MEMBER(smbus_r); DECLARE_WRITE32_MEMBER(smbus_w); @@ -109,7 +109,7 @@ private: extern const device_type MCPX_SMBUS; #define MCFG_MCPX_SMBUS_INTERRUPT_HANDLER(_devcb) \ - devcb = &mcpx_smbus_device::set_interrupt_handler(*device, DEVCB_##_devcb); + devcb = &downcast(*device).set_interrupt_handler(DEVCB_##_devcb); /* * OHCI USB Controller @@ -121,7 +121,7 @@ public: void set_hack_callback(std::function hack) { hack_callback = hack; } void plug_usb_device(int port, ohci_function *function); - template static devcb_base &set_interrupt_handler(device_t &device, _Object object) { return downcast(device).m_interrupt_handler.set_callback(object); } + template devcb_base &set_interrupt_handler(Object object) { return m_interrupt_handler.set_callback(object); } DECLARE_READ32_MEMBER(ohci_r); DECLARE_WRITE32_MEMBER(ohci_w); @@ -148,7 +148,7 @@ private: extern const device_type MCPX_OHCI; #define MCFG_MCPX_OHCI_INTERRUPT_HANDLER(_devcb) \ - devcb = &mcpx_ohci_device::set_interrupt_handler(*device, DEVCB_##_devcb); + devcb = &downcast(*device).set_interrupt_handler(DEVCB_##_devcb); /* * Ethernet @@ -181,7 +181,7 @@ extern const device_type MCPX_ETH; class mcpx_apu_device : public pci_device { public: mcpx_apu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - void set_cpu_tag(const char *_cpu_tag); + void set_cpu_tag(const char *cpu_tag); DECLARE_READ32_MEMBER(apu_r); DECLARE_WRITE32_MEMBER(apu_w); @@ -274,7 +274,7 @@ class mcpx_ide_device : public pci_device { public: mcpx_ide_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template static devcb_base &set_interrupt_handler(device_t &device, _Object object) { return downcast(device).m_interrupt_handler.set_callback(object); } + template devcb_base &set_interrupt_handler(Object object) { return m_interrupt_handler.set_callback(object); } protected: virtual void device_start() override; @@ -290,7 +290,7 @@ private: extern const device_type MCPX_IDE; #define MCFG_MCPX_IDE_INTERRUPT_HANDLER(_devcb) \ - devcb = &mcpx_ide_device::set_interrupt_handler(*device, DEVCB_##_devcb); + devcb = &downcast(*device).set_interrupt_handler(DEVCB_##_devcb); /* * AGP Bridge @@ -314,10 +314,10 @@ DECLARE_DEVICE_TYPE(NV2A_AGP, nv2a_agp_device) class nv2a_gpu_device : public pci_device { public: nv2a_gpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - void set_cpu_tag(const char *_cpu_tag); + void set_cpu_tag(const char *cpu_tag); nv2a_renderer *debug_get_renderer() { return nvidia_nv2a; } - template static devcb_base &set_interrupt_handler(device_t &device, _Object object) { return downcast(device).m_interrupt_handler.set_callback(object); } + template devcb_base &set_interrupt_handler(Object object) { return m_interrupt_handler.set_callback(object); } DECLARE_READ32_MEMBER(geforce_r); DECLARE_WRITE32_MEMBER(geforce_w); @@ -342,6 +342,6 @@ DECLARE_DEVICE_TYPE(NV2A_GPU, nv2a_gpu_device) #define MCFG_MCPX_NV2A_GPU_CPU(_cpu_tag) \ downcast(device)->set_cpu_tag(_cpu_tag); #define MCFG_MCPX_NV2A_GPU_INTERRUPT_HANDLER(_devcb) \ - devcb = &nv2a_gpu_device::set_interrupt_handler(*device, DEVCB_##_devcb); + devcb = &downcast(*device).set_interrupt_handler(DEVCB_##_devcb); #endif // MAME_INCLUDES_XBOX_PCI_H diff --git a/src/mame/machine/seibucop/seibucop.h b/src/mame/machine/seibucop/seibucop.h index 7d1a81eaec6..9ad11de2f09 100644 --- a/src/mame/machine/seibucop/seibucop.h +++ b/src/mame/machine/seibucop/seibucop.h @@ -17,7 +17,7 @@ #define LOG_Move0905 0 #define MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(_devcb) \ - devcb = &raiden2cop_device::set_m_videoramout_cb(*device, DEVCB_##_devcb); + devcb = &downcast(*device).set_m_videoramout_cb(DEVCB_##_devcb); #define MCFG_RAIDEN2COP_ADD(_tag ) \ MCFG_DEVICE_ADD(_tag, RAIDEN2COP, 0) @@ -76,7 +76,7 @@ public: uint8_t fade_table(int v); - template static devcb_base &set_m_videoramout_cb(device_t &device, _Object object) { return downcast(device).m_videoramout_cb.set_callback(object); } + template devcb_base &set_m_videoramout_cb(Object object) { return m_videoramout_cb.set_callback(object); } // Number Conversion