Previous 15994 Revisions Next

r11364 Thursday 28th April, 2011 at 08:31:51 UTC by Miodrag Milanović
Sync with MAME (r12315) (no whatsnew)
[src/emu]cheat.c cheat.h config.c config.h crsshair.c debugger.c devintrf.c devintrf.h diexec.c diexec.h emucore.h emupal.c image.c inptport.c input.c machine.c machine.h output.c render.c render.h romload.c schedule.c schedule.h screen.c screen.h sound.c sound.h tilemap.c ui.c uigfx.c uiinput.c uimenu.c video.c video.h watchdog.c
[src/emu/cpu]drcbec.c drcbec.h drcbeut.c drcbeut.h drcbex64.c drcbex64.h drcbex86.c drcbex86.h drccache.c drccache.h drcuml.h
[src/emu/debug]debugcmd.c debugcon.c debugcpu.c
[src/emu/debugint]debugint.c
[src/emu/machine]generic.c ldcore.c
[src/mame/drivers]avalnche.c battlex.c bionicc.c bishi.c bladestl.c blockout.c cps3.c deco32.c firebeat.c konamigq.c konamigv.c ksys573.c mediagx.c model3.c saturn.c taitosj.c
[src/mame/includes]blockout.h
[src/mame/machine]atari.c fd1089.c md_cart.c tecmosys.c
[src/mame/video]gaelco3d.c galastrm.c gtia.c gticlub.c jalblend.c midvunit.c midzeus.c midzeus2.c model2.c model3.c namcos22.c stvvdp2.c taitojc.c tia.c ygv608.c
[src/mess/drivers]gba.c genpc.c ip20.c ip22.c nc.c pdp1.c tx0.c
[src/mess/machine]apple2.c bebox.c cybiko.c dc.c dgn_beta.c electron.c gb.c lynx.c nes.c pdp1.c sms.c snescart.c tx0.c wswan.c
[src/mess/tools/messtest]testmess.c
[src/mess/video]nes.c
[src/osd/sdl]debugwin.c input.c output.c sdlmain.c sound.c video.c window.c
[src/osd/windows]input.c output.c sound.c video.c window.c winmain.c

src/mame/machine/md_cart.c
r11363r11364
19431943
19441944MACHINE_START( md_sram )
19451945{
1946   machine.add_notifier(MACHINE_NOTIFY_EXIT, genesis_machine_stop);
1946   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(genesis_machine_stop), &machine));
19471947}
19481948
19491949/******* 32X image loading *******/
src/mame/machine/fd1089.c
r11363r11364
410410   int A;
411411   decrypted = auto_alloc_array(machine, UINT16, size/2);
412412
413   machine.add_notifier(MACHINE_NOTIFY_EXIT, clear_decrypted);
413   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(clear_decrypted), &machine));
414414   space->set_decrypted_region(0x000000, size - 1, decrypted);
415415
416416   for (A = 0;A < size;A+=2)
src/mame/machine/atari.c
r11363r11364
349349   gtia_init(machine, &gtia_intf);
350350
351351   /* pokey */
352   machine.add_notifier(MACHINE_NOTIFY_RESET, pokey_reset);
352   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(pokey_reset), &machine));
353353
354354   /* ANTIC */
355   machine.add_notifier(MACHINE_NOTIFY_RESET, _antic_reset);
355   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(_antic_reset), &machine));
356356
357357   /* save states */
358358   state_save_register_global_pointer(machine, ((UINT8 *) &antic.r), sizeof(antic.r));
src/mame/machine/tecmosys.c
r11363r11364
121121   case 2: state->m_device_data = &tkdensha_data; break;
122122   }
123123
124   machine.add_notifier(MACHINE_NOTIFY_RESET, tecmosys_prot_reset);
124   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(tecmosys_prot_reset), &machine));
125125}
126126
127127READ16_HANDLER(tecmosys_prot_status_r)
src/mame/includes/blockout.h
r11363r11364
2020   UINT16   m_color;
2121
2222   /* devices */
23   device_t *m_maincpu;
2324   device_t *m_audiocpu;
2425};
2526
src/mame/video/ygv608.c
r11363r11364
544544   tilemap_B = NULL;
545545
546546   ygv608_register_state_save(machine);
547   machine.add_notifier(MACHINE_NOTIFY_EXIT, ygv608_exit);
547   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ygv608_exit), &machine));
548548}
549549
550550static void draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect)
src/mame/video/stvvdp2.c
r11363r11364
54445444
54455445static int stv_vdp2_start (running_machine &machine)
54465446{
5447   machine.add_notifier(MACHINE_NOTIFY_EXIT, stv_vdp2_exit);
5447   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(stv_vdp2_exit), &machine));
54485448
54495449   stv_vdp2_regs = auto_alloc_array_clear(machine, UINT32, 0x040000/4 );
54505450   stv_vdp2_vram = auto_alloc_array_clear(machine, UINT32, 0x100000/4 ); // actually we only need half of it since we don't emulate extra 4mbit ram cart.
src/mame/video/midzeus.c
r11363r11364
259259   poly = poly_alloc(machine, 10000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
260260
261261   /* we need to cleanup on exit */
262   machine.add_notifier(MACHINE_NOTIFY_EXIT, exit_handler);
262   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(exit_handler), &machine));
263263
264264   yoffs = 0;
265265   texel_width = 256;
src/mame/video/gticlub.c
r11363r11364
220220   K001005_3d_fifo = auto_alloc_array(machine, UINT32, 0x10000);
221221
222222   poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
223   machine.add_notifier(MACHINE_NOTIFY_EXIT, K001005_exit);
223   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(K001005_exit), &machine));
224224
225225   for (i=0; i < 128; i++)
226226   {
src/mame/video/gaelco3d.c
r11363r11364
6262   int width, height;
6363
6464   state->m_poly = poly_alloc(machine, 2000, sizeof(poly_extra_data), 0);
65   machine.add_notifier(MACHINE_NOTIFY_EXIT, gaelco3d_exit);
65   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gaelco3d_exit), &machine));
6666
6767   state->m_screenbits = machine.primary_screen->alloc_compatible_bitmap();
6868
src/mame/video/tia.c
r11363r11364
19951995
19961996   tia_reset( machine );
19971997
1998   machine.add_notifier(MACHINE_NOTIFY_RESET, tia_reset);
1998   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(tia_reset), &machine));
19991999}
20002000
src/mame/video/model2.c
r11363r11364
27152715   state->m_sys24_bitmap = auto_alloc(machine, bitmap_t(width, height+4, BITMAP_FORMAT_INDEXED16));
27162716
27172717   state->m_poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), 0);
2718   machine.add_notifier(MACHINE_NOTIFY_EXIT, model2_exit);
2718   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model2_exit), &machine));
27192719
27202720   /* initialize the hardware rasterizer */
27212721   model2_3d_init( machine, (UINT16*)machine.region("user3")->base() );
src/mame/video/taitojc.c
r11363r11364
177177   int width, height;
178178
179179   state->m_poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
180   machine.add_notifier(MACHINE_NOTIFY_EXIT, taitojc_exit);
180   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(taitojc_exit), &machine));
181181
182182   /* find first empty slot to decode gfx */
183183   for (state->m_gfx_index = 0; state->m_gfx_index < MAX_GFX_ELEMENTS; state->m_gfx_index++)
src/mame/video/midzeus2.c
r11363r11364
273273   poly = poly_alloc(machine, 10000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
274274
275275   /* we need to cleanup on exit */
276   machine.add_notifier(MACHINE_NOTIFY_EXIT, exit_handler);
276   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(exit_handler), &machine));
277277
278278   zbase = 2.0f;
279279   yoffs = 0;
src/mame/video/model3.c
r11363r11364
120120   int width, height;
121121
122122   state->m_poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), 0);
123   machine.add_notifier(MACHINE_NOTIFY_EXIT, model3_exit);
123   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model3_exit), &machine));
124124
125125   width = machine.primary_screen->width();
126126   height = machine.primary_screen->height();
src/mame/video/galastrm.c
r11363r11364
3737   state->m_polybitmap = machine.primary_screen->alloc_compatible_bitmap();
3838
3939   state->m_poly = poly_alloc(machine, 16, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
40   machine.add_notifier(MACHINE_NOTIFY_EXIT, galastrm_exit);
40   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(galastrm_exit), &machine));
4141}
4242
4343/************************************************************
src/mame/video/namcos22.c
r11363r11364
22302230#else
22312231   state->m_poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), 0);
22322232#endif
2233   machine.add_notifier(MACHINE_NOTIFY_RESET, namcos22_reset);
2234   machine.add_notifier(MACHINE_NOTIFY_EXIT, namcos22_exit);
2233   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(namcos22_reset), &machine));
2234   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(namcos22_exit), &machine));
22352235
22362236   gfx_element_set_source(machine.gfx[GFX_CHAR], (UINT8 *)state->m_cgram);
22372237}
src/mame/video/midvunit.c
r11363r11364
6868   midvunit_state *state = machine.driver_data<midvunit_state>();
6969   state->m_scanline_timer = machine.scheduler().timer_alloc(FUNC(scanline_timer_cb));
7070   state->m_poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
71   machine.add_notifier(MACHINE_NOTIFY_EXIT, midvunit_exit);
71   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(midvunit_exit), &machine));
7272
7373   state_save_register_global_array(machine, state->m_video_regs);
7474   state_save_register_global_array(machine, state->m_dma_data);
src/mame/video/gtia.c
r11363r11364
6868   memset(&gtia, 0, sizeof(gtia));
6969   gtia.intf = *intf;
7070
71   machine.add_notifier(MACHINE_NOTIFY_RESET, gtia_reset);
71   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(gtia_reset), &machine));
7272
7373   /* state saves */
7474   gtia_state(machine);
src/mame/video/jalblend.c
r11363r11364
2929   if (enable)
3030   {
3131      jal_blend_table = auto_alloc_array_clear(machine, UINT8, 0xc00);
32      machine.add_notifier(MACHINE_NOTIFY_RESET, jal_blend_reset);
32      machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(jal_blend_reset), &machine));
3333   }
3434   else
3535   {
src/mame/drivers/mediagx.c
r11363r11364
12641264      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(entries[i].offset, entries[i].offset + 3, speedup_handlers[i].func, speedup_handlers[i].name);
12651265
12661266#ifdef MAME_DEBUG
1267   machine.add_notifier(MACHINE_NOTIFY_EXIT, report_speedups);
1267   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(report_speedups), &machine));
12681268#endif
12691269}
12701270
src/mame/drivers/deco32.c
r11363r11364
17821782   "screen",
17831783   0, 1, // pf12only, split, fullwidth12 / fullwidth34
17841784   0x0f, 0x0f, /* trans masks (default values) */
1785   0x20, 0x20, /* color base */
1785   0x20, 0x30, /* color base */
17861786   0x0f, 0x0f, /* color masks (default values) */
17871787   NULL,
17881788   NULL,
src/mame/drivers/avalnche.c
r11363r11364
3030
3131#include "emu.h"
3232#include "cpu/m6502/m6502.h"
33#include "deprecat.h"
3433#include "sound/discrete.h"
3534#include "includes/avalnche.h"
3635
r11363r11364
234233 *
235234 *************************************/
236235
237static INTERRUPT_GEN( avalnche_interrupt )
238{
239   device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
240}
241
242236static MACHINE_START( avalnche )
243237{
244238   avalnche_state *state = machine.driver_data<avalnche_state>();
r11363r11364
258252   /* basic machine hardware */
259253   MCFG_CPU_ADD("maincpu", M6502,MASTER_CLOCK/16)      /* clock input is the "2H" signal divided by two */
260254   MCFG_CPU_PROGRAM_MAP(main_map)
261   MCFG_CPU_VBLANK_INT_HACK(avalnche_interrupt,8)
255   MCFG_CPU_PERIODIC_INT(nmi_line_pulse,8*60)
262256
263257   MCFG_MACHINE_START(avalnche)
264258   MCFG_MACHINE_RESET(avalnche)
src/mame/drivers/bionicc.c
r11363r11364
5757#include "emu.h"
5858#include "cpu/z80/z80.h"
5959#include "cpu/m68000/m68000.h"
60#include "deprecat.h"
6160#include "sound/2151intf.h"
6261#include "includes/bionicc.h"
6362
r11363r11364
127126  IRQ 2 drives the game
128127  IRQ 4 processes the input ports
129128
130  The game is very picky about timing. The following is the only
131  way I have found it to work.
132
133129********************************************************************/
134130
135static INTERRUPT_GEN( bionicc_interrupt )
131static TIMER_DEVICE_CALLBACK( bionicc_scanline )
136132{
137   if (cpu_getiloops(device) == 0)
138      device_set_input_line(device, 2, HOLD_LINE);
139   else
140      device_set_input_line(device, 4, HOLD_LINE);
133   int scanline = param;
134
135   if(scanline == 240) // vblank-out irq
136      cputag_set_input_line(timer.machine(), "maincpu", 2, HOLD_LINE);
137
138   if(scanline == 0) // vblank-in or i8751 related irq
139      cputag_set_input_line(timer.machine(), "maincpu", 4, HOLD_LINE);
141140}
142141
142
143143/*************************************
144144 *
145145 *  Address maps
r11363r11364
361361   /* basic machine hardware */
362362   MCFG_CPU_ADD("maincpu", M68000, MASTER_CLOCK / 2) /* 12 MHz - verified in schematics */
363363   MCFG_CPU_PROGRAM_MAP(main_map)
364   MCFG_CPU_VBLANK_INT_HACK(bionicc_interrupt,8)
364   MCFG_TIMER_ADD_SCANLINE("scantimer", bionicc_scanline, "screen", 0, 1)
365365
366366   MCFG_CPU_ADD("audiocpu", Z80, EXO3_F0_CLK / 4)   /* EXO3 C,B=GND, A=5V ==> Divisor 2^2 */
367367   MCFG_CPU_PROGRAM_MAP(sound_map)
src/mame/drivers/battlex.c
r11363r11364
4444
4545#include "emu.h"
4646#include "cpu/z80/z80.h"
47#include "deprecat.h"
4847#include "sound/ay8910.h"
4948#include "includes/battlex.h"
5049
src/mame/drivers/konamigq.c
r11363r11364
365365
366366   /* init the scsi controller and hook up it's DMA */
367367   am53cf96_init(machine, &scsi_intf);
368   machine.add_notifier(MACHINE_NOTIFY_EXIT, konamigq_exit);
368   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(konamigq_exit), &machine));
369369   psx_dma_install_read_handler(machine, 5, scsi_dma_read);
370370   psx_dma_install_write_handler(machine, 5, scsi_dma_write);
371371
src/mame/drivers/bishi.c
r11363r11364
8484***************************************************************************/
8585
8686#include "emu.h"
87#include "deprecat.h"
8887#include "video/konicdev.h"
8988#include "cpu/m68000/m68000.h"
9089#include "sound/ymz280b.h"
r11363r11364
110109   COMBINE_DATA(&state->m_cur_control2);
111110}
112111
113static INTERRUPT_GEN(bishi_interrupt)
112static TIMER_DEVICE_CALLBACK( bishi_scanline )
114113{
115   bishi_state *state = device->machine().driver_data<bishi_state>();
114   bishi_state *state = timer.machine().driver_data<bishi_state>();
115   int scanline = param;
116
116117   if (state->m_cur_control & 0x800)
117118   {
118      switch (cpu_getiloops(device))
119      {
120         case 0:
121            device_set_input_line(device, M68K_IRQ_3, HOLD_LINE);
122            break;
119      if(scanline == 240) // vblank-out irq
120         cputag_set_input_line(timer.machine(), "maincpu", M68K_IRQ_3, HOLD_LINE);
123121
124         case 1:
125            device_set_input_line(device, M68K_IRQ_4, HOLD_LINE);
126            break;
127      }
122      if(scanline == 0) // vblank-in irq
123         cputag_set_input_line(timer.machine(), "maincpu", M68K_IRQ_4, HOLD_LINE);
128124   }
129125}
130126
r11363r11364
370366static void sound_irq_gen(device_t *device, int state)
371367{
372368   bishi_state *bishi = device->machine().driver_data<bishi_state>();
373   if (state)
374      device_set_input_line(bishi->m_maincpu, M68K_IRQ_1, ASSERT_LINE);
375   else
376      device_set_input_line(bishi->m_maincpu, M68K_IRQ_1, CLEAR_LINE);
369
370   device_set_input_line(bishi->m_maincpu, M68K_IRQ_1, (state) ? ASSERT_LINE : CLEAR_LINE);
377371}
378372
379373static const ymz280b_interface ymz280b_intf =
r11363r11364
423417   /* basic machine hardware */
424418   MCFG_CPU_ADD("maincpu", M68000, CPU_CLOCK) /* 12MHz (24MHz OSC / 2 ) */
425419   MCFG_CPU_PROGRAM_MAP(main_map)
426   MCFG_CPU_VBLANK_INT_HACK(bishi_interrupt, 2)
420   MCFG_TIMER_ADD_SCANLINE("scantimer", bishi_scanline, "screen", 0, 1)
427421
428422   MCFG_MACHINE_START(bishi)
429423   MCFG_MACHINE_RESET(bishi)
src/mame/drivers/taitosj.c
r11363r11364
27292729   state->save_item(NAME(state->m_dac_out));
27302730   state->save_item(NAME(state->m_dac_vol));
27312731
2732   machine.add_notifier(MACHINE_NOTIFY_RESET, reset_common);
2732   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(reset_common), &machine));
27332733}
27342734
27352735static DRIVER_INIT( taitosj )
src/mame/drivers/model3.c
r11363r11364
11971197static MACHINE_START(model3_10)
11981198{
11991199   lsi53c810_init(machine, &scsi_intf);
1200   machine.add_notifier(MACHINE_NOTIFY_EXIT, model3_exit);
1200   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model3_exit), &machine));
12011201   configure_fast_ram(machine);
12021202}
12031203static MACHINE_START(model3_15)
12041204{
12051205   lsi53c810_init(machine, &scsi_intf);
1206   machine.add_notifier(MACHINE_NOTIFY_EXIT, model3_exit);
1206   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model3_exit), &machine));
12071207   configure_fast_ram(machine);
12081208}
12091209static MACHINE_START(model3_20)
src/mame/drivers/cps3.c
r11363r11364
23182318static MACHINE_START( cps3 )
23192319{
23202320   wd33c93_init(machine, &scsi_intf);
2321   machine.add_notifier(MACHINE_NOTIFY_EXIT, cps3_exit);
2321   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cps3_exit), &machine));
23222322}
23232323
23242324static MACHINE_RESET( cps3 )
src/mame/drivers/firebeat.c
r11363r11364
936936   SCSIAllocInstance( machine, SCSI_DEVICE_CDROM, &state->m_atapi_device_data[0], "scsi0" );
937937   // TODO: the slave drive can be either CD-ROM, DVD-ROM or HDD
938938   SCSIAllocInstance( machine, SCSI_DEVICE_CDROM, &state->m_atapi_device_data[1], "scsi1" );
939   machine.add_notifier(MACHINE_NOTIFY_EXIT, atapi_exit);
939   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(atapi_exit), &machine));
940940}
941941
942942static void atapi_reset(running_machine &machine)
src/mame/drivers/blockout.c
r11363r11364
6666
6767#include "emu.h"
6868#include "cpu/m68000/m68000.h"
69#include "deprecat.h"
7069#include "cpu/z80/z80.h"
7170#include "sound/2151intf.h"
7271#include "sound/okim6295.h"
7372#include "includes/blockout.h"
7473
74#define MAIN_CLOCK XTAL_10MHz
75#define AUDIO_CLOCK XTAL_3_579545MHz
7576
76static INTERRUPT_GEN( blockout_interrupt )
77{
78   /* interrupt 6 is vblank */
79   /* interrupt 5 reads coin inputs - might have to be triggered only */
80   /* when a coin is inserted */
81   device_set_input_line(device, 6 - cpu_getiloops(device), HOLD_LINE);
82}
83
8477static WRITE16_HANDLER( blockout_sound_command_w )
8578{
8679   blockout_state *state = space->machine().driver_data<blockout_state>();
r11363r11364
9285   }
9386}
9487
88static WRITE16_HANDLER( blockout_irq6_ack_w )
89{
90   blockout_state *state = space->machine().driver_data<blockout_state>();
9591
92   device_set_input_line(state->m_maincpu, 6, CLEAR_LINE);
93}
94
95static WRITE16_HANDLER( blockout_irq5_ack_w )
96{
97   blockout_state *state = space->machine().driver_data<blockout_state>();
98
99   device_set_input_line(state->m_maincpu, 5, CLEAR_LINE);
100}
101
96102/*************************************
97103 *
98104 *  Address maps
r11363r11364
106112   AM_RANGE(0x100004, 0x100005) AM_READ_PORT("SYSTEM")
107113   AM_RANGE(0x100006, 0x100007) AM_READ_PORT("DSW1")
108114   AM_RANGE(0x100008, 0x100009) AM_READ_PORT("DSW2")
115   AM_RANGE(0x100010, 0x100011) AM_WRITE(blockout_irq6_ack_w)
116   AM_RANGE(0x100012, 0x100013) AM_WRITE(blockout_irq5_ack_w)
109117   AM_RANGE(0x100014, 0x100015) AM_WRITE(blockout_sound_command_w)
110118   AM_RANGE(0x100016, 0x100017) AM_WRITENOP   /* don't know, maybe reset sound CPU */
111119   AM_RANGE(0x180000, 0x1bffff) AM_RAM_WRITE(blockout_videoram_w) AM_BASE_MEMBER(blockout_state, m_videoram)
r11363r11364
257265{
258266   blockout_state *state = machine.driver_data<blockout_state>();
259267
268   state->m_maincpu = machine.device("maincpu");
260269   state->m_audiocpu = machine.device("audiocpu");
261270
262271   state->save_item(NAME(state->m_color));
r11363r11364
269278   state->m_color = 0;
270279}
271280
281static TIMER_DEVICE_CALLBACK( blockout_scanline )
282{
283   blockout_state *state = timer.machine().driver_data<blockout_state>();
284   int scanline = param;
285
286   if(scanline == 248) // vblank-out irq
287      device_set_input_line(state->m_maincpu, 6, ASSERT_LINE);
288
289   if(scanline == 0) // vblank-in irq or directly tied to coin inputs (TODO: check)
290      device_set_input_line(state->m_maincpu, 5, ASSERT_LINE);
291}
292
272293static MACHINE_CONFIG_START( blockout, blockout_state )
273294
274295   /* basic machine hardware */
275   MCFG_CPU_ADD("maincpu", M68000, 10000000)       /* MRH - 8.76 makes gfx/adpcm samples sync better -- but 10 is correct speed*/
296   MCFG_CPU_ADD("maincpu", M68000, MAIN_CLOCK)       /* MRH - 8.76 makes gfx/adpcm samples sync better -- but 10 is correct speed*/
276297   MCFG_CPU_PROGRAM_MAP(main_map)
277   MCFG_CPU_VBLANK_INT_HACK(blockout_interrupt,2)
298   MCFG_TIMER_ADD_SCANLINE("scantimer", blockout_scanline, "screen", 0, 1)
278299
279   MCFG_CPU_ADD("audiocpu", Z80, 3579545)   /* 3.579545 MHz */
300   MCFG_CPU_ADD("audiocpu", Z80, AUDIO_CLOCK)   /* 3.579545 MHz */
280301   MCFG_CPU_PROGRAM_MAP(audio_map)
281302
282303   MCFG_MACHINE_START(blockout)
r11363r11364
298319   /* sound hardware */
299320   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
300321
301   MCFG_SOUND_ADD("ymsnd", YM2151, 3579545)
322   MCFG_SOUND_ADD("ymsnd", YM2151, AUDIO_CLOCK)
302323   MCFG_SOUND_CONFIG(ym2151_config)
303324   MCFG_SOUND_ROUTE(0, "lspeaker", 0.60)
304325   MCFG_SOUND_ROUTE(1, "rspeaker", 0.60)
src/mame/drivers/konamigv.c
r11363r11364
306306
307307   /* init the scsi controller and hook up it's DMA */
308308   am53cf96_init(machine, &scsi_intf);
309   machine.add_notifier(MACHINE_NOTIFY_EXIT, konamigv_exit);
309   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(konamigv_exit), &machine));
310310   psx_dma_install_read_handler(machine, 5, scsi_dma_read);
311311   psx_dma_install_write_handler(machine, 5, scsi_dma_write);
312312}
src/mame/drivers/ksys573.c
r11363r11364
10321032         state->m_available_cdroms[ i ] = NULL;
10331033      }
10341034   }
1035   machine.add_notifier(MACHINE_NOTIFY_EXIT, atapi_exit);
1035   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(atapi_exit), &machine));
10361036
10371037
10381038   state->save_item( NAME(state->m_atapi_regs) );
src/mame/drivers/bladestl.c
r11363r11364
2222        * The protection is not fully understood(Konami 051733). The
2323        game is playable, but is not 100% accurate.
2424        * Missing samples.
25        (both issues above are outdated?)
2526
2627***************************************************************************/
2728
2829#include "emu.h"
29#include "deprecat.h"
3030#include "cpu/m6809/m6809.h"
3131#include "cpu/hd6309/hd6309.h"
3232#include "sound/2203intf.h"
r11363r11364
3636#include "includes/bladestl.h"
3737
3838
39static INTERRUPT_GEN( bladestl_interrupt )
39static TIMER_DEVICE_CALLBACK( bladestl_scanline )
4040{
41   bladestl_state *state = device->machine().driver_data<bladestl_state>();
41   bladestl_state *state = timer.machine().driver_data<bladestl_state>();
42   int scanline = param;
4243
43   if (cpu_getiloops(device) == 0)
44   {
45      if (k007342_is_int_enabled(state->m_k007342))
46         device_set_input_line(device, HD6309_FIRQ_LINE, HOLD_LINE);
47   }
48   else if (cpu_getiloops(device) % 2)
49   {
50      device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
51   }
44   if(scanline == 240 && k007342_is_int_enabled(state->m_k007342)) // vblank-out irq
45      cputag_set_input_line(timer.machine(), "maincpu", HD6309_FIRQ_LINE, HOLD_LINE);
46
47   if(scanline == 0) // vblank-in or timer irq
48      cputag_set_input_line(timer.machine(), "maincpu", INPUT_LINE_NMI, PULSE_LINE);
5249}
5350
5451/*************************************
r11363r11364
338335   /* basic machine hardware */
339336   MCFG_CPU_ADD("maincpu", HD6309, 24000000/2)      /* 24MHz/2 (?) */
340337   MCFG_CPU_PROGRAM_MAP(main_map)
341   MCFG_CPU_VBLANK_INT_HACK(bladestl_interrupt,2) /* (1 IRQ + 1 NMI) */
338   MCFG_TIMER_ADD_SCANLINE("scantimer", bladestl_scanline, "screen", 0, 1)
342339
343340   MCFG_CPU_ADD("audiocpu", M6809, 2000000)
344341   MCFG_CPU_PROGRAM_MAP(sound_map)
src/mame/drivers/saturn.c
r11363r11364
31493149
31503150   stv_register_protection_savestates(machine); // machine/stvprot.c
31513151
3152   machine.add_notifier(MACHINE_NOTIFY_EXIT, stvcd_exit);
3152   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(stvcd_exit), &machine));
31533153
31543154   smpc_ram[0x23] = DectoBCD(systime.local_time.year /100);
31553155    smpc_ram[0x25] = DectoBCD(systime.local_time.year %100);
r11363r11364
31923192   state_save_register_global(machine, smpcSR);
31933193   state_save_register_global_array(machine, SMEM);
31943194
3195   machine.add_notifier(MACHINE_NOTIFY_EXIT, stvcd_exit);
3195   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(stvcd_exit), &machine));
31963196}
31973197
31983198
src/osd/sdl/video.c
r11363r11364
110110   extract_video_config(machine);
111111
112112   // ensure we get called on the way out
113   machine.add_notifier(MACHINE_NOTIFY_EXIT, video_exit);
113   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(video_exit), &machine));
114114
115115   // set up monitors first
116116   init_monitors();
src/osd/sdl/sdlmain.c
r11363r11364
622622      osd_sdl_info();
623623   }
624624   // must be before sdlvideo_init!
625   machine.add_notifier(MACHINE_NOTIFY_EXIT, osd_exit);
625   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(osd_exit), &machine));
626626
627627   defines_verbose();
628628
src/osd/sdl/output.c
r11363r11364
7575{
7676   int fildes;
7777
78   machine.add_notifier(MACHINE_NOTIFY_EXIT, sdloutput_exit);
78   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sdloutput_exit), &machine));
7979
8080   fildes = open(SDLMAME_OUTPUT, O_RDWR | O_NONBLOCK);
8181
src/osd/sdl/sound.c
r11363r11364
9393      if (sdl_init(machine))
9494         return;
9595
96      machine.add_notifier(MACHINE_NOTIFY_EXIT, sdl_cleanup_audio);
96      machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sdl_cleanup_audio), &machine));
9797      // set the startup volume
9898      machine.osd().set_mastervolume(attenuation);
9999   }
src/osd/sdl/input.c
r11363r11364
11051105   app_has_mouse_focus = 1;
11061106
11071107   // we need pause and exit callbacks
1108   machine.add_notifier(MACHINE_NOTIFY_PAUSE, sdlinput_pause);
1109   machine.add_notifier(MACHINE_NOTIFY_RESUME, sdlinput_resume);
1110   machine.add_notifier(MACHINE_NOTIFY_EXIT, sdlinput_exit);
1108   machine.add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(FUNC(sdlinput_pause), &machine);
1109   machine.add_notifier(MACHINE_NOTIFY_RESUME, machine_notify_delegate(FUNC(sdlinput_resume), &machine));
1110   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sdlinput_exit), &machine));
11111111
11121112   // allocate a lock for input synchronizations
11131113   input_lock = osd_lock_alloc();
src/osd/sdl/debugwin.c
r11363r11364
545545void sdl_osd_interface::init_debugger()
546546{
547547   /* register callbacks */
548   config_register(machine(), "debugger", configuration_load, configuration_save);
548   config_register(machine(), "debugger", config_saveload_delegate(FUNC(configuration_load), &machine), config_saveload_delegate(FUNC(configuration_save), &machine));
549549}
550550
551551
src/osd/sdl/window.c
r11363r11364
213213   main_threadid = SDL_ThreadID();
214214
215215   // ensure we get called on the way out
216   machine.add_notifier(MACHINE_NOTIFY_EXIT, sdlwindow_exit);
216   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sdlwindow_exit), &machine));
217217
218218   // if multithreading, create a thread to run the windows
219219   if (multithreading_enabled)
src/osd/windows/output.c
r11363r11364
119119   int result;
120120
121121   // ensure we get cleaned up
122   machine.add_notifier(MACHINE_NOTIFY_EXIT, winoutput_exit);
122   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(winoutput_exit), &machine));
123123
124124   // reset globals
125125   clientlist = NULL;
src/osd/windows/sound.c
r11363r11364
119119      return;
120120
121121   // ensure we get called on the way out
122   machine.add_notifier(MACHINE_NOTIFY_EXIT, sound_exit);
122   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sound_exit), &machine));
123123
124124   // attempt to initialize directsound
125125   // don't make it fatal if we can't -- we'll just run without sound
src/osd/windows/input.c
r11363r11364
507507void wininput_init(running_machine &machine)
508508{
509509   // we need pause and exit callbacks
510   machine.add_notifier(MACHINE_NOTIFY_PAUSE, wininput_pause);
511   machine.add_notifier(MACHINE_NOTIFY_RESUME, wininput_resume);
512   machine.add_notifier(MACHINE_NOTIFY_EXIT, wininput_exit);
510   machine.add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(FUNC(wininput_pause), &machine));
511   machine.add_notifier(MACHINE_NOTIFY_RESUME, machine_notify_delegate(FUNC(wininput_resume), &machine));
512   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(wininput_exit), &machine));
513513
514514   // allocate a lock for input synchronizations, since messages sometimes come from another thread
515515   input_lock = osd_lock_alloc();
r11363r11364
952952      return;
953953
954954   // we need an exit callback
955   machine.add_notifier(MACHINE_NOTIFY_EXIT, win32_exit);
955   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(win32_exit), &machine));
956956
957957   // allocate two lightgun devices
958958   for (gunnum = 0; gunnum < 2; gunnum++)
r11363r11364
11201120   mame_printf_verbose("DirectInput: Using DirectInput %d\n", dinput_version >> 8);
11211121
11221122   // we need an exit callback
1123   machine.add_notifier(MACHINE_NOTIFY_EXIT, dinput_exit);
1123   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(dinput_exit), &machine));
11241124
11251125   // initialize keyboard devices, but only if we don't have any yet
11261126   if (keyboard_list == NULL)
r11363r11364
16601660   HMODULE user32;
16611661
16621662   // we need pause and exit callbacks
1663   machine.add_notifier(MACHINE_NOTIFY_EXIT, rawinput_exit);
1663   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(rawinput_exit), &machine));
16641664
16651665   // look in user32 for the raw input APIs
16661666   user32 = LoadLibrary(TEXT("user32.dll"));
src/osd/windows/winmain.c
r11363r11364
560560      SetThreadPriority(GetCurrentThread(), options.priority());
561561
562562   // ensure we get called on the way out
563   machine.add_notifier(MACHINE_NOTIFY_EXIT, osd_exit);
563   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(osd_exit), &machine));
564564
565565   // get number of processors
566566   stemp = options.numprocessors();
src/osd/windows/video.c
r11363r11364
111111   int index;
112112
113113   // ensure we get called on the way out
114   machine.add_notifier(MACHINE_NOTIFY_EXIT, winvideo_exit);
114   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(winvideo_exit), &machine));
115115
116116   // extract data from the options
117117   extract_video_config(machine);
src/osd/windows/window.c
r11363r11364
230230   main_threadid = GetCurrentThreadId();
231231
232232   // ensure we get called on the way out
233   machine.add_notifier(MACHINE_NOTIFY_EXIT, winwindow_exit);
233   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(winwindow_exit), &machine));
234234
235235   // set up window class and register it
236236   create_window_class();
src/emu/debug/debugcpu.c
r11363r11364
113113
114114/* internal helpers */
115115static void debug_cpu_exit(running_machine &machine);
116static void on_vblank(screen_device &device, void *param, bool vblank_state);
116static void on_vblank(running_machine &machine, screen_device &device, bool vblank_state);
117117static void reset_transient_flags(running_machine &machine);
118118static void process_source_file(running_machine &machine);
119119
r11363r11364
182182
183183   /* add callback for breaking on VBLANK */
184184   if (machine.primary_screen != NULL)
185      machine.primary_screen->register_vblank_callback(on_vblank, NULL);
185      machine.primary_screen->register_vblank_callback(vblank_state_delegate(FUNC(on_vblank), &machine));
186186
187   machine.add_notifier(MACHINE_NOTIFY_EXIT, debug_cpu_exit);
187   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(debug_cpu_exit), &machine));
188188}
189189
190190
r11363r11364
10681068    on_vblank - called when a VBLANK hits
10691069-------------------------------------------------*/
10701070
1071static void on_vblank(screen_device &device, void *param, bool vblank_state)
1071static void on_vblank(running_machine &machine, screen_device &device, bool vblank_state)
10721072{
10731073   /* just set a global flag to be consumed later */
10741074   if (vblank_state)
src/emu/debug/debugcmd.c
r11363r11364
369369   debug_console_register_command(machine, "softreset",   CMDFLAG_NONE, 0, 0, 1, execute_softreset);
370370   debug_console_register_command(machine, "hardreset",   CMDFLAG_NONE, 0, 0, 1, execute_hardreset);
371371
372   machine.add_notifier(MACHINE_NOTIFY_EXIT, debug_command_exit);
372   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(debug_command_exit), &machine));
373373
374374   /* set up the initial debugscript if specified */
375375   name = machine.options().debug_script();
src/emu/debug/debugcon.c
r11363r11364
9999   debug_console_printf(machine, "Currently targeting %s (%s)\n", machine.system().name, machine.system().description);
100100
101101   /* request callback upon exiting */
102   machine.add_notifier(MACHINE_NOTIFY_EXIT, debug_console_exit);
102   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(debug_console_exit), &machine));
103103}
104104
105105
src/emu/cpu/drcuml.h
r11363r11364
166166
167167
168168// interface structure for a back-end
169class drcbe_interface
169class drcbe_interface : public bindable_object
170170{
171171public:
172172   // construction/destruction
src/emu/cpu/drcbex64.c
r11363r11364
621621     m_entry(NULL),
622622     m_exit(NULL),
623623     m_nocode(NULL),
624     m_fixup_label(FUNC(drcbe_x64::fixup_label), this),
625     m_fixup_exception(FUNC(drcbe_x64::fixup_exception), this),
624626     m_near(*(near_state *)cache.alloc_near(sizeof(m_near)))
625627{
626628   // build up necessary arrays
r11363r11364
29312933   assert(labelp.is_code_label());
29322934
29332935   // look up the jump target and jump there
2934   x86code *jmptarget = (x86code *)m_labels.get_codeptr(labelp.label(), fixup_label, dst);
2936   x86code *jmptarget = (x86code *)m_labels.get_codeptr(labelp.label(), m_fixup_label, dst);
29352937   if (jmptarget == NULL)
29362938      jmptarget = dst + 0x7ffffff0;
29372939   if (inst.condition() == uml::COND_ALWAYS)
r11363r11364
29752977   else
29762978   {
29772979      emit_jcc(dst, X86_CONDITION(inst.condition()), dst + 0x7ffffff0);            // jcc   exception
2978      m_cache.request_oob_codegen(oob_func_stub<drcbe_x64, &drcbe_x64::fixup_exception>, dst, &const_cast<instruction &>(inst), this);
2980      m_cache.request_oob_codegen(m_fixup_exception, dst, &const_cast<instruction &>(inst));
29792981   }
29802982}
29812983
src/emu/cpu/drcbec.c
r11363r11364
319319   : drcbe_interface(drcuml, cache, device),
320320     m_hash(cache, modes, addrbits, ignorebits),
321321     m_map(cache, 0),
322     m_labels(cache)
322     m_labels(cache),
323     m_fixup_delegate(FUNC(drcbe_c::fixup_label), this)
323324{
324325}
325326
r11363r11364
403404         // JMP instructions need to resolve their labels
404405         case OP_JMP:
405406            (dst++)->i = MAKE_OPCODE_FULL(opcode, inst.size(), inst.condition(), inst.flags(), 1);
406            dst->inst = (drcbec_instruction *)m_labels.get_codeptr(inst.param(0).label(), fixup_label, dst);
407            dst->inst = (drcbec_instruction *)m_labels.get_codeptr(inst.param(0).label(), m_fixup_delegate, dst);
407408            dst++;
408409            break;
409410
src/emu/cpu/drcbex64.h
r11363r11364
149149   void emit_smart_call_r64(x86code *&dst, x86code *target, UINT8 reg);
150150   void emit_smart_call_m64(x86code *&dst, x86code **target);
151151
152   static void fixup_label(void *parameter, drccodeptr labelcodeptr);
152   void fixup_label(void *parameter, drccodeptr labelcodeptr);
153153   void fixup_exception(drccodeptr *codeptr, void *param1, void *param2);
154154
155155   static void debug_log_hashjmp(offs_t pc, int mode);
r11363r11364
333333   x86code *            m_exit;               // exit point
334334   x86code *            m_nocode;            // nocode handler
335335
336   drc_label_fixup_delegate m_fixup_label;         // precomputed delegate for fixups
337   drc_oob_delegate      m_fixup_exception;      // precomputed delegate for exception fixups
338
336339   // state to live in the near cache
337340   struct near_state
338341   {
src/emu/cpu/drcbec.h
r11363r11364
7070private:
7171   // helpers
7272   void output_parameter(drcbec_instruction **dstptr, void **immedptr, int size, const uml::parameter &param);
73   static void fixup_label(void *parameter, drccodeptr labelcodeptr);
73   void fixup_label(void *parameter, drccodeptr labelcodeptr);
7474   int dmulu(UINT64 &dstlo, UINT64 &dsthi, UINT64 src1, UINT64 src2, int flags);
7575   int dmuls(UINT64 &dstlo, UINT64 &dsthi, INT64 src1, INT64 src2, int flags);
7676
r11363r11364
7878   drc_hash_table         m_hash;               // hash table state
7979   drc_map_variables      m_map;               // code map
8080   drc_label_list         m_labels;            // label list
81   drc_label_fixup_delegate m_fixup_delegate;      // precomputed delegate
8182
8283   static const UINT32      s_condition_map[32];
8384   static UINT64         s_immediate_zero;
src/emu/cpu/drccache.c
r11363r11364
243243   while ((oob = m_ooblist.detach_head()) != NULL)
244244   {
245245      // call the callback
246      (*oob->m_callback)(&m_top, oob->m_param1, oob->m_param2, oob->m_param3);
246      oob->m_callback(&m_top, oob->m_param1, oob->m_param2);
247247      assert(m_top - m_codegen < CODEGEN_MAX_BYTES);
248248
249249      // release our memory
r11363r11364
263263//  out-of-band codegen
264264//-------------------------------------------------
265265
266void drc_cache::request_oob_codegen(oob_func callback, void *param1, void *param2, void *param3)
266void drc_cache::request_oob_codegen(drc_oob_delegate callback, void *param1, void *param2)
267267{
268268   assert(m_codegen != NULL);
269269
r11363r11364
275275   oob->m_callback = callback;
276276   oob->m_param1 = param1;
277277   oob->m_param2 = param2;
278   oob->m_param3 = param3;
279278
280279   // add to the tail
281280   m_ooblist.append(*oob);
src/emu/cpu/drccache.h
r11363r11364
6363
6464
6565// helper template for oob codegen
66template<class T, void (T::*func)(drccodeptr *codeptr, void *param1, void *param2)>
67void oob_func_stub(drccodeptr *codeptr, void *param1, void *param2, void *param3)
68{
69   T *target = reinterpret_cast<T *>(param3);
70   (target->*func)(codeptr, param1, param2);
71}
66typedef delegate<void (drccodeptr *, void *, void *)> drc_oob_delegate;
7267
7368
7469// drc_cache
7570class drc_cache
7671{
7772public:
78   // out of band codegen callback
79   typedef void (*oob_func)(drccodeptr *codeptr, void *param1, void *param2, void *param3);
80
8173   // construction/destruction
8274   drc_cache(size_t bytes);
8375   ~drc_cache();
r11363r11364
9082   // pointer checking
9183   bool contains_pointer(const void *ptr) const { return ((const drccodeptr)ptr >= m_near && (const drccodeptr)ptr < m_near + m_size); }
9284   bool contains_near_pointer(const void *ptr) const { return ((const drccodeptr)ptr >= m_near && (const drccodeptr)ptr < m_neartop); }
85   bool generating_code() const { return (m_codegen != NULL); }
9386
9487   // memory management
9588   void flush();
r11363r11364
10194   // codegen helpers
10295   drccodeptr *begin_codegen(UINT32 reserve_bytes);
10396   drccodeptr end_codegen();
104   void request_oob_codegen(oob_func callback, void *param1 = NULL, void *param2 = NULL, void *param3 = NULL);
97   void request_oob_codegen(drc_oob_delegate callback, void *param1 = NULL, void *param2 = NULL);
10598
10699private:
107100   // largest block of code that can be generated at once
r11363r11364
131124      oob_handler *next() const { return m_next; }
132125
133126      oob_handler *   m_next;            // next handler
134      oob_func      m_callback;         // callback function
127      drc_oob_delegate m_callback;      // callback function
135128      void *         m_param1;         // 1st pointer parameter
136129      void *         m_param2;         // 2nd pointer parameter
137      void *         m_param3;         // 3rd pointer parameter
138130   };
139131   simple_list<oob_handler> m_ooblist;      // list of oob handlers
140132
src/emu/cpu/drcbeut.c
r11363r11364
463463//-------------------------------------------------
464464
465465drc_label_list::drc_label_list(drc_cache &cache)
466   : m_cache(cache)
466   : m_cache(cache),
467     m_oob_callback_delegate(FUNC(drc_label_list::oob_callback), this)
467468{
468469}
469470
r11363r11364
497498
498499void drc_label_list::block_end(drcuml_block &block)
499500{
501   // can't free until the cache is clean of our OOB requests
502   assert(!m_cache.generating_code());
503
504   // free all of the pending fixup requests
505   label_fixup *fixup;
506   while ((fixup = m_fixup_list.detach_head()) != NULL)
507      m_cache.dealloc(fixup, sizeof(*fixup));
508   
500509   // make sure the label list is clear, and fatalerror if we missed anything
501510   reset(true);
502511}
r11363r11364
508517//  undefined
509518//-------------------------------------------------
510519
511drccodeptr drc_label_list::get_codeptr(uml::code_label label, fixup_func fixup, void *param)
520drccodeptr drc_label_list::get_codeptr(uml::code_label label, drc_label_fixup_delegate callback, void *param)
512521{
513522   label_entry *curlabel = find_or_allocate(label);
514523
515524   // if no code pointer, request an OOB callback
516   if (curlabel->m_codeptr == NULL && fixup != NULL)
517      m_cache.request_oob_codegen(oob_callback, curlabel, (void *)fixup, param);
525   if (curlabel->m_codeptr == NULL && !callback.isnull())
526   {
527      label_fixup *fixup = reinterpret_cast<label_fixup *>(m_cache.alloc(sizeof(*fixup)));
528      fixup->m_callback = callback;
529      fixup->m_label = curlabel;
530      m_fixup_list.append(*fixup);
531      m_cache.request_oob_codegen(m_oob_callback_delegate, fixup, param);
532   }
518533
519534   return curlabel->m_codeptr;
520535}
r11363r11364
584599//  for labels
585600//-------------------------------------------------
586601
587void drc_label_list::oob_callback(drccodeptr *codeptr, void *param1, void *param2, void *param3)
602void drc_label_list::oob_callback(drccodeptr *codeptr, void *param1, void *param2)
588603{
589   label_entry *label = (label_entry *)param1;
590   fixup_func callback = (fixup_func)param2;
591
592   (*callback)(param3, label->m_codeptr);
604   label_fixup *fixup = reinterpret_cast<label_fixup *>(param1);
605   fixup->m_callback(param2, fixup->m_label->m_codeptr);
593606}
src/emu/cpu/drcbeut.h
r11363r11364
144144
145145// ======================> drc_label_list
146146
147typedef delegate<void (void *, drccodeptr)> drc_label_fixup_delegate;
148
147149// structure holding a live list of labels
148class drc_label_list
150class drc_label_list : public bindable_object
149151{
150   // callback function for forward-referenced labels
151   typedef void (*fixup_func)(void *parameter, drccodeptr labelcodeptr);
152
153152public:
154153   // construction/destruction
155154   drc_label_list(drc_cache &cache);
r11363r11364
160159   void block_end(drcuml_block &block);
161160
162161   // get/set values
163   drccodeptr get_codeptr(uml::code_label label, fixup_func fixup, void *param);
162   drccodeptr get_codeptr(uml::code_label label, drc_label_fixup_delegate fixup, void *param);
164163   void set_codeptr(uml::code_label label, drccodeptr codeptr);
165164
166165private:
r11363r11364
171170      uml::code_label      m_label;      // the label specified
172171      drccodeptr         m_codeptr;      // pointer to the relevant code
173172   };
173   
174   struct label_fixup
175   {
176      label_fixup *next() const { return m_next; }
177      label_fixup *      m_next;         // pointer to the next oob
178      label_entry *      m_label;      // the label in question
179      drc_label_fixup_delegate m_callback; // callback
180   };
174181
175182   // internal helpers
176183   void reset(bool fatal_on_leftovers);
177184   label_entry *find_or_allocate(uml::code_label label);
178   static void oob_callback(drccodeptr *codeptr, void *param1, void *param2, void *param3);
185   void oob_callback(drccodeptr *codeptr, void *param1, void *param2);
179186
180187   // internal state
181188   drc_cache &         m_cache;         // pointer to the cache
182189   simple_list<label_entry> m_list;      // head of the live list
190   simple_list<label_fixup> m_fixup_list;   // list of pending oob fixups
191   drc_oob_delegate   m_oob_callback_delegate; // pre-computed delegate
183192};
184193
185194
src/emu/cpu/drcbex86.c
r11363r11364
556556     m_stacksave(0),
557557     m_hashstacksave(0),
558558     m_reslo(0),
559     m_reshi(0)
559     m_reshi(0),
560     m_fixup_label(FUNC(drcbe_x86::fixup_label), this),
561     m_fixup_exception(FUNC(drcbe_x86::fixup_exception), this)
560562{
561563   // compute hi pointers for each register
562564   for (int regnum = 0; regnum < ARRAY_LENGTH(int_register_map); regnum++)
r11363r11364
31563158   assert(labelp.is_code_label());
31573159
31583160   // look up the jump target and jump there
3159   x86code *jmptarget = (x86code *)m_labels.get_codeptr(labelp.label(), fixup_label, dst);
3161   x86code *jmptarget = (x86code *)m_labels.get_codeptr(labelp.label(), m_fixup_label, dst);
31603162   if (inst.condition() == uml::COND_ALWAYS)
31613163      emit_jmp(dst, jmptarget);                                          // jmp   target
31623164   else
r11363r11364
31973199   else
31983200   {
31993201      emit_jcc(dst, X86_CONDITION(inst.condition()), 0);                        // jcc   exception
3200      m_cache.request_oob_codegen(oob_func_stub<drcbe_x86, &drcbe_x86::fixup_exception>, dst, &const_cast<instruction &>(inst), this);
3202      m_cache.request_oob_codegen(m_fixup_exception, dst, &const_cast<instruction &>(inst));
32013203   }
32023204}
32033205
src/emu/cpu/drcbex86.h
r11363r11364
151151   bool can_skip_upper_load(x86code *&dst, UINT32 *memref, UINT8 reghi);
152152   void track_resolve_link(x86code *&destptr, const emit_link &linkinfo);
153153
154   static void fixup_label(void *parameter, drccodeptr labelcodeptr);
154   void fixup_label(void *parameter, drccodeptr labelcodeptr);
155155   void fixup_exception(drccodeptr *codeptr, void *param1, void *param2);
156156
157157   static void debug_log_hashjmp(int mode, offs_t pc);
r11363r11364
355355   void *               m_hashstacksave;      // saved stack pointer for hashjmp
356356   UINT64               m_reslo;            // extended low result
357357   UINT64               m_reshi;            // extended high result
358   
359   drc_label_fixup_delegate m_fixup_label;         // precomputed delegate for fixups
360   drc_oob_delegate      m_fixup_exception;      // precomputed delegate for exception fixups
358361
359362   // globals
360363   typedef void (drcbe_x86::*opcode_generate_func)(x86code *&dst, const uml::instruction &inst);
src/emu/tilemap.c
r11363r11364
305305   if (screen_width != 0 && screen_height != 0)
306306   {
307307      machine.priority_bitmap = auto_bitmap_alloc(machine, screen_width, screen_height, BITMAP_FORMAT_INDEXED8);
308      machine.add_notifier(MACHINE_NOTIFY_EXIT, tilemap_exit);
308      machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(tilemap_exit), &machine));
309309   }
310310}
311311
src/emu/uimenu.c
r11363r11364
413413   arrow_texture = machine.render().texture_alloc(menu_render_triangle);
414414
415415   /* add an exit callback to free memory */
416   machine.add_notifier(MACHINE_NOTIFY_EXIT, ui_menu_exit);
416   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ui_menu_exit), &machine));
417417}
418418
419419
src/emu/video.c
r11363r11364
135135     m_movie_frame(0)
136136{
137137   // request a callback upon exiting
138   machine.add_notifier(MACHINE_NOTIFY_EXIT, exit_static);
138   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(video_manager::exit), this));
139139   machine.save().register_postload(state_postload_stub<video_manager, &video_manager::postload>, this);
140140
141141   // extract initial execution state from global configuration settings
r11363r11364
180180   // if no screens, create a periodic timer to drive updates
181181   if (machine.primary_screen == NULL)
182182   {
183      m_screenless_frame_timer = machine.scheduler().timer_alloc(FUNC(screenless_update_callback), this);
183      m_screenless_frame_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(video_manager::screenless_update_callback), this));
184184      m_screenless_frame_timer->adjust(screen_device::DEFAULT_FRAME_PERIOD, 0, screen_device::DEFAULT_FRAME_PERIOD);
185185   }
186186}
r11363r11364
535535//  video_exit - close down the video system
536536//-------------------------------------------------
537537
538void video_manager::exit_static(running_machine &machine)
539{
540   machine.video().exit();
541}
542
543538void video_manager::exit()
544539{
545540   // stop recording any movie
r11363r11364
570565//  when there are no screens to drive it
571566//-------------------------------------------------
572567
573TIMER_CALLBACK( video_manager::screenless_update_callback )
568void video_manager::screenless_update_callback(void *ptr, int param)
574569{
575570   // force an update
576   reinterpret_cast<video_manager *>(ptr)->frame_update(false);
571   frame_update(false);
577572}
578573
579574
src/emu/video.h
r11363r11364
7070
7171// ======================> video_manager
7272
73class video_manager
73class video_manager : public bindable_object
7474{
7575   friend class screen_device;
7676
r11363r11364
118118
119119private:
120120   // internal helpers
121   static void exit_static(running_machine &machine);
122121   void exit();
123   static TIMER_CALLBACK( screenless_update_callback );
122   void screenless_update_callback(void *ptr, int param);
124123   void postload();
125124
126125   // effective value helpers
src/emu/inptport.c
r11363r11364
984984   //portdata = machine.input_port_data;
985985
986986   /* add an exit callback and a frame callback */
987   machine.add_notifier(MACHINE_NOTIFY_EXIT, input_port_exit);
988   machine.add_notifier(MACHINE_NOTIFY_FRAME, frame_update_callback);
987   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(input_port_exit), &machine));
988   machine.add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(FUNC(frame_update_callback), &machine));
989989
990990   /* initialize the default port info from the OSD */
991991   init_port_types(machine);
r11363r11364
10101010
10111011   init_port_state(machine);
10121012   /* register callbacks for when we load configurations */
1013   config_register(machine, "input", load_config_callback, save_config_callback);
1013   config_register(machine, "input", config_saveload_delegate(FUNC(load_config_callback), &machine), config_saveload_delegate(FUNC(save_config_callback), &machine));
10141014
10151015   /* open playback and record files if specified */
10161016   basetime = playback_init(machine);
r11363r11364
50515051   input_port_private *portdata = machine.input_port_data;
50525052   portdata->inputx_timer = machine.scheduler().timer_alloc(FUNC(inputx_timerproc));
50535053   portdata->keybuffer = auto_alloc_clear(machine, key_buffer);
5054   machine.add_notifier(MACHINE_NOTIFY_EXIT, clear_keybuffer);
5054   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(clear_keybuffer), &machine));
50555055}
50565056
50575057
src/emu/devintrf.c
r11363r11364
124124void device_list::start_all()
125125{
126126   // add exit and reset callbacks
127   machine().add_notifier(MACHINE_NOTIFY_RESET, static_reset);
128   machine().add_notifier(MACHINE_NOTIFY_EXIT, static_exit);
127   machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(device_list::reset_all), this));
128   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(device_list::exit), this));
129129
130130   // add pre-save and post-load callbacks
131131   machine().save().register_presave(static_pre_save, this);
r11363r11364
178178//  reset_all - reset all devices in the list
179179//-------------------------------------------------
180180
181void device_list::reset_all() const
181void device_list::reset_all()
182182{
183183   // iterate over devices and reset them
184184   for (device_t *device = first(); device != NULL; device = device->next())
r11363r11364
267267
268268
269269//-------------------------------------------------
270//  static_reset - internal callback for resetting
271//  all devices
272//-------------------------------------------------
273
274void device_list::static_reset(running_machine &machine)
275{
276   machine.devicelist().reset_all();
277}
278
279
280//-------------------------------------------------
281270//  static_exit - tear down all the devices
282271//-------------------------------------------------
283272
284void device_list::static_exit(running_machine &machine)
273void device_list::exit()
285274{
286275   // first let the debugger save comments
287   if ((machine.debug_flags & DEBUG_FLAG_ENABLED) != 0)
288      debug_comment_save(machine);
276   if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
277      debug_comment_save(machine());
289278
290279   // stop all the devices before we go away
291   const_cast<device_list &>(machine.devicelist()).stop_all();
280   stop_all();
292281
293282   // then nuke the devices
294   const_cast<device_list &>(machine.devicelist()).reset();
283   reset();
295284}
296285
297286
src/emu/devintrf.h
r11363r11364
126126// ======================> tagged_device_list
127127
128128// tagged_device_list is a tagged_list with additional searching based on type
129class device_list : public tagged_list<device_t>
129class device_list : public tagged_list<device_t>, public bindable_object
130130{
131131   typedef tagged_list<device_t> super;
132132
r11363r11364
141141   void set_machine_all(running_machine &machine);
142142   void start_all();
143143   void start_new_devices();
144   void reset_all() const;
144   void reset_all();
145145   void stop_all();
146146
147147   // pull the generic forms forward
r11363r11364
163163   
164164private:
165165   // internal helpers
166   static void static_reset(running_machine &machine);
167   static void static_exit(running_machine &machine);
166   void exit();
168167   static void static_pre_save(running_machine &machine, void *param);
169168   static void static_post_load(running_machine &machine, void *param);
170169
r11363r11364
177176// ======================> device_t
178177
179178// device_t represents a device
180class device_t : public bindable_object
179class device_t : public virtual bindable_object
181180{
182181   DISABLE_COPYING(device_t);
183182
r11363r11364
460459// ======================> device_interface
461460
462461// device_interface represents runtime information for a particular device interface
463class device_interface
462class device_interface : public virtual bindable_object
464463{
465464   DISABLE_COPYING(device_interface);
466465
src/emu/output.c
r11363r11364
147147void output_init(running_machine &machine)
148148{
149149   /* add pause callback */
150   machine.add_notifier(MACHINE_NOTIFY_PAUSE, output_pause);
151   machine.add_notifier(MACHINE_NOTIFY_RESUME, output_resume);
150   machine.add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(FUNC(output_pause), &machine));
151   machine.add_notifier(MACHINE_NOTIFY_RESUME, machine_notify_delegate(FUNC(output_resume), &machine));
152152
153153   /* get a callback when done */
154   machine.add_notifier(MACHINE_NOTIFY_EXIT, output_exit);
154   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(output_exit), &machine));
155155
156156   /* reset the lists */
157157   memset(itemtable, 0, sizeof(itemtable));
src/emu/machine.c
r11363r11364
264264   generic_sound_init(*this);
265265
266266   // allocate a soft_reset timer
267   m_soft_reset_timer = m_scheduler.timer_alloc(MSTUB(timer_expired, running_machine, soft_reset), this);
267   m_soft_reset_timer = m_scheduler.timer_alloc(timer_expired_delegate(FUNC(running_machine::soft_reset), this));
268268
269269   // init the osd layer
270270   m_osd.init(*this);
r11363r11364
403403      ui_display_startup_screens(*this, firstrun, !settingsloaded);
404404
405405      // perform a soft reset -- this takes us to the running phase
406      soft_reset(*this);
406      soft_reset();
407407
408408      // run the CPUs until a reset or exit
409409      m_hard_reset_pending = false;
r11363r11364
656656//  given type
657657//-------------------------------------------------
658658
659void running_machine::add_notifier(machine_notification event, notify_callback callback)
659void running_machine::add_notifier(machine_notification event, machine_notify_delegate callback)
660660{
661661   assert_always(m_current_phase == MACHINE_PHASE_INIT, "Can only call add_notifier at init time!");
662662
r11363r11364
767767void running_machine::call_notifiers(machine_notification which)
768768{
769769   for (notifier_callback_item *cb = m_notifier_list[which].first(); cb != NULL; cb = cb->next())
770      (*cb->m_func)(*this);
770      cb->m_func();
771771}
772772
773773
r11363r11364
859859//  of the system
860860//-------------------------------------------------
861861
862void running_machine::soft_reset(running_machine &machine, int param)
862void running_machine::soft_reset(void *ptr, INT32 param)
863863{
864864   logerror("Soft reset\n");
865865
r11363r11364
927927//  notifier_callback_item - constructor
928928//-------------------------------------------------
929929
930running_machine::notifier_callback_item::notifier_callback_item(notify_callback func)
930running_machine::notifier_callback_item::notifier_callback_item(machine_notify_delegate func)
931931   : m_next(NULL),
932932     m_func(func)
933933{
src/emu/machine.h
r11363r11364
306306
307307// ======================> running_machine
308308
309typedef delegate<void ()> machine_notify_delegate;
310
309311// description of the currently-running machine
310312class running_machine : public bindable_object
311313{
r11363r11364
314316   friend void debugger_init(running_machine &machine);
315317   friend class sound_manager;
316318
317   typedef void (*notify_callback)(running_machine &machine);
318319   typedef void (*logerror_callback)(running_machine &machine, const char *string);
319320
320321   // must be at top of member variables
r11363r11364
371372   int run(bool firstrun);
372373   void pause();
373374   void resume();
374   void add_notifier(machine_notification event, notify_callback callback);
375   void add_notifier(machine_notification event, machine_notify_delegate callback);
375376   void call_notifiers(machine_notification which);
376377   void add_logerror_callback(logerror_callback callback);
377378   void set_ui_active(bool active) { m_ui_active = active; }
r11363r11364
440441   void set_saveload_filename(const char *filename);
441442   void fill_systime(system_time &systime, time_t t);
442443   void handle_saveload();
443   void soft_reset(running_machine &machine, int param = 0);
444   void soft_reset(void *ptr = NULL, INT32 param = 0);
444445
445446   // internal callbacks
446447   static void logfile_callback(running_machine &machine, const char *buffer);
r11363r11364
499500   struct notifier_callback_item
500501   {
501502      // construction/destruction
502      notifier_callback_item(notify_callback func);
503      notifier_callback_item(machine_notify_delegate func);
503504
504505      // getters
505506      notifier_callback_item *next() const { return m_next; }
506507
507508      // state
508509      notifier_callback_item *   m_next;
509      notify_callback            m_func;
510      machine_notify_delegate      m_func;
510511   };
511512   simple_list<notifier_callback_item> m_notifier_list[MACHINE_NOTIFY_COUNT];
512513
src/emu/ui.c
r11363r11364
237237int ui_init(running_machine &machine)
238238{
239239   /* make sure we clean up after ourselves */
240   machine.add_notifier(MACHINE_NOTIFY_EXIT, ui_exit);
240   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ui_exit), &machine));
241241
242242   /* initialize the other UI bits */
243243   ui_menu_init(machine);
src/emu/crsshair.c
r11363r11364
135135static void crosshair_load(running_machine &machine, int config_type, xml_data_node *parentnode);
136136static void crosshair_save(running_machine &machine, int config_type, xml_data_node *parentnode);
137137
138static void animate(screen_device &device, void *param, bool vblank_state);
138static void animate(running_machine &machine, screen_device &device, bool vblank_state);
139139
140140
141141/***************************************************************************
r11363r11364
211211void crosshair_init(running_machine &machine)
212212{
213213   /* request a callback upon exiting */
214   machine.add_notifier(MACHINE_NOTIFY_EXIT, crosshair_exit);
214   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(crosshair_exit), &machine));
215215
216216   /* clear all the globals */
217217   memset(&global, 0, sizeof(global));
r11363r11364
242242
243243   /* register callbacks for when we load/save configurations */
244244   if (global.usage)
245      config_register(machine, "crosshairs", crosshair_load, crosshair_save);
245      config_register(machine, "crosshairs", config_saveload_delegate(FUNC(crosshair_load), &machine), config_saveload_delegate(FUNC(crosshair_save), &machine));
246246
247247   /* register the animation callback */
248248   if (machine.primary_screen != NULL)
249      machine.primary_screen->register_vblank_callback(animate, NULL);
249      machine.primary_screen->register_vblank_callback(vblank_state_delegate(FUNC(animate), &machine));
250250}
251251
252252
r11363r11364
325325    animate - animates the crosshair once a frame
326326-------------------------------------------------*/
327327
328static void animate(screen_device &device, void *param, bool vblank_state)
328static void animate(running_machine &machine, screen_device &device, bool vblank_state)
329329{
330330   int player;
331331
src/emu/render.c
r11363r11364
24652465     m_screen_container_list(machine.respool())
24662466{
24672467   // register callbacks
2468   config_register(machine, "video", config_load_static, config_save_static);
2468   config_register(machine, "video", config_saveload_delegate(FUNC(render_manager::config_load), this), config_saveload_delegate(FUNC(render_manager::config_save), this));
24692469
24702470   // create one container per screen
24712471   for (screen_device *screen = machine.first_screen(); screen != NULL; screen = screen->next_screen())
r11363r11364
26842684//  configuration file
26852685//-------------------------------------------------
26862686
2687void render_manager::config_load_static(running_machine &machine, int config_type, xml_data_node *parentnode)
2688{
2689   machine.render().config_load(config_type, parentnode);
2690}
2691
26922687void render_manager::config_load(int config_type, xml_data_node *parentnode)
26932688{
26942689   // we only care about game files
r11363r11364
27482743//  file
27492744//-------------------------------------------------
27502745
2751void render_manager::config_save_static(running_machine &machine, int config_type, xml_data_node *parentnode)
2752{
2753   machine.render().config_save(config_type, parentnode);
2754}
2755
27562746void render_manager::config_save(int config_type, xml_data_node *parentnode)
27572747{
27582748   // we only care about game files
src/emu/emupal.c
r11363r11364
111111
112112   /* request cleanup */
113113   machine.palette_data = palette;
114   machine.add_notifier(MACHINE_NOTIFY_EXIT, palette_exit);
114   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(palette_exit), &machine));
115115
116116   /* reset all our data */
117117   palette->format = format;
src/emu/render.h
r11363r11364
714714// ======================> render_manager
715715
716716// contains machine-global information and operations
717class render_manager
717class render_manager : public bindable_object
718718{
719719   friend class render_target;
720720
r11363r11364
761761   void container_free(render_container *container);
762762
763763   // config callbacks
764   static void config_load_static(running_machine &machine, int config_type, xml_data_node *parentnode);
765   static void config_save_static(running_machine &machine, int config_type, xml_data_node *parentnode);
766764   void config_load(int config_type, xml_data_node *parentnode);
767765   void config_save(int config_type, xml_data_node *parentnode);
768766
src/emu/cheat.c
r11363r11364
10971097      return;
10981098
10991099   // request a callback
1100   machine.add_notifier(MACHINE_NOTIFY_FRAME, frame_update_static);
1100   machine.add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(FUNC(cheat_manager::frame_update), this));
11011101
11021102   // create a global symbol table
11031103   m_symtable.add("frame", symbol_table::READ_ONLY, &m_framecount);
r11363r11364
13801380//  frame_update - per-frame callback
13811381//-------------------------------------------------
13821382
1383void cheat_manager::frame_update_static(running_machine &machine)
1384{
1385   machine.cheat().frame_update();
1386}
1387
13881383void cheat_manager::frame_update()
13891384{
13901385   // set up for accumulating output
src/emu/cheat.h
r11363r11364
314314// ======================> cheat_manager
315315
316316// private machine-global data
317class cheat_manager
317class cheat_manager : public bindable_object
318318{
319319public:
320320   // construction/destruction
r11363r11364
343343
344344private:
345345   // internal helpers
346   static void frame_update_static(running_machine &machine);
347346   void frame_update();
348347   void load_cheats(const char *filename);
349348
src/emu/schedule.c
r11363r11364
7878   : m_machine(NULL),
7979     m_next(NULL),
8080     m_prev(NULL),
81     m_callback(NULL),
8281     m_param(0),
8382     m_ptr(NULL),
84     m_func(NULL),
8583     m_enabled(false),
8684     m_temporary(false),
8785     m_period(attotime::zero),
r11363r11364
107105//  re-allocated as a non-device timer
108106//-------------------------------------------------
109107
110emu_timer &emu_timer::init(running_machine &machine, timer_expired_func callback, const char *name, void *ptr, bool temporary)
108emu_timer &emu_timer::init(running_machine &machine, timer_expired_delegate callback, void *ptr, bool temporary)
111109{
112110   // ensure the entire timer state is clean
113111   m_machine = &machine;
r11363r11364
116114   m_callback = callback;
117115   m_param = 0;
118116   m_ptr = ptr;
119   m_func = (name != NULL) ? name : "?";
120117   m_enabled = false;
121118   m_temporary = temporary;
122119   m_period = attotime::never;
r11363r11364
146143   m_machine = &device.machine();
147144   m_next = NULL;
148145   m_prev = NULL;
149   m_callback = NULL;
146   m_callback = timer_expired_delegate();
150147   m_param = 0;
151148   m_ptr = ptr;
152   m_func = NULL;
153149   m_enabled = false;
154150   m_temporary = temporary;
155151   m_period = attotime::never;
r11363r11364
274270   // for non-device timers, it is an index based on the callback function name
275271   if (m_device == NULL)
276272   {
277      name = m_func;
273      name = m_callback.name();
278274      for (emu_timer *curtimer = machine().scheduler().first_timer(); curtimer != NULL; curtimer = curtimer->next())
279         if (!curtimer->m_temporary && curtimer->m_device == NULL && strcmp(curtimer->m_func, m_func) == 0)
275         if (!curtimer->m_temporary && curtimer->m_device == NULL && strcmp(curtimer->m_callback.name(), m_callback.name()) == 0)
280276            index++;
281277   }
282278
r11363r11364
340336   m_quantum_minimum(ATTOSECONDS_IN_NSEC(1) / 1000)
341337{
342338   // append a single never-expiring timer so there is always one in the list
343   m_timer_list = &m_timer_allocator.alloc()->init(machine, NULL, NULL, NULL, true);
339   m_timer_list = &m_timer_allocator.alloc()->init(machine, timer_expired_delegate(), NULL, true);
344340   m_timer_list->adjust(attotime::never);
345341
346342   // register global states
r11363r11364
532528
533529   // if we have a non-zero time, schedule a timer
534530   if (after != attotime::zero)
535      timer_set(after, MSTUB(timer_expired, device_scheduler, timed_trigger), trigid, this);
531      timer_set(after, timer_expired_delegate(FUNC(device_scheduler::timed_trigger), this), trigid);
536532
537533   // send the trigger to everyone who cares
538534   else
r11363r11364
560556//  timer and return a pointer
561557//-------------------------------------------------
562558
563emu_timer *device_scheduler::timer_alloc(timer_expired_func callback, const char *name, void *ptr)
559emu_timer *device_scheduler::timer_alloc(timer_expired_delegate callback, void *ptr)
564560{
565   return &m_timer_allocator.alloc()->init(machine(), callback, name, ptr, false);
561   return &m_timer_allocator.alloc()->init(machine(), callback, ptr, false);
566562}
567563
568564
r11363r11364
572568//  amount of time
573569//-------------------------------------------------
574570
575void device_scheduler::timer_set(attotime duration, timer_expired_func callback, const char *name, int param, void *ptr)
571void device_scheduler::timer_set(attotime duration, timer_expired_delegate callback, int param, void *ptr)
576572{
577   m_timer_allocator.alloc()->init(machine(), callback, name, ptr, true).adjust(duration, param);
573   m_timer_allocator.alloc()->init(machine(), callback, ptr, true).adjust(duration, param);
578574}
579575
580576
r11363r11364
584580//  frequency
585581//-------------------------------------------------
586582
587void device_scheduler::timer_pulse(attotime period, timer_expired_func callback, const char *name, int param, void *ptr)
583void device_scheduler::timer_pulse(attotime period, timer_expired_delegate callback, int param, void *ptr)
588584{
589   m_timer_allocator.alloc()->init(machine(), callback, name, ptr, false).adjust(period, param, period);
585   m_timer_allocator.alloc()->init(machine(), callback, ptr, false).adjust(period, param, period);
590586}
591587
592588
r11363r11364
630626//  given amount of time
631627//-------------------------------------------------
632628
633void device_scheduler::timed_trigger(running_machine &machine, INT32 param)
629void device_scheduler::timed_trigger(void *ptr, INT32 param)
634630{
635631   trigger(param);
636632}
r11363r11364
874870
875871         if (timer.m_device != NULL)
876872            timer.m_device->timer_expired(timer, timer.m_id, timer.m_param, timer.m_ptr);
877         else if (timer.m_callback != NULL)
878            (*timer.m_callback)(machine(), timer.m_ptr, timer.m_param);
873         else if (!timer.m_callback.isnull())
874            timer.m_callback(timer.m_ptr, timer.m_param);
879875
880876         g_profiler.stop();
881877      }
src/emu/romload.c
r11363r11364
15131513   machine.romload_data = romdata = auto_alloc_clear(machine, romload_private);
15141514
15151515   /* make sure we get called back on the way out */
1516   machine.add_notifier(MACHINE_NOTIFY_EXIT, rom_exit);
1516   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(rom_exit), &machine));
15171517
15181518   /* reset the romdata struct */
15191519   romdata->m_machine = &machine;
src/emu/schedule.h
r11363r11364
7171//**************************************************************************
7272
7373// timer callbacks look like this
74typedef delegate<void (void *, INT32)> timer_expired_delegate;
75
76// old-skool callbacks are like this
7477typedef void (*timer_expired_func)(running_machine &machine, void *ptr, INT32 param);
7578
7679// stub for when the ptr parameter points to a class
r11363r11364
9699   ~emu_timer();
97100
98101   // allocation and re-use
99   emu_timer &init(running_machine &machine, timer_expired_func callback, const char *name, void *ptr, bool temporary);
102   emu_timer &init(running_machine &machine, timer_expired_delegate callback, void *ptr, bool temporary);
100103   emu_timer &init(device_t &device, device_timer_id id, void *ptr, bool temporary);
101104   emu_timer &release();
102105
r11363r11364
132135   running_machine *   m_machine;      // reference to the owning machine
133136   emu_timer *         m_next;         // next timer in order in the list
134137   emu_timer *         m_prev;         // previous timer in order in the list
135   timer_expired_func   m_callback;      // callback function
138   timer_expired_delegate m_callback;   // callback function
136139   INT32            m_param;      // integer parameter
137140   void *            m_ptr;         // pointer parameter
138   const char *      m_func;         // string name of the callback function
139141   bool            m_enabled;      // is the timer enabled?
140142   bool            m_temporary;   // is the timer temporary?
141143   attotime         m_period;      // the repeat frequency of the timer
r11363r11364
148150
149151// ======================> device_scheduler
150152
151class device_scheduler
153class device_scheduler : public bindable_object
152154{
153155   friend class device_execute_interface;
154156   friend class emu_timer;
r11363r11364
172174   void boost_interleave(attotime timeslice_time, attotime boost_duration);
173175
174176   // timers, specified by callback/name
175   emu_timer *timer_alloc(timer_expired_func callback, const char *name, void *ptr = NULL);
176   void timer_set(attotime duration, timer_expired_func callback, const char *name, int param = 0, void *ptr = NULL);
177   void timer_pulse(attotime period, timer_expired_func callback, const char *name, int param = 0, void *ptr = NULL);
178   void synchronize(timer_expired_func callback = NULL, const char *name = NULL, int param = 0, void *ptr = NULL) { timer_set(attotime::zero, callback, name, param, ptr); }
177   emu_timer *timer_alloc(timer_expired_delegate callback, void *ptr = NULL);
178   void timer_set(attotime duration, timer_expired_delegate callback, int param = 0, void *ptr = NULL);
179   void timer_pulse(attotime period, timer_expired_delegate callback, int param = 0, void *ptr = NULL);
180   void synchronize(timer_expired_delegate callback = timer_expired_delegate(), int param = 0, void *ptr = NULL) { timer_set(attotime::zero, callback, param, ptr); }
179181
182   // timers with old-skool callbacks
183   emu_timer *timer_alloc(timer_expired_func callback, const char *name, void *ptr = NULL) { return timer_alloc(timer_expired_delegate(callback, name, &machine()), ptr); }
184   void timer_set(attotime duration, timer_expired_func callback, const char *name, int param = 0, void *ptr = NULL) { timer_set(duration, timer_expired_delegate(callback, name, &machine()), param, ptr); }
185   void timer_pulse(attotime period, timer_expired_func callback, const char *name, int param = 0, void *ptr = NULL) { timer_pulse(period, timer_expired_delegate(callback, name, &machine()), param, ptr); }
186   void synchronize(timer_expired_func callback, const char *name = NULL, int param = 0, void *ptr = NULL) { timer_set(attotime::zero, callback, name, param, ptr); }
187
180188   // timers, specified by device/id; generally devices should use the device_t methods instead
181189   emu_timer *timer_alloc(device_t &device, device_timer_id id = 0, void *ptr = NULL);
182190   void timer_set(attotime duration, device_t &device, device_timer_id id = 0, int param = 0, void *ptr = NULL);
r11363r11364
186194
187195private:
188196   // callbacks
189   void timed_trigger(running_machine &machine, INT32 param);
197   void timed_trigger(void *ptr, INT32 param);
190198   void postload();
191199
192200   // scheduling helpers
src/emu/config.c
r11363r11364
2828{
2929   struct _config_type *   next;            /* next in line */
3030   const char *         name;            /* node name */
31   config_callback_func   load;            /* load callback */
32   config_callback_func   save;            /* save callback */
31   config_saveload_delegate load;            /* load callback */
32   config_saveload_delegate save;            /* save callback */
3333};
3434
3535
r11363r11364
7575 *
7676 *************************************/
7777
78void config_register(running_machine &machine, const char *nodename, config_callback_func load, config_callback_func save)
78void config_register(running_machine &machine, const char *nodename, config_saveload_delegate load, config_saveload_delegate save)
7979{
8080   config_type *newtype;
8181   config_type **ptype;
r11363r11364
108108
109109   /* loop over all registrants and call their init function */
110110   for (type = typelist; type; type = type->next)
111      (*type->load)(machine, CONFIG_TYPE_INIT, NULL);
111      type->load(CONFIG_TYPE_INIT, NULL);
112112
113113   /* now load the controller file */
114114   if (controller[0] != 0)
r11363r11364
138138
139139   /* loop over all registrants and call their final function */
140140   for (type = typelist; type; type = type->next)
141      (*type->load)(machine, CONFIG_TYPE_FINAL, NULL);
141      type->load(CONFIG_TYPE_FINAL, NULL);
142142
143143   /* if we didn't find a saved config, return 0 so the main core knows that it */
144144   /* is the first time the game is run and it should diplay the disclaimer. */
r11363r11364
152152
153153   /* loop over all registrants and call their init function */
154154   for (type = typelist; type; type = type->next)
155      (*type->save)(machine, CONFIG_TYPE_INIT, NULL);
155      type->save(CONFIG_TYPE_INIT, NULL);
156156
157157   /* save the defaults file */
158158   emu_file file(machine.options().cfg_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
r11363r11364
167167
168168   /* loop over all registrants and call their final function */
169169   for (type = typelist; type; type = type->next)
170      (*type->save)(machine, CONFIG_TYPE_FINAL, NULL);
170      type->save(CONFIG_TYPE_FINAL, NULL);
171171}
172172
173173
r11363r11364
253253
254254      /* loop over all registrants and call their load function */
255255      for (type = typelist; type; type = type->next)
256         (*type->load)(machine, which_type, xml_get_sibling(systemnode->child, type->name));
256         type->load(which_type, xml_get_sibling(systemnode->child, type->name));
257257      count++;
258258   }
259259
r11363r11364
308308      xml_data_node *curnode = xml_add_child(systemnode, type->name, NULL);
309309      if (!curnode)
310310         goto error;
311      (*type->save)(machine, which_type, curnode);
311      type->save(which_type, curnode);
312312
313313      /* if nothing was added, just nuke the node */
314314      if (!curnode->value && !curnode->child)
src/emu/config.h
r11363r11364
4343 *
4444 *************************************/
4545
46typedef void (*config_callback_func)(running_machine &machine, int config_type, xml_data_node *parentnode);
46typedef delegate<void (int, xml_data_node *)> config_saveload_delegate;
4747
4848
4949
r11363r11364
5454 *************************************/
5555
5656void config_init(running_machine &machine);
57void config_register(running_machine &machine, const char *nodename, config_callback_func load, config_callback_func save);
57void config_register(running_machine &machine, const char *nodename, config_saveload_delegate load, config_saveload_delegate save);
5858int config_load_settings(running_machine &machine);
5959void config_save_settings(running_machine &machine);
6060
src/emu/uigfx.c
r11363r11364
109109   int gfx;
110110
111111   /* make sure we clean up after ourselves */
112   machine.add_notifier(MACHINE_NOTIFY_EXIT, ui_gfx_exit);
112   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ui_gfx_exit), &machine));
113113
114114   /* initialize our global state */
115115   memset(state, 0, sizeof(*state));
src/emu/image.c
r11363r11364
278278   }
279279
280280   /* add a callback for when we shut down */
281   machine.add_notifier(MACHINE_NOTIFY_EXIT, image_unload_all);
281   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(image_unload_all), &machine));
282282}
283283/***************************************************************************
284284    INITIALIZATION
r11363r11364
291291void image_init(running_machine &machine)
292292{
293293   image_device_init(machine);
294   config_register(machine, "image_directories", image_dirs_load, image_dirs_save);
294   config_register(machine, "image_directories", config_saveload_delegate(FUNC(image_dirs_load), &machine), config_saveload_delegate(FUNC(image_dirs_save), &machine));
295295}
296296
297297
src/emu/uiinput.c
r11363r11364
8080   machine.ui_input_data->current_mouse_y = -1;
8181
8282   /* add a frame callback to poll inputs */
83   machine.add_notifier(MACHINE_NOTIFY_FRAME, ui_input_frame_update);
83   machine.add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(FUNC(ui_input_frame_update), &machine));
8484}
8585
8686
src/emu/watchdog.c
r11363r11364
4141   /* allocate a timer for the watchdog */
4242   watchdog_timer = machine.scheduler().timer_alloc(FUNC(watchdog_callback));
4343
44   machine.add_notifier(MACHINE_NOTIFY_RESET, watchdog_internal_reset);
44   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(watchdog_internal_reset), &machine));
4545
4646   /* save some stuff in the default tag */
4747   machine.save().save_item(NAME(watchdog_enabled));
r11363r11364
8484    timers
8585-------------------------------------------------*/
8686
87static void on_vblank(screen_device &screen, void *param, bool vblank_state)
87static void on_vblank(running_machine &machine, screen_device &screen, bool vblank_state)
8888{
8989   /* VBLANK starting */
9090   if (vblank_state && watchdog_enabled)
r11363r11364
118118
119119      /* register a VBLANK callback for the primary screen */
120120      if (machine.primary_screen != NULL)
121         machine.primary_screen->register_vblank_callback(on_vblank, NULL);
121         machine.primary_screen->register_vblank_callback(vblank_state_delegate(FUNC(on_vblank), &machine));
122122   }
123123
124124   /* timer-based watchdog? */
src/emu/machine/generic.c
r11363r11364
108108   state->memcard_inserted = -1;
109109
110110   /* register a reset callback and save state for interrupt enable */
111   machine.add_notifier(MACHINE_NOTIFY_RESET, interrupt_reset);
111   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(interrupt_reset), &machine));
112112   machine.save().save_item(NAME(state->interrupt_enable));
113113
114114   /* register for configuration */
115   config_register(machine, "counters", counters_load, counters_save);
115   config_register(machine, "counters", config_saveload_delegate(FUNC(counters_load), &machine), config_saveload_delegate(FUNC(counters_save), &machine));
116116
117117   /* for memory cards, request save state and an exit callback */
118118   if (machine.config().m_memcard_handler != NULL)
119119   {
120120      state_save_register_global(machine, state->memcard_inserted);
121      machine.add_notifier(MACHINE_NOTIFY_EXIT, memcard_eject);
121      machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(memcard_eject), &machine));
122122   }
123123}
124124
src/emu/machine/ldcore.c
r11363r11364
287287    change of the VBLANK signal
288288-------------------------------------------------*/
289289
290static void vblank_state_changed(screen_device &screen, void *param, bool vblank_state)
290static void vblank_state_changed(device_t *device, screen_device &screen, bool vblank_state)
291291{
292   device_t *device = (device_t *)param;
293292   laserdisc_state *ld = get_safe_token(device);
294293   ldcore_data *ldcore = ld->core;
295294   attotime curtime = screen.machine().time();
r11363r11364
13931392   int index;
13941393
13951394   /* register for VBLANK callbacks */
1396   ld->screen->register_vblank_callback(vblank_state_changed, (void *)device);
1395   ld->screen->register_vblank_callback(vblank_state_delegate(FUNC(vblank_state_changed), device));
13971396
13981397   /* allocate video frames */
13991398   for (index = 0; index < ARRAY_LENGTH(ldcore->frame); index++)
r11363r11364
15171516   init_audio(device);
15181517
15191518   /* register callbacks */
1520   config_register(device->machine(), "laserdisc", configuration_load, configuration_save);
1519   config_register(device->machine(), "laserdisc", config_saveload_delegate(FUNC(configuration_load), &device->machine()), config_saveload_delegate(FUNC(configuration_save), &device->machine()));
15211520}
15221521
15231522
src/emu/diexec.c
r11363r11364
607607         screen = device().machine().first_screen();
608608
609609      assert(screen != NULL);
610      screen->register_vblank_callback(static_on_vblank, NULL);
610      screen->register_vblank_callback(vblank_state_delegate(FUNC(device_execute_interface::on_vblank), this));
611611   }
612612
613613   // reconfigure periodic interrupts
r11363r11364
707707//  for this screen
708708//-------------------------------------------------
709709
710void device_execute_interface::static_on_vblank(screen_device &screen, void *param, bool vblank_state)
710void device_execute_interface::on_vblank(screen_device &screen, bool vblank_state)
711711{
712   // VBLANK starting
713   if (vblank_state)
714   {
715      device_execute_interface *exec = NULL;
716      for (bool gotone = screen.machine().devicelist().first(exec); gotone; gotone = exec->next(exec))
717         exec->on_vblank_start(screen);
718   }
719}
712   // ignore VBLANK end
713   if (!vblank_state)
714      return;
720715
721void device_execute_interface::on_vblank_start(screen_device &screen)
722{
723716   // start the interrupt counter
724717   if (!suspended(SUSPEND_REASON_DISABLE))
725718      m_iloops = 0;
726719   else
727720      m_iloops = -1;
728721
729   // the hack style VBLANK decleration always uses the first screen
730   bool interested = false;
731   if (m_vblank_interrupts_per_frame > 1)
732      interested = true;
722   // generate the interrupt callback
723   if (!suspended(SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE))
724      (*m_vblank_interrupt)(&m_device);
733725
734   // for new style declaration, we need to compare the tags
735   else if (m_vblank_interrupt_screen != NULL)
736      interested = (strcmp(screen.tag(), m_vblank_interrupt_screen) == 0);
737
738   // if interested, call the interrupt handler
739   if (interested)
726   // if we have more than one interrupt per frame, start the timer now to trigger the rest of them
727   if (m_vblank_interrupts_per_frame > 1 && !suspended(SUSPEND_REASON_DISABLE))
740728   {
741      if (!suspended(SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE))
742         (*m_vblank_interrupt)(&m_device);
743
744      // if we have more than one interrupt per frame, start the timer now to trigger the rest of them
745      if (m_vblank_interrupts_per_frame > 1 && !suspended(SUSPEND_REASON_DISABLE))
746      {
747         m_partial_frame_period = device().machine().primary_screen->frame_period() / m_vblank_interrupts_per_frame;
748         m_partial_frame_timer->adjust(m_partial_frame_period);
749      }
729      m_partial_frame_period = device().machine().primary_screen->frame_period() / m_vblank_interrupts_per_frame;
730      m_partial_frame_timer->adjust(m_partial_frame_period);
750731   }
751732}
752733
src/emu/emucore.h
r11363r11364
205205#define FUNC(x) &x, #x
206206#define FUNC_NULL NULL, "(null)"
207207
208// this macro wraps a member function 'x' from class 'c'
209#define MFUNC(c,x) &c::x, #c "::" #x
210208
211// this macro wraps a member function 'x' from class 'c' using a templatized stub of type 's'
212#define MSTUB(s,c,x) s##_stub<c, &c::x>, #c "::" #x
213
214
215209// standard assertion macros
216210#undef assert
217211#undef assert_always
src/emu/diexec.h
r11363r11364
306306   // callbacks
307307   static void static_timed_trigger_callback(running_machine &machine, void *ptr, int param);
308308
309   static void static_on_vblank(screen_device &screen, void *param, bool vblank_state);
310   void on_vblank_start(screen_device &screen);
309   void on_vblank(screen_device &screen, bool vblank_state);
311310
312311   static void static_trigger_partial_frame_interrupt(running_machine &machine, void *ptr, int param);
313312   void trigger_partial_frame_interrupt();
src/emu/screen.c
r11363r11364
106106     m_scanline0_timer(NULL),
107107     m_scanline_timer(NULL),
108108     m_frame_number(0),
109     m_partial_updates_this_frame(0),
110     m_callback_list(NULL)
109     m_partial_updates_this_frame(0)
111110{
112111   m_visarea.min_x = m_visarea.min_y = 0;
113112   m_visarea.max_x = m_width - 1;
r11363r11364
756755//  callback
757756//-------------------------------------------------
758757
759void screen_device::register_vblank_callback(vblank_state_changed_func vblank_callback, void *param)
758void screen_device::register_vblank_callback(vblank_state_delegate vblank_callback)
760759{
761760   // validate arguments
762   assert(vblank_callback != NULL);
761   assert(!vblank_callback.isnull());
763762
764763   // check if we already have this callback registered
765   callback_item **itemptr;
766   for (itemptr = &m_callback_list; *itemptr != NULL; itemptr = &(*itemptr)->m_next)
767      if ((*itemptr)->m_callback == vblank_callback)
764   callback_item *item;
765   for (item = m_callback_list.first(); item != NULL; item = item->next())
766      if (item->m_callback == vblank_callback)
768767         break;
769768
770769   // if not found, register
771   if (*itemptr == NULL)
772   {
773      *itemptr = auto_alloc(machine(), callback_item);
774      (*itemptr)->m_next = NULL;
775      (*itemptr)->m_callback = vblank_callback;
776      (*itemptr)->m_param = param;
777   }
770   if (item == NULL)
771      m_callback_list.append(*global_alloc(callback_item(vblank_callback)));
778772}
779773
780774
r11363r11364
790784   m_vblank_end_time = m_vblank_start_time + attotime(0, m_vblank_period);
791785
792786   // call the screen specific callbacks
793   for (callback_item *item = m_callback_list; item != NULL; item = item->m_next)
794      (*item->m_callback)(*this, item->m_param, true);
787   for (callback_item *item = m_callback_list.first(); item != NULL; item = item->next())
788      item->m_callback(*this, true);
795789
796790   // if this is the primary screen and we need to update now
797791   if (this == machine().primary_screen && !(machine().config().m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK))
r11363r11364
816810void screen_device::vblank_end_callback()
817811{
818812   // call the screen specific callbacks
819   for (callback_item *item = m_callback_list; item != NULL; item = item->m_next)
820      (*item->m_callback)(*this, item->m_param, false);
813   for (callback_item *item = m_callback_list.first(); item != NULL; item = item->next())
814      item->m_callback(*this, false);
821815
822816   // if this is the primary screen and we need to update now
823817   if (this == machine().primary_screen && (machine().config().m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK))
r11363r11364
11001094      machine().driver_data<driver_device>()->screen_eof();
11011095   }
11021096}
1103
src/emu/debugger.c
r11363r11364
7777      debugint_init(machine);
7878
7979      /* allocate a new entry for our global list */
80      machine.add_notifier(MACHINE_NOTIFY_EXIT, debugger_exit);
80      machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(debugger_exit), &machine));
8181      entry = global_alloc(machine_entry);
8282      entry->next = machine_list;
8383      entry->machine = &machine;
src/emu/screen.h
r11363r11364
7272
7373
7474// callback that is called to notify of a change in the VBLANK state
75typedef void (*vblank_state_changed_func)(screen_device &device, void *param, bool vblank_state);
75typedef delegate<void (screen_device &, bool)> vblank_state_delegate;
76
7677typedef UINT32 (*screen_update_func)(screen_device *screen, bitmap_t *bitmap, const rectangle *cliprect);
7778typedef void (*screen_eof_func)(screen_device *screen, running_machine &machine);
7879
r11363r11364
147148   void update_now();
148149
149150   // additional helpers
150   void register_vblank_callback(vblank_state_changed_func vblank_callback, void *param);
151   void register_vblank_callback(vblank_state_delegate vblank_callback);
151152   bitmap_t *alloc_compatible_bitmap(int width = 0, int height = 0) { return auto_bitmap_alloc(machine(), (width == 0) ? m_width : width, (height == 0) ? m_height : height, format()); }
152153
153154   // internal to the video system
r11363r11364
230231   UINT64            m_frame_number;            // the current frame number
231232   UINT32            m_partial_updates_this_frame;// partial update counter this frame
232233
233   struct callback_item
234   class callback_item
234235   {
236   public:
237      callback_item(vblank_state_delegate callback)
238         : m_next(NULL),
239           m_callback(callback) { }
240      callback_item *next() const { return m_next; }
241     
235242      callback_item *            m_next;
236      vblank_state_changed_func   m_callback;
237      void *                  m_param;
243      vblank_state_delegate      m_callback;
238244   };
239   callback_item *      m_callback_list;      // list of VBLANK callbacks
245   simple_list<callback_item> m_callback_list;      // list of VBLANK callbacks
240246};
241247
242248// device type definition
src/emu/sound.c
r11363r11364
800800      m_wavfile = wav_open(wavfile, machine.sample_rate(), 2);
801801
802802   // register callbacks
803   config_register(machine, "mixer", &sound_manager::config_load, &sound_manager::config_save);
804   machine.add_notifier(MACHINE_NOTIFY_PAUSE, &sound_manager::pause);
805   machine.add_notifier(MACHINE_NOTIFY_RESUME, &sound_manager::resume);
806   machine.add_notifier(MACHINE_NOTIFY_RESET, &sound_manager::reset);
803   config_register(machine, "mixer", config_saveload_delegate(FUNC(sound_manager::config_load), this), config_saveload_delegate(FUNC(sound_manager::config_save), this));
804   machine.add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(FUNC(sound_manager::pause), this));
805   machine.add_notifier(MACHINE_NOTIFY_RESUME, machine_notify_delegate(FUNC(sound_manager::resume), this));
806   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(sound_manager::reset), this));
807807
808808   // register global states
809809   state_save_register_global(machine, m_last_update);
r11363r11364
896896//  reset - reset all sound chips
897897//-------------------------------------------------
898898
899void sound_manager::reset(running_machine &machine)
899void sound_manager::reset()
900900{
901901   // reset all the sound chips
902902   device_sound_interface *sound = NULL;
903   for (bool gotone = machine.devicelist().first(sound); gotone; gotone = sound->next(sound))
903   for (bool gotone = machine().devicelist().first(sound); gotone; gotone = sound->next(sound))
904904      sound->device().reset();
905905}
906906
r11363r11364
909909//  pause - pause sound output
910910//-------------------------------------------------
911911
912void sound_manager::pause(running_machine &machine)
912void sound_manager::pause()
913913{
914   machine.sound().mute(true, MUTE_REASON_PAUSE);
914   mute(true, MUTE_REASON_PAUSE);
915915}
916916
917917
r11363r11364
919919//  resume - resume sound output
920920//-------------------------------------------------
921921
922void sound_manager::resume(running_machine &machine)
922void sound_manager::resume()
923923{
924   machine.sound().mute(false, MUTE_REASON_PAUSE);
924   mute(false, MUTE_REASON_PAUSE);
925925}
926926
927927
r11363r11364
930930//  configuration file
931931//-------------------------------------------------
932932
933void sound_manager::config_load(running_machine &machine, int config_type, xml_data_node *parentnode)
933void sound_manager::config_load(int config_type, xml_data_node *parentnode)
934934{
935935   // we only care about game files
936936   if (config_type != CONFIG_TYPE_GAME)
r11363r11364
944944   for (xml_data_node *channelnode = xml_get_sibling(parentnode->child, "channel"); channelnode != NULL; channelnode = xml_get_sibling(channelnode->next, "channel"))
945945   {
946946      speaker_input info;
947      if (machine.sound().indexed_speaker_input(xml_get_attribute_int(channelnode, "index", -1), info))
947      if (indexed_speaker_input(xml_get_attribute_int(channelnode, "index", -1), info))
948948      {
949949         float defvol = xml_get_attribute_float(channelnode, "defvol", -1000.0);
950950         float newvol = xml_get_attribute_float(channelnode, "newvol", -1000.0);
r11363r11364
960960//  file
961961//-------------------------------------------------
962962
963void sound_manager::config_save(running_machine &machine, int config_type, xml_data_node *parentnode)
963void sound_manager::config_save(int config_type, xml_data_node *parentnode)
964964{
965965   // we only care about game files
966966   if (config_type != CONFIG_TYPE_GAME)
r11363r11364
971971      for (int mixernum = 0; ; mixernum++)
972972      {
973973         speaker_input info;
974         if (!machine.sound().indexed_speaker_input(mixernum, info))
974         if (!indexed_speaker_input(mixernum, info))
975975            break;
976976         float defvol = info.stream->initial_input_gain(info.inputnum);
977977         float newvol = info.stream->input_gain(info.inputnum);
src/emu/sound.h
r11363r11364
199199
200200// ======================> sound_manager
201201
202class sound_manager
202class sound_manager : public bindable_object
203203{
204204   friend class sound_stream;
205205
r11363r11364
242242private:
243243   // internal helpers
244244   void mute(bool mute, UINT8 reason);
245   static void reset(running_machine &machine);
246   static void pause(running_machine &machine);
247   static void resume(running_machine &machine);
248   static void config_load(running_machine &machine, int config_type, xml_data_node *parentnode);
249   static void config_save(running_machine &machine, int config_type, xml_data_node *parentnode);
245   void reset();
246   void pause();
247   void resume();
248   void config_load(int config_type, xml_data_node *parentnode);
249   void config_save(int config_type, xml_data_node *parentnode);
250250
251251   static TIMER_CALLBACK( update_static ) { reinterpret_cast<sound_manager *>(ptr)->update(); }
252252   void update();
src/emu/input.c
r11363r11364
595595   code_pressed_memory_reset(machine);
596596
597597   /* request a per-frame callback for bookkeeping */
598   machine.add_notifier(MACHINE_NOTIFY_FRAME, input_frame);
598   machine.add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(FUNC(input_frame), &machine));
599599
600600   /* read input enable options */
601601   device_list[DEVICE_CLASS_KEYBOARD].enabled = TRUE;
src/emu/debugint/debugint.c
r11363r11364
921921   debug_font_width++;
922922   /* FIXME: above does not really work */
923923   debug_font_width = 10;
924   machine.add_notifier(MACHINE_NOTIFY_EXIT, debugint_exit);
924   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(debugint_exit), &machine));
925925}
926926
927927#if 0
src/mess/tools/messtest/testmess.c
r11363r11364
514514
515515void osd_init(running_machine &machine)
516516{
517   machine.add_notifier(MACHINE_NOTIFY_EXIT, testmess_exit);
517   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(testmess_exit),&machine));
518518   target = machine.render().target_alloc();
519519   target->set_orientation(0);
520520}
src/mess/machine/dgn_beta.c
r11363r11364
11171117      machine.device<cpu_device>(MAINCPU_TAG)->debug()->set_dasm_override(dgnbeta_dasm_override);
11181118   }
11191119
1120   machine.add_notifier(MACHINE_NOTIFY_RESET, dgnbeta_reset);
1120   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(dgnbeta_reset),&machine));
11211121   dgnbeta_reset(machine);
11221122   /* setup debug commands */
11231123   if (machine.debug_flags & DEBUG_FLAG_ENABLED)
src/mess/machine/pdp1.c
r11363r11364
310310   dst = machine.region("gfx1")->base();
311311   memcpy(dst, fontdata6x8, pdp1_fontdata_size);
312312
313   machine.add_notifier(MACHINE_NOTIFY_EXIT, pdp1_machine_stop);
313   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(pdp1_machine_stop),&machine));
314314
315315   state->m_tape_reader.timer = machine.scheduler().timer_alloc(FUNC(reader_callback));
316316   state->m_tape_puncher.timer = machine.scheduler().timer_alloc(FUNC(puncher_callback));
src/mess/machine/gb.c
r11363r11364
245245MACHINE_START( gb )
246246{
247247   gb_state *state = machine.driver_data<gb_state>();
248   machine.add_notifier(MACHINE_NOTIFY_EXIT, gb_machine_stop);
248   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_machine_stop),&machine));
249249
250250   /* Allocate the serial timer, and disable it */
251251   state->m_gb_serial_timer = machine.scheduler().timer_alloc(FUNC(gb_serial_timer_proc));
r11363r11364
257257MACHINE_START( gbc )
258258{
259259   gb_state *state = machine.driver_data<gb_state>();
260   machine.add_notifier(MACHINE_NOTIFY_EXIT, gb_machine_stop);
260   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_machine_stop),&machine));
261261
262262   /* Allocate the serial timer, and disable it */
263263   state->m_gb_serial_timer = machine.scheduler().timer_alloc(FUNC(gb_serial_timer_proc));
r11363r11364
289289   state->m_sgb_packets = -1;
290290   state->m_sgb_tile_data = auto_alloc_array_clear(machine, UINT8, 0x2000 );
291291
292   machine.add_notifier(MACHINE_NOTIFY_EXIT, gb_machine_stop);
292   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_machine_stop),&machine));
293293
294294   /* Allocate the serial timer, and disable it */
295295   state->m_gb_serial_timer = machine.scheduler().timer_alloc(FUNC(gb_serial_timer_proc));
src/mess/machine/tx0.c
r11363r11364
6060   state->m_typewriter.prt_timer = machine.scheduler().timer_alloc(FUNC(prt_callback));
6161   state->m_dis_timer = machine.scheduler().timer_alloc(FUNC(dis_callback));
6262
63   machine.add_notifier(MACHINE_NOTIFY_EXIT, tx0_machine_stop);
63   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(tx0_machine_stop),&machine));
6464}
6565
6666
src/mess/machine/electron.c
r11363r11364
351351   state->m_ula.interrupt_control = 0x00;
352352   machine.scheduler().timer_set(attotime::zero, FUNC(setup_beep));
353353   state->m_tape_timer = machine.scheduler().timer_alloc(FUNC(electron_tape_timer_handler));
354   machine.add_notifier(MACHINE_NOTIFY_RESET, electron_reset);
354   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(electron_reset),&machine));
355355}
356356
src/mess/machine/sms.c
r11363r11364
17041704{
17051705   sms_state *state = machine.driver_data<sms_state>();
17061706
1707   machine.add_notifier(MACHINE_NOTIFY_EXIT, sms_machine_stop);
1707   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sms_machine_stop),&machine));
17081708   state->m_rapid_fire_timer = machine.scheduler().timer_alloc(FUNC(rapid_fire_callback));
17091709   state->m_rapid_fire_timer->adjust(attotime::from_hz(10), 0, attotime::from_hz(10));
17101710
src/mess/machine/wswan.c
r11363r11364
196196   wswan_state *state = machine.driver_data<wswan_state>();
197197   state->m_ws_bios_bank = NULL;
198198   state->m_system_type = TYPE_WSWAN;
199   machine.add_notifier(MACHINE_NOTIFY_EXIT, wswan_machine_stop );
199   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(wswan_machine_stop),&machine));
200200   state->m_vdp.timer = machine.scheduler().timer_alloc(FUNC(wswan_scanline_interrupt), &state->m_vdp );
201201   state->m_vdp.timer->adjust( attotime::from_ticks( 256, 3072000 ), 0, attotime::from_ticks( 256, 3072000 ) );
202202
r11363r11364
212212   wswan_state *state = machine.driver_data<wswan_state>();
213213   state->m_ws_bios_bank = NULL;
214214   state->m_system_type = TYPE_WSC;
215   machine.add_notifier(MACHINE_NOTIFY_EXIT, wswan_machine_stop );
215   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(wswan_machine_stop),&machine));
216216   state->m_vdp.timer = machine.scheduler().timer_alloc(FUNC(wswan_scanline_interrupt), &state->m_vdp );
217217   state->m_vdp.timer->adjust( attotime::from_ticks( 256, 3072000 ), 0, attotime::from_ticks( 256, 3072000 ) );
218218
src/mess/machine/nes.c
r11363r11364
280280   nes_state *state = machine.driver_data<nes_state>();
281281
282282   init_nes_core(machine);
283   machine.add_notifier(MACHINE_NOTIFY_EXIT, nes_machine_stop);
283   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(nes_machine_stop),&machine));
284284
285285   state->m_maincpu = machine.device("maincpu");
286286   state->m_ppu = machine.device("ppu");
src/mess/machine/dc.c
r11363r11364
550550
551551   gdrom_device = NULL;
552552
553   machine.add_notifier(MACHINE_NOTIFY_EXIT, dreamcast_atapi_exit);
553   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(dreamcast_atapi_exit),&machine));
554554
555555   atapi_data = auto_alloc_array(machine, UINT8,  ATAPI_DATA_SIZE );
556556
src/mess/machine/lynx.c
r11363r11364
18131813
18141814   memset(&state->m_suzy, 0, sizeof(state->m_suzy));
18151815
1816   machine.add_notifier(MACHINE_NOTIFY_RESET, lynx_reset);
1816   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(lynx_reset),&machine));
18171817
18181818   for (i = 0; i < NR_LYNX_TIMERS; i++)
18191819      lynx_timer_init(machine, i);
src/mess/machine/bebox.c
r11363r11364
10931093   pc_fdc_init(machine, &bebox_fdc_interface);
10941094   /* SCSI */
10951095   lsi53c810_init(machine, &scsi53c810_intf);
1096   machine.add_notifier(MACHINE_NOTIFY_EXIT, bebox_exit);
1096   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(bebox_exit),&machine));
10971097}
10981098
10991099DRIVER_INIT( bebox )
src/mess/machine/cybiko.c
r11363r11364
225225   // serial port
226226   cybiko_rs232_init(machine);
227227   // other
228   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_stop_cybikov1);
228   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(machine_stop_cybikov1),&machine));
229229}
230230
231231MACHINE_START( cybikov2 )
r11363r11364
243243   // serial port
244244   cybiko_rs232_init(machine);
245245   // other
246   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_stop_cybikov2);
246   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(machine_stop_cybikov2),&machine));
247247}
248248
249249MACHINE_START( cybikoxt )
r11363r11364
258258   // serial port
259259   cybiko_rs232_init(machine);
260260   // other
261   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_stop_cybikoxt);
261   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(machine_stop_cybikoxt),&machine));
262262}
263263
264264///////////////////
src/mess/machine/snescart.c
r11363r11364
222222
223223MACHINE_START( snes_mess )
224224{
225   machine.add_notifier(MACHINE_NOTIFY_EXIT, snes_machine_stop);
225   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(snes_machine_stop),&machine));
226226   MACHINE_START_CALL(snes);
227227}
228228
r11363r11364
290290
291291MACHINE_START( snesst )
292292{
293   machine.add_notifier(MACHINE_NOTIFY_EXIT, sufami_machine_stop);
293   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sufami_machine_stop),&machine));
294294   MACHINE_START_CALL(snes);
295295}
296296
src/mess/machine/apple2.c
r11363r11364
16451645   state->m_fdc_diskreg = 0;
16461646
16471647   AY3600_init(machine);
1648   machine.add_notifier(MACHINE_NOTIFY_RESET, apple2_reset);
1648   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(apple2_reset),&machine));
16491649
16501650   /* state save registers */
16511651   state->save_item(NAME(state->m_flags));
src/mess/video/nes.c
r11363r11364
4141
4242   state->m_last_frame_flip =  0;
4343
44   machine.add_notifier(MACHINE_NOTIFY_RESET, nes_vh_reset);
44   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(nes_vh_reset),&machine));
4545}
4646
4747PALETTE_INIT( nes )
src/mess/drivers/pdp1.c
r11363r11364
658658   dst = machine.region("gfx1")->base();
659659   memcpy(dst, fontdata6x8, pdp1_fontdata_size);
660660
661   machine.add_notifier(MACHINE_NOTIFY_EXIT, pdp1_machine_stop);
661   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(pdp1_machine_stop),&machine));
662662
663663   state->m_tape_reader.timer = machine.scheduler().timer_alloc(FUNC(reader_callback));
664664   state->m_tape_puncher.timer = machine.scheduler().timer_alloc(FUNC(puncher_callback));
src/mess/drivers/tx0.c
r11363r11364
390390   state->m_typewriter.prt_timer = machine.scheduler().timer_alloc(FUNC(prt_callback));
391391   state->m_dis_timer = machine.scheduler().timer_alloc(FUNC(dis_callback));
392392
393   machine.add_notifier(MACHINE_NOTIFY_EXIT, tx0_machine_stop);
393   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(tx0_machine_stop),&machine));
394394}
395395
396396
src/mess/drivers/ip22.c
r11363r11364
15441544
15451545   // SCSI init
15461546   wd33c93_init(machine, &scsi_intf);
1547   machine.add_notifier(MACHINE_NOTIFY_EXIT, ip225015_exit);
1547   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ip225015_exit),&machine));
15481548}
15491549
15501550static DRIVER_INIT( ip225015 )
src/mess/drivers/genpc.c
r11363r11364
157157   MCFG_CPU_IO_MAP(pc16_io)
158158   MCFG_CPU_CONFIG(i86_address_mask)
159159
160   MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu",pc_keytronic_keyboard_intf)
160   //MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu",pc_keytronic_keyboard_intf)
161161   MCFG_DEVICE_INPUT_DEFAULTS(cga)
162162
163163   /* video hardware */
164164   MCFG_FRAGMENT_ADD( pcvideo_cga )
165165   MCFG_PALETTE_LENGTH( 256 )
166166
167    MCFG_ISA8_BUS_DEVICE("mb:isa", 1, "com", ISA8_COM)
168   MCFG_ISA8_BUS_DEVICE("mb:isa", 2, "fdc", ISA8_FDC)
169   MCFG_ISA8_BUS_DEVICE("mb:isa", 3, "hdc", ISA8_HDC)
170   MCFG_ISA8_BUS_DEVICE("mb:isa", 4, "gblaster", ISA8_GAME_BLASTER)
167    //MCFG_ISA8_BUS_DEVICE("mb:isa", 1, "com", ISA8_COM)
168   //MCFG_ISA8_BUS_DEVICE("mb:isa", 2, "fdc", ISA8_FDC)
169   //MCFG_ISA8_BUS_DEVICE("mb:isa", 3, "hdc", ISA8_HDC)
170   //MCFG_ISA8_BUS_DEVICE("mb:isa", 4, "gblaster", ISA8_GAME_BLASTER)
171171
172172   /* keyboard */
173   MCFG_KB_KEYTRONIC_ADD("keyboard", pc_keytronic_intf)
173   //MCFG_KB_KEYTRONIC_ADD("keyboard", pc_keytronic_intf)
174174
175175   /* internal ram */
176176   MCFG_RAM_ADD(RAM_TAG)
src/mess/drivers/nc.c
r11363r11364
963963   nc_state *state = machine.driver_data<nc_state>();
964964    state->m_type = NC_TYPE_1xx;
965965
966   machine.add_notifier(MACHINE_NOTIFY_EXIT, nc100_machine_stop);
966   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(nc100_machine_stop),&machine));
967967
968968   /* keyboard timer */
969969   state->m_keyboard_timer = machine.scheduler().timer_alloc(FUNC(nc_keyboard_timer_callback));
r11363r11364
13591359   nc_state *state = machine.driver_data<nc_state>();
13601360   state->m_type = NC_TYPE_200;
13611361
1362   machine.add_notifier(MACHINE_NOTIFY_EXIT, nc200_machine_stop);
1362   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(nc200_machine_stop),&machine));
13631363
13641364   /* keyboard timer */
13651365   state->m_keyboard_timer = machine.scheduler().timer_alloc(FUNC(nc_keyboard_timer_callback));
src/mess/drivers/ip20.c
r11363r11364
501501
502502static DRIVER_INIT( ip204415 )
503503{
504   machine.add_notifier(MACHINE_NOTIFY_EXIT, ip204415_exit);
504   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ip204415_exit),&machine));
505505}
506506
507507static TIMER_CALLBACK(ip20_timer)
src/mess/drivers/gba.c
r11363r11364
21942194   gba_state *state = machine.driver_data<gba_state>();
21952195
21962196   /* add a hook for battery save */
2197   machine.add_notifier(MACHINE_NOTIFY_EXIT, gba_machine_stop);
2197   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gba_machine_stop),&machine));
21982198
21992199   /* create a timer to fire scanline functions */
22002200   state->m_scan_timer = machine.scheduler().timer_alloc(FUNC(perform_scan));

Previous 15994 Revisions Next


© 1998-2018 The MESS Team