mirror of
https://github.com/holub/mame
synced 2025-04-24 01:11:11 +03:00
Removes "global" VBLANK callback hack
This commit is contained in:
parent
19b68f421f
commit
4eecf5199d
@ -144,7 +144,7 @@ int mame_debug_is_active(void)
|
||||
on_vblank - called when a VBLANK hits
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void on_vblank(running_machine *machine, int vblank_state)
|
||||
static void on_vblank(const device_config *device, int vblank_state)
|
||||
{
|
||||
/* if we're configured to stop on VBLANK, break */
|
||||
if (vblank_state && break_on_vblank)
|
||||
@ -296,7 +296,8 @@ void debug_cpu_init(running_machine *machine)
|
||||
}
|
||||
|
||||
/* add callback for breaking on VBLANK */
|
||||
video_screen_register_global_vbl_cb(on_vblank);
|
||||
if (machine->primary_screen != NULL)
|
||||
video_screen_register_vbl_cb(machine->primary_screen, on_vblank);
|
||||
|
||||
add_exit_callback(machine, debug_cpu_exit);
|
||||
}
|
||||
|
@ -581,7 +581,7 @@ void mame_frame_update(running_machine *machine)
|
||||
{
|
||||
callback_item *cb;
|
||||
|
||||
/* call all registered reset callbacks */
|
||||
/* call all registered frame callbacks */
|
||||
for (cb = machine->mame_data->frame_callback_list; cb; cb = cb->next)
|
||||
(*cb->func.frame)(machine);
|
||||
}
|
||||
|
@ -124,9 +124,6 @@ struct _video_global
|
||||
/* snapshot stuff */
|
||||
render_target * snap_target; /* screen shapshot target */
|
||||
bitmap_t * snap_bitmap; /* screen snapshot bitmap */
|
||||
|
||||
/* global VBLANK callbacks */
|
||||
vblank_state_changed_global_func vbl_cbs[MAX_VBL_CB]; /* the array of callbacks */
|
||||
};
|
||||
|
||||
|
||||
@ -1187,39 +1184,6 @@ void video_screen_register_vbl_cb(const device_config *screen, vblank_state_chan
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
video_screen_register_global_vbl_cb - registers a
|
||||
VBLANK callback for a specific screen
|
||||
-------------------------------------------------*/
|
||||
|
||||
void video_screen_register_global_vbl_cb(vblank_state_changed_global_func vbl_cb)
|
||||
{
|
||||
int i, found;
|
||||
|
||||
/* validate arguments */
|
||||
assert(vbl_cb != NULL);
|
||||
|
||||
/* check if we already have this callback registered */
|
||||
found = FALSE;
|
||||
for (i = 0; i < MAX_VBL_CB; i++)
|
||||
{
|
||||
if (global.vbl_cbs[i] == NULL)
|
||||
break;
|
||||
|
||||
if (global.vbl_cbs[i] == vbl_cb)
|
||||
found = TRUE;
|
||||
}
|
||||
|
||||
/* check that there is room */
|
||||
assert(i != MAX_VBL_CB);
|
||||
|
||||
/* if not found, register and increment count */
|
||||
if (!found)
|
||||
global.vbl_cbs[i] = vbl_cb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
VIDEO SCREEN DEVICE INTERFACE
|
||||
***************************************************************************/
|
||||
@ -1303,17 +1267,9 @@ static TIMER_CALLBACK( vblank_begin_callback )
|
||||
for (i = 0; internal_state->vbl_cbs[i] != NULL; i++)
|
||||
internal_state->vbl_cbs[i](screen, TRUE);
|
||||
|
||||
/* for the first screen */
|
||||
if (screen == machine->primary_screen)
|
||||
{
|
||||
/* call the global callbacks */
|
||||
for (i = 0; global.vbl_cbs[i] != NULL; i++)
|
||||
global.vbl_cbs[i](machine, TRUE);
|
||||
|
||||
/* do we update the screen now? */
|
||||
if (!(machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK))
|
||||
video_frame_update(machine, FALSE);
|
||||
}
|
||||
/* if this is the primary screen and we need to update now */
|
||||
if ((screen == machine->primary_screen) && !(machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK))
|
||||
video_frame_update(machine, FALSE);
|
||||
|
||||
/* reset the timers */
|
||||
timer_adjust_oneshot(internal_state->vblank_begin_timer, attotime_make(0, internal_state->frame_period), 0);
|
||||
@ -1337,17 +1293,9 @@ static TIMER_CALLBACK( vblank_end_callback )
|
||||
for (i = 0; internal_state->vbl_cbs[i] != NULL; i++)
|
||||
internal_state->vbl_cbs[i](screen, FALSE);
|
||||
|
||||
/* for the first screen */
|
||||
if (screen == machine->primary_screen)
|
||||
{
|
||||
/* call the global callbacks */
|
||||
for (i = 0; global.vbl_cbs[i] != NULL; i++)
|
||||
global.vbl_cbs[i](machine, FALSE);
|
||||
|
||||
/* update if we handn't already */
|
||||
if (machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK)
|
||||
video_frame_update(machine, FALSE);
|
||||
}
|
||||
/* if this is the primary screen and we need to update now */
|
||||
if ((screen == machine->primary_screen) && (machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK))
|
||||
video_frame_update(machine, FALSE);
|
||||
|
||||
/* increment the frame number counter */
|
||||
internal_state->frame_number++;
|
||||
|
@ -96,14 +96,12 @@ struct _screen_config
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
vblank_state_changed_func
|
||||
vblank_state_changed_global_func -
|
||||
vblank_state_changed_func -
|
||||
callback that is called to notify of a change
|
||||
in the VBLANK state
|
||||
-------------------------------------------------*/
|
||||
|
||||
typedef void (*vblank_state_changed_func)(const device_config *device, int vblank_state);
|
||||
typedef void (*vblank_state_changed_global_func)(running_machine *machine, int vblank_state);
|
||||
|
||||
|
||||
|
||||
@ -172,9 +170,6 @@ UINT64 video_screen_get_frame_number(const device_config *screen);
|
||||
/* registers a VBLANK callback for the given screen */
|
||||
void video_screen_register_vbl_cb(const device_config *screen, vblank_state_changed_func vbl_cb);
|
||||
|
||||
/* registers a VBLANK callback independent of a screen */
|
||||
void video_screen_register_global_vbl_cb(vblank_state_changed_global_func vbl_cb);
|
||||
|
||||
|
||||
/* ----- video screen device interface ----- */
|
||||
|
||||
|
@ -83,18 +83,18 @@ static TIMER_CALLBACK( watchdog_callback )
|
||||
timers
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void on_vblank(running_machine *machine, int vblank_state)
|
||||
static void on_vblank(const device_config *screen, int vblank_state)
|
||||
{
|
||||
/* VBLANK starting */
|
||||
if (vblank_state && watchdog_enabled)
|
||||
{
|
||||
/* check the watchdog */
|
||||
if (machine->config->watchdog_vblank_count != 0)
|
||||
if (screen->machine->config->watchdog_vblank_count != 0)
|
||||
{
|
||||
watchdog_counter = watchdog_counter - 1;
|
||||
|
||||
if (watchdog_counter == 0)
|
||||
watchdog_callback(machine, NULL, 0);
|
||||
watchdog_callback(screen->machine, NULL, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -115,8 +115,9 @@ void watchdog_reset(running_machine *machine)
|
||||
{
|
||||
watchdog_counter = machine->config->watchdog_vblank_count;
|
||||
|
||||
/* register a global VBLANK callback */
|
||||
video_screen_register_global_vbl_cb(on_vblank);
|
||||
/* register a VBLANK callback for the primary screen */
|
||||
if (machine->primary_screen != NULL)
|
||||
video_screen_register_vbl_cb(machine->primary_screen, on_vblank);
|
||||
}
|
||||
|
||||
/* timer-based watchdog? */
|
||||
|
Loading…
Reference in New Issue
Block a user