vblank_state_changed_func now has a device_config argument

This commit is contained in:
Zsolt Vasvari 2008-03-06 14:22:08 +00:00
parent 553d92bcb5
commit 9c172be162
5 changed files with 20 additions and 28 deletions

View File

@ -785,21 +785,12 @@ int cpu_getiloops(void)
for this screen for this screen
-------------------------------------------------*/ -------------------------------------------------*/
static void on_vblank(running_machine *machine, screen_state *screen, int vblank_state) static void on_vblank(running_machine *machine, const device_config *device, int vblank_state)
{ {
/* VBLANK starting */ /* VBLANK starting */
if (vblank_state) if (vblank_state)
{ {
int cpunum; int cpunum;
const char *screen_tag = NULL;
const device_config *device;
/* get the screen's tag */
for (device = video_screen_first(machine->config); device != NULL; device = video_screen_next(device))
if (device->token == screen)
screen_tag = device->tag;
assert(screen_tag != NULL);
/* find any CPUs that have this screen as their VBLANK interrupt source */ /* find any CPUs that have this screen as their VBLANK interrupt source */
for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++) for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++)
@ -813,13 +804,13 @@ static void on_vblank(running_machine *machine, screen_state *screen, int vblank
else else
cpu[cpunum].iloops = -1; cpu[cpunum].iloops = -1;
/* the hack style VBLANK decleration uses the first screen always */ /* the hack style VBLANK decleration always uses the first screen */
if (config->vblank_interrupts_per_frame > 1) if (config->vblank_interrupts_per_frame > 1)
cpu_interested = TRUE; cpu_interested = TRUE;
/* for new style decleration, we need to compare the tags */ /* for new style decleration, we need to compare the tags */
else if (config->vblank_interrupts_per_frame == 1) else if (config->vblank_interrupts_per_frame == 1)
cpu_interested = (strcmp(config->vblank_interrupt_screen, screen_tag) == 0); cpu_interested = (strcmp(config->vblank_interrupt_screen, device->tag) == 0);
/* no VBLANK interrupt, not interested */ /* no VBLANK interrupt, not interested */
else else

View File

@ -1032,7 +1032,7 @@ static int default_ports_lookup[__ipt_max][MAX_PLAYERS];
FUNCTION PROTOTYPES FUNCTION PROTOTYPES
***************************************************************************/ ***************************************************************************/
static void on_vblank(running_machine *machine, screen_state *screen, int vblank_state); static void on_vblank(running_machine *machine, const device_config *device, int vblank_state);
static void setup_playback(running_machine *machine); static void setup_playback(running_machine *machine);
static void setup_record(running_machine *machine); static void setup_record(running_machine *machine);
static void input_port_exit(running_machine *machine); static void input_port_exit(running_machine *machine);
@ -1153,7 +1153,7 @@ void input_port_post_init(running_machine *machine)
* *
*************************************/ *************************************/
static void on_vblank(running_machine *machine, screen_state *screen, int vblank_state) static void on_vblank(running_machine *machine, const device_config *device, int vblank_state)
{ {
/* VBLANK starting - read keyboard & update the status of the input ports */ /* VBLANK starting - read keyboard & update the status of the input ports */
if (vblank_state) if (vblank_state)

View File

@ -50,7 +50,7 @@ struct _internal_screen_info
{ {
/* pointers to screen configuration and state */ /* pointers to screen configuration and state */
int scrnum; /* the screen index */ int scrnum; /* the screen index */
const screen_config * config; /* pointer to the configuration in the Machine->config */ const device_config * device; /* pointer to screen device configuration */
screen_state * state; /* pointer to visible state in Machine structure */ screen_state * state; /* pointer to visible state in Machine structure */
/* textures and bitmaps */ /* textures and bitmaps */
@ -313,6 +313,7 @@ void video_init(running_machine *machine)
int scrnum = device_list_index(machine->config->devicelist, VIDEO_SCREEN, device->tag); int scrnum = device_list_index(machine->config->devicelist, VIDEO_SCREEN, device->tag);
render_container *container = render_container_get_screen(scrnum); render_container *container = render_container_get_screen(scrnum);
internal_screen_info *info = &viddata->scrinfo[scrnum]; internal_screen_info *info = &viddata->scrinfo[scrnum];
screen_config *config = device->inline_config;
/* allocate the VBLANK timers */ /* allocate the VBLANK timers */
info->vblank_begin_timer = timer_alloc(vblank_begin_callback, info); info->vblank_begin_timer = timer_alloc(vblank_begin_callback, info);
@ -323,21 +324,21 @@ void video_init(running_machine *machine)
/* make pointers back to the config and state */ /* make pointers back to the config and state */
info->scrnum = scrnum; info->scrnum = scrnum;
info->config = device->inline_config; info->device = device;
info->state = &machine->screen[scrnum]; info->state = &machine->screen[scrnum];
/* configure the screen with the default parameters */ /* configure the screen with the default parameters */
video_screen_configure(scrnum, info->state->width, info->state->height, &info->state->visarea, info->state->refresh); video_screen_configure(scrnum, info->state->width, info->state->height, &info->state->visarea, info->state->refresh);
/* configure the default cliparea */ /* configure the default cliparea */
if (info->config->xoffset != 0) if (config->xoffset != 0)
render_container_set_xoffset(container, info->config->xoffset); render_container_set_xoffset(container, config->xoffset);
if (info->config->yoffset != 0) if (config->yoffset != 0)
render_container_set_yoffset(container, info->config->yoffset); render_container_set_yoffset(container, config->yoffset);
if (info->config->xscale != 0) if (config->xscale != 0)
render_container_set_xscale(container, info->config->xscale); render_container_set_xscale(container, config->xscale);
if (info->config->yscale != 0) if (config->yscale != 0)
render_container_set_yscale(container, info->config->yscale); render_container_set_yscale(container, config->yscale);
/* reset VBLANK timing */ /* reset VBLANK timing */
info->vblank_time = attotime_zero; info->vblank_time = attotime_zero;
@ -1223,7 +1224,7 @@ static void call_vb_callbacks(running_machine *machine, internal_screen_info *sc
scrinfo->vblank_state = vblank_state; scrinfo->vblank_state = vblank_state;
for (i = 0; i < scrinfo->vbl_cb_count; i++) for (i = 0; i < scrinfo->vbl_cb_count; i++)
scrinfo->vbl_cbs[i](machine, scrinfo->state, vblank_state); scrinfo->vbl_cbs[i](machine, scrinfo->device, vblank_state);
} }

View File

@ -94,7 +94,7 @@ struct _screen_config
the VBLANK state the VBLANK state
-------------------------------------------------*/ -------------------------------------------------*/
typedef void (*vblank_state_changed_func)(running_machine *machine, screen_state *screen, int vblank_state); typedef void (*vblank_state_changed_func)(running_machine *machine, const device_config *device, int vblank_state);

View File

@ -83,7 +83,7 @@ static TIMER_CALLBACK( watchdog_callback )
timers timers
-------------------------------------------------*/ -------------------------------------------------*/
static void on_vblank(running_machine *machine, screen_state *screen, int vblank_state) static void on_vblank(running_machine *machine, const device_config *device, int vblank_state)
{ {
/* VBLANK starting */ /* VBLANK starting */
if (vblank_state && watchdog_enabled) if (vblank_state && watchdog_enabled)