timer - made member calls work (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2012-09-25 08:08:26 +00:00
parent a68624339f
commit 03bb4528a0
2 changed files with 8 additions and 5 deletions

View File

@ -226,6 +226,8 @@ void timer_device::device_start()
// allocate the timer // allocate the timer
m_timer = timer_alloc(); m_timer = timer_alloc();
m_callback.bind_relative_to(*owner());
// register for save states // register for save states
save_item(NAME(m_first_time)); save_item(NAME(m_first_time));
} }
@ -299,6 +301,7 @@ void timer_device::device_timer(emu_timer &timer, device_timer_id id, int param,
{ {
// call the real callback // call the real callback
int vpos = m_screen->vpos(); int vpos = m_screen->vpos();
if (!m_callback.isnull())
(m_callback)(*this, m_ptr, vpos); (m_callback)(*this, m_ptr, vpos);
// advance by the increment only if we will still be within the screen bounds // advance by the increment only if we will still be within the screen bounds

View File

@ -78,15 +78,15 @@
#define MCFG_TIMER_DRIVER_ADD(_tag, _class, _callback) \ #define MCFG_TIMER_DRIVER_ADD(_tag, _class, _callback) \
MCFG_DEVICE_ADD(_tag, TIMER, 0) \ MCFG_DEVICE_ADD(_tag, TIMER, 0) \
timer_device::static_configure_generic(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, NULL)); \ timer_device::static_configure_generic(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, NULL, (_class *)0)); \
#define MCFG_TIMER_DRIVER_ADD_PERIODIC(_tag, _class, _callback, _period) \ #define MCFG_TIMER_DRIVER_ADD_PERIODIC(_tag, _class, _callback, _period) \
MCFG_DEVICE_ADD(_tag, TIMER, 0) \ MCFG_DEVICE_ADD(_tag, TIMER, 0) \
timer_device::static_configure_periodic(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, NULL), _period); \ timer_device::static_configure_periodic(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, NULL, (_class *)0), _period); \
#define MCFG_TIMER_DRIVER_ADD_SCANLINE(_tag, _class, _callback, _screen, _first_vpos, _increment) \ #define MCFG_TIMER_DRIVER_ADD_SCANLINE(_tag, _class, _callback, _screen, _first_vpos, _increment) \
MCFG_DEVICE_ADD(_tag, TIMER, 0) \ MCFG_DEVICE_ADD(_tag, TIMER, 0) \
timer_device::static_configure_scanline(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, NULL), _screen, _first_vpos, _increment); \ timer_device::static_configure_scanline(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, NULL, (_class *)0), _screen, _first_vpos, _increment); \
#define MCFG_TIMER_MODIFY(_tag) \ #define MCFG_TIMER_MODIFY(_tag) \
MCFG_DEVICE_MODIFY(_tag) MCFG_DEVICE_MODIFY(_tag)
@ -95,7 +95,7 @@
timer_device::static_set_callback(*device, timer_device_expired_delegate(&_callback, #_callback)); \ timer_device::static_set_callback(*device, timer_device_expired_delegate(&_callback, #_callback)); \
#define MCFG_TIMER_DRIVER_CALLBACK(_class, _callback) \ #define MCFG_TIMER_DRIVER_CALLBACK(_class, _callback) \
timer_device::static_set_callback(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, NULL)); \ timer_device::static_set_callback(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, NULL, (_class *)0)); \
#define MCFG_TIMER_START_DELAY(_start_delay) \ #define MCFG_TIMER_START_DELAY(_start_delay) \
timer_device::static_set_start_delay(*device, _start_delay); \ timer_device::static_set_start_delay(*device, _start_delay); \