diff --git a/src/devices/sound/fmopl.cpp b/src/devices/sound/fmopl.cpp index ccd9f4199a0..c151fcfea91 100644 --- a/src/devices/sound/fmopl.cpp +++ b/src/devices/sound/fmopl.cpp @@ -1746,7 +1746,7 @@ static int OPL_LockTable(device_t *device) { cymfile = fopen("3812_.cym","wb"); if (cymfile) - device->machine().scheduler().timer_pulse ( attotime::from_hz(110), FUNC(cymfile_callback)); /*110 Hz pulse timer*/ + device->machine().scheduler().timer_pulse ( attotime::from_hz(110), timer_expired_delegate(FUNC(cymfile_callback),&device->machine())); /*110 Hz pulse timer*/ else device->logerror("Could not create file 3812_.cym\n"); } diff --git a/src/emu/emucore.h b/src/emu/emucore.h index 121ea41481c..b23e52dc5c0 100644 --- a/src/emu/emucore.h +++ b/src/emu/emucore.h @@ -208,7 +208,6 @@ inline void operator--(_Type &value, int) { value = (_Type)((int)value - 1); } // this macro wraps a function 'x' and can be used to pass a function followed by its name #define FUNC(x) &x, #x -#define FUNC_NULL nullptr, "(null)" // standard assertion macros diff --git a/src/emu/schedule.cpp b/src/emu/schedule.cpp index cab7a4598d4..ca32bd6d56e 100644 --- a/src/emu/schedule.cpp +++ b/src/emu/schedule.cpp @@ -243,10 +243,15 @@ void emu_timer::register_save() // for non-device timers, it is an index based on the callback function name if (m_device == nullptr) { - name = m_callback.name(); + name = m_callback.name() ? m_callback.name() : "unnamed"; for (emu_timer *curtimer = machine().scheduler().first_timer(); curtimer != nullptr; curtimer = curtimer->next()) - if (!curtimer->m_temporary && curtimer->m_device == nullptr && strcmp(curtimer->m_callback.name(), m_callback.name()) == 0) - index++; + if (!curtimer->m_temporary && curtimer->m_device == nullptr) + { + if (curtimer->m_callback.name() != nullptr && m_callback.name() != nullptr && strcmp(curtimer->m_callback.name(), m_callback.name()) == 0) + index++; + else if (curtimer->m_callback.name() == nullptr && m_callback.name() == nullptr) + index++; + } } // for device timers, it is an index based on the device and timer ID diff --git a/src/emu/schedule.h b/src/emu/schedule.h index 5ed0c049bdb..1cda59cf75f 100644 --- a/src/emu/schedule.h +++ b/src/emu/schedule.h @@ -41,10 +41,6 @@ // timer callbacks look like this typedef delegate timer_expired_delegate; -// old-skool callbacks are like this -typedef void (*timer_expired_func)(running_machine &machine, void *ptr, INT32 param); - - // ======================> emu_timer class emu_timer @@ -141,14 +137,6 @@ public: void timer_pulse(const attotime &period, timer_expired_delegate callback, int param = 0, void *ptr = nullptr); void synchronize(timer_expired_delegate callback = timer_expired_delegate(), int param = 0, void *ptr = nullptr) { timer_set(attotime::zero, callback, param, ptr); } - // timers with old-skool callbacks -#ifdef USE_STATIC_DELEGATE - emu_timer *timer_alloc(timer_expired_func callback, const char *name, void *ptr = nullptr) { return timer_alloc(timer_expired_delegate(callback, name, &machine()), ptr); } - void timer_set(const attotime &duration, timer_expired_func callback, const char *name, int param = 0, void *ptr = nullptr) { timer_set(duration, timer_expired_delegate(callback, name, &machine()), param, ptr); } - void timer_pulse(const attotime &period, timer_expired_func callback, const char *name, int param = 0, void *ptr = nullptr) { timer_pulse(period, timer_expired_delegate(callback, name, &machine()), param, ptr); } - void synchronize(timer_expired_func callback, const char *name = nullptr, int param = 0, void *ptr = nullptr) { timer_set(attotime::zero, callback, name, param, ptr); } -#endif - // timers, specified by device/id; generally devices should use the device_t methods instead emu_timer *timer_alloc(device_t &device, device_timer_id id = 0, void *ptr = nullptr); void timer_set(const attotime &duration, device_t &device, device_timer_id id = 0, int param = 0, void *ptr = nullptr); diff --git a/src/mame/drivers/combatsc.cpp b/src/mame/drivers/combatsc.cpp index 2d346e77212..e9addf5066b 100644 --- a/src/mame/drivers/combatsc.cpp +++ b/src/mame/drivers/combatsc.cpp @@ -646,7 +646,7 @@ MACHINE_START_MEMBER(combatsc_state,combatsc) m_page[0] = MEM + 0x4000; m_page[1] = MEM + 0x6000; - m_interleave_timer = machine().scheduler().timer_alloc(FUNC_NULL); + m_interleave_timer = machine().scheduler().timer_alloc(timer_expired_delegate()); membank("bank1")->configure_entries(0, 10, memregion("maincpu")->base() + 0x10000, 0x4000); diff --git a/src/mame/drivers/midzeus.cpp b/src/mame/drivers/midzeus.cpp index 7e98449389b..5544c1f693e 100644 --- a/src/mame/drivers/midzeus.cpp +++ b/src/mame/drivers/midzeus.cpp @@ -72,8 +72,8 @@ static emu_timer *timer[2]; MACHINE_START_MEMBER(midzeus_state,midzeus) { - timer[0] = machine().scheduler().timer_alloc(FUNC_NULL); - timer[1] = machine().scheduler().timer_alloc(FUNC_NULL); + timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate()); + timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate()); gun_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(midzeus_state::invasn_gun_callback),this)); gun_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(midzeus_state::invasn_gun_callback),this)); diff --git a/src/mame/drivers/tm990189.cpp b/src/mame/drivers/tm990189.cpp index f515ccb544b..c586d7797b2 100644 --- a/src/mame/drivers/tm990189.cpp +++ b/src/mame/drivers/tm990189.cpp @@ -176,17 +176,17 @@ MACHINE_RESET_MEMBER(tm990189_state,tm990_189) MACHINE_START_MEMBER(tm990189_state,tm990_189) { - m_displayena_timer = machine().scheduler().timer_alloc(FUNC_NULL); + m_displayena_timer = machine().scheduler().timer_alloc(timer_expired_delegate()); } MACHINE_START_MEMBER(tm990189_state,tm990_189_v) { - m_displayena_timer = machine().scheduler().timer_alloc(FUNC_NULL); + m_displayena_timer = machine().scheduler().timer_alloc(timer_expired_delegate()); - m_joy1x_timer = machine().scheduler().timer_alloc(FUNC_NULL); - m_joy1y_timer = machine().scheduler().timer_alloc(FUNC_NULL); - m_joy2x_timer = machine().scheduler().timer_alloc(FUNC_NULL); - m_joy2y_timer = machine().scheduler().timer_alloc(FUNC_NULL); + m_joy1x_timer = machine().scheduler().timer_alloc(timer_expired_delegate()); + m_joy1y_timer = machine().scheduler().timer_alloc(timer_expired_delegate()); + m_joy2x_timer = machine().scheduler().timer_alloc(timer_expired_delegate()); + m_joy2y_timer = machine().scheduler().timer_alloc(timer_expired_delegate()); } MACHINE_RESET_MEMBER(tm990189_state,tm990_189_v) diff --git a/src/mame/drivers/vegas.cpp b/src/mame/drivers/vegas.cpp index 71bfa6e06de..c45b7fa8b74 100644 --- a/src/mame/drivers/vegas.cpp +++ b/src/mame/drivers/vegas.cpp @@ -582,8 +582,8 @@ void vegas_state::machine_start() m_voodoo = (voodoo_device*)machine().device("voodoo"); /* allocate timers for the NILE */ - m_timer[0] = machine().scheduler().timer_alloc(FUNC_NULL); - m_timer[1] = machine().scheduler().timer_alloc(FUNC_NULL); + m_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate()); + m_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate()); m_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vegas_state::nile_timer_callback),this)); m_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vegas_state::nile_timer_callback),this)); diff --git a/src/mame/machine/mhavoc.cpp b/src/mame/machine/mhavoc.cpp index 1596717c658..dc15b20dad0 100644 --- a/src/mame/machine/mhavoc.cpp +++ b/src/mame/machine/mhavoc.cpp @@ -132,7 +132,7 @@ TIMER_CALLBACK_MEMBER(mhavoc_state::delayed_gamma_w) m_gamma->set_input_line(INPUT_LINE_NMI, PULSE_LINE); /* the sound CPU needs to reply in 250microseconds (according to Neil Bradley) */ - machine().scheduler().timer_set(attotime::from_usec(250), FUNC_NULL); + machine().scheduler().timer_set(attotime::from_usec(250), timer_expired_delegate()); } diff --git a/src/mame/machine/thomson.cpp b/src/mame/machine/thomson.cpp index 105dd6b9b50..b75448df490 100644 --- a/src/mame/machine/thomson.cpp +++ b/src/mame/machine/thomson.cpp @@ -2997,7 +2997,7 @@ void thomson_state::to8_kbd_reset() void thomson_state::to8_kbd_init() { m_to8_kbd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::to8_kbd_timer_cb),this)); - m_to8_kbd_signal = machine().scheduler().timer_alloc(FUNC_NULL); + m_to8_kbd_signal = machine().scheduler().timer_alloc(timer_expired_delegate()); save_item(NAME(m_to8_kbd_ack)); save_item(NAME(m_to8_kbd_data)); save_item(NAME(m_to8_kbd_step)); diff --git a/src/mame/video/thomson.cpp b/src/mame/video/thomson.cpp index 5b70a119b8c..e2fa72bd2d6 100644 --- a/src/mame/video/thomson.cpp +++ b/src/mame/video/thomson.cpp @@ -1161,7 +1161,7 @@ VIDEO_START_MEMBER( thomson_state, thom ) save_item(NAME(m_thom_floppy_rcount)); output().set_value( "floppy", 0 ); - m_thom_video_timer = machine().scheduler().timer_alloc(FUNC_NULL); + m_thom_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate()); m_thom_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::thom_scanline_start),this)); diff --git a/src/mame/video/victory.cpp b/src/mame/video/victory.cpp index b7f6ce15ff0..efa91324140 100644 --- a/src/mame/video/victory.cpp +++ b/src/mame/video/victory.cpp @@ -47,7 +47,7 @@ void victory_state::video_start() m_scrollx = m_scrolly = 0; m_video_control = 0; memset(&m_micro, 0, sizeof(m_micro)); - m_micro.timer = machine().scheduler().timer_alloc(FUNC_NULL); + m_micro.timer = machine().scheduler().timer_alloc(timer_expired_delegate()); /* register for state saving */ save_item(NAME(m_paletteram));