diff options
| author | 2008-03-10 06:39:20 +0000 | |
|---|---|---|
| committer | 2008-03-10 06:39:20 +0000 | |
| commit | 2a8c73cc45229f1c897d52d27b59aeba99eaddae (patch) | |
| tree | 6dcabd5365087da21fee2bcffa072d71e8371f7d /src | |
| parent | 6e3be05912764a80d637eed64f4b729e4b689c56 (diff) | |
All video_screen_*_scrnum functions have been removed. Next step is to remove the scrnum from VIDEO_UPDATE
Diffstat (limited to 'src')
| -rw-r--r-- | src/emu/debug/debugcpu.c | 16 | ||||
| -rw-r--r-- | src/emu/ui.c | 10 | ||||
| -rw-r--r-- | src/emu/video.c | 61 | ||||
| -rw-r--r-- | src/emu/video.h | 4 | ||||
| -rw-r--r-- | src/mame/drivers/firebeat.c | 45 | ||||
| -rw-r--r-- | src/mame/drivers/system18.c | 1 | ||||
| -rw-r--r-- | src/mame/video/genesis.c | 28 | ||||
| -rw-r--r-- | src/mame/video/segas18.c | 8 | ||||
| -rw-r--r-- | src/mame/video/system16.c | 22 |
9 files changed, 83 insertions, 112 deletions
diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index 3600dc563a4..cdb903f8b99 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -657,7 +657,13 @@ static UINT64 get_logunmap(UINT32 ref) static UINT64 get_beamx(UINT32 ref) { - return video_screen_get_hpos_scrnum(ref); + UINT64 ret = 0; + const device_config *screen = device_list_find_by_index(Machine->config->devicelist, VIDEO_SCREEN, ref); + + if (screen != NULL) + ret = video_screen_get_hpos(screen); + + return ret; } @@ -667,7 +673,13 @@ static UINT64 get_beamx(UINT32 ref) static UINT64 get_beamy(UINT32 ref) { - return video_screen_get_vpos_scrnum(ref); + UINT64 ret = 0; + const device_config *screen = device_list_find_by_index(Machine->config->devicelist, VIDEO_SCREEN, ref); + + if (screen != NULL) + ret = video_screen_get_vpos(screen); + + return ret; } diff --git a/src/emu/ui.c b/src/emu/ui.c index 8065f8a1254..504214e080b 100644 --- a/src/emu/ui.c +++ b/src/emu/ui.c @@ -1742,9 +1742,13 @@ static INT32 slider_refresh(running_machine *machine, INT32 newval, char *buffer if (buffer != NULL) { - screen_state *state = &Machine->screen[arg]; - video_screen_configure_scrnum(arg, state->width, state->height, &state->visarea, HZ_TO_ATTOSECONDS(defrefresh + (double)newval * 0.001)); - sprintf(buffer, "%s Refresh rate %.3f", slider_get_screen_desc(arg), ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds)); + const device_config *screen = device_list_find_by_index(machine->config->devicelist, VIDEO_SCREEN, arg); + int width = video_screen_get_width(screen); + int height = video_screen_get_height(screen); + const rectangle *visarea = video_screen_get_visible_area(screen); + + video_screen_configure(screen, width, height, visarea, HZ_TO_ATTOSECONDS(defrefresh + (double)newval * 0.001)); + sprintf(buffer, "%s Refresh Rate %.3ffps", slider_get_screen_desc(arg), ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds)); } refresh = ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds); return floor((refresh - defrefresh) * 1000.0f + 0.5f); diff --git a/src/emu/video.c b/src/emu/video.c index f0ac1bb1e3a..af3ca82dec7 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -51,7 +51,6 @@ struct _internal_screen_state { /* basic information about this screen */ int scrnum; /* the screen index */ - const device_config * device; /* pointer to screen device configuration */ /* textures and bitmaps */ render_texture * texture[2]; /* 2x textures for the screen bitmap */ @@ -173,7 +172,6 @@ static const UINT8 skiptable[FRAMESKIP_LEVELS][FRAMESKIP_LEVELS] = /* core implementation */ static void video_exit(running_machine *machine); static void init_buffered_spriteram(void); -static internal_screen_state *get_internal_state(running_machine *machine, int scrnum); /* graphics decoding */ static void allocate_graphics(running_machine *machine, const gfx_decode_entry *gfxdecodeinfo); @@ -341,7 +339,6 @@ void video_init(running_machine *machine) /* save some cross-reference information that makes our life easier */ internal_state->scrnum = scrnum; - internal_state->device = screen; /* configure the screen with the default parameters */ state->format = config->format; @@ -804,12 +801,6 @@ void video_screen_configure(const device_config *screen, int width, int height, timer_adjust_oneshot(internal_state->vblank_begin_timer, video_screen_get_time_until_vblank_start(screen), 0); } -void video_screen_configure_scrnum(int scrnum, int width, int height, const rectangle *visarea, attoseconds_t frame_period) -{ - internal_screen_state *internal_state = get_internal_state(Machine, scrnum); - video_screen_configure(internal_state->device, width, height, visarea, frame_period); -} - /*------------------------------------------------- video_screen_set_visarea - just set the visible area @@ -832,19 +823,6 @@ void video_screen_set_visarea(const device_config *screen, int min_x, int max_x, /*------------------------------------------------- - get_internal_state - accessor function to get - private state for a screen --------------------------------------------------*/ - -static internal_screen_state *get_internal_state(running_machine *machine, int scrnum) -{ - assert(machine != NULL); - assert((scrnum >= 0) && (scrnum < MAX_SCREENS)); - return (internal_screen_state *)machine->screen[scrnum].private_data; -} - - -/*------------------------------------------------- video_screen_update_partial - perform a partial update from the last scanline up to and including the specified scanline @@ -961,12 +939,6 @@ int video_screen_get_vpos(const device_config *screen) return (state->visarea.max_y + 1 + vpos) % state->height; } -int video_screen_get_vpos_scrnum(int scrnum) -{ - internal_screen_state *internal_state = get_internal_state(Machine, scrnum); - return video_screen_get_vpos(internal_state->device); -} - /*------------------------------------------------- video_screen_get_hpos - returns the current @@ -994,11 +966,6 @@ int video_screen_get_hpos(const device_config *screen) return delta / internal_state->pixeltime; } -int video_screen_get_hpos_scrnum(int scrnum) -{ - internal_screen_state *internal_state = get_internal_state(Machine, scrnum); - return video_screen_get_hpos(internal_state->device); -} /*------------------------------------------------- @@ -1099,9 +1066,7 @@ attotime video_screen_get_time_until_pos(const device_config *screen, int vpos, attotime video_screen_get_time_until_vblank_start(const device_config *screen) { - screen_state *state = get_safe_token(screen); - internal_screen_state *internal_state = (internal_screen_state *)state->private_data; - return video_screen_get_time_until_pos(screen, screen->machine->screen[internal_state->scrnum].visarea.max_y + 1, 0); + return video_screen_get_time_until_pos(screen, video_screen_get_visible_area(screen)->max_y + 1, 0); } @@ -1114,9 +1079,7 @@ attotime video_screen_get_time_until_vblank_start(const device_config *screen) attotime video_screen_get_time_until_vblank_end(const device_config *screen) { - screen_state *state = get_safe_token(screen); - internal_screen_state *internal_state = (internal_screen_state *)state->private_data; - return video_screen_get_time_until_pos(screen, screen->machine->screen[internal_state->scrnum].visarea.min_y, 0); + return video_screen_get_time_until_pos(screen, video_screen_get_visible_area(screen)->min_y, 0); } @@ -1173,12 +1136,6 @@ attotime video_screen_get_frame_period(const device_config *screen) return ret; } -attotime video_screen_get_frame_period_scrnum(int scrnum) -{ - internal_screen_state *internal_state = get_internal_state(Machine, scrnum); - return video_screen_get_frame_period(internal_state->device); -} - /*------------------------------------------------- video_screen_get_frame_number - return the @@ -1530,13 +1487,13 @@ static int finish_screen_updates(running_machine *machine) livemask = render_get_live_screens_mask(); for (screen = video_screen_first(machine->config); screen != NULL; screen = video_screen_next(screen)) { - int scrnum = device_list_index(machine->config->devicelist, VIDEO_SCREEN, screen->tag); - internal_screen_state *internal_state = get_internal_state(machine, scrnum); + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; /* only update if live */ - if (livemask & (1 << scrnum)) + if (livemask & (1 << internal_state->scrnum)) { - const screen_config *config = device_list_find_by_index(machine->config->devicelist, VIDEO_SCREEN, scrnum)->inline_config; + const screen_config *config = screen->inline_config; /* only update if empty and not a vector game; otherwise assume the driver did it directly */ if (config->type != SCREEN_TYPE_VECTOR && (machine->config->video_attributes & VIDEO_SELF_RENDER) == 0) @@ -1545,7 +1502,7 @@ static int finish_screen_updates(running_machine *machine) if (!global.skipping_this_frame && internal_state->changed) { bitmap_t *bitmap = internal_state->bitmap[internal_state->curbitmap]; - rectangle fixedvis = machine->screen[scrnum].visarea; + rectangle fixedvis = *video_screen_get_visible_area(screen); fixedvis.max_x++; fixedvis.max_y++; render_texture_set_bitmap(internal_state->texture[internal_state->curbitmap], bitmap, &fixedvis, 0, internal_state->texture_format); @@ -1554,8 +1511,8 @@ static int finish_screen_updates(running_machine *machine) } /* create an empty container with a single quad */ - render_container_empty(render_container_get_screen(scrnum)); - render_screen_add_quad(scrnum, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), internal_state->texture[internal_state->curtexture], PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1)); + render_container_empty(render_container_get_screen(internal_state->scrnum)); + render_screen_add_quad(internal_state->scrnum, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), internal_state->texture[internal_state->curtexture], PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1)); } /* update our movie recording state */ diff --git a/src/emu/video.h b/src/emu/video.h index 8875be3e436..ff28fca4367 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -117,7 +117,6 @@ void video_init(running_machine *machine); /* set the resolution of a screen */ void video_screen_configure(const device_config *screen, int width, int height, const rectangle *visarea, attoseconds_t refresh); -void video_screen_configure_scrnum(int scrnum, int width, int height, const rectangle *visarea, attoseconds_t refresh); /* set the visible area of a screen; this is a subset of video_screen_configure */ void video_screen_set_visarea(const device_config *screen, int min_x, int max_x, int min_y, int max_y); @@ -130,9 +129,7 @@ void video_screen_update_now(const device_config *screen); /* return the current vertical or horizontal position of the beam for a screen */ int video_screen_get_vpos(const device_config *screen); -int video_screen_get_vpos_scrnum(int scrnum); int video_screen_get_hpos(const device_config *screen); -int video_screen_get_hpos_scrnum(int scrnum); /* return the current vertical or horizontal blanking state for a screen */ int video_screen_get_vblank(const device_config *screen); @@ -164,7 +161,6 @@ attotime video_screen_get_scan_period(const device_config *screen); /* return the amount of time the beam takes to draw one complete frame */ attotime video_screen_get_frame_period(const device_config *screen); -attotime video_screen_get_frame_period_scrnum(int scrnum); /* return the current frame number -- this is always increasing */ UINT64 video_screen_get_frame_number(const device_config *screen); diff --git a/src/mame/drivers/firebeat.c b/src/mame/drivers/firebeat.c index 4b755b98adc..6a24e333e22 100644 --- a/src/mame/drivers/firebeat.c +++ b/src/mame/drivers/firebeat.c @@ -469,8 +469,12 @@ static int tick = 0; static int layer = 0; static VIDEO_UPDATE(firebeat) { - int chip = scrnum; - //int i; + int chip; + + if (screen == device_list_find_by_index(screen->machine->config->devicelist, VIDEO_SCREEN, 0)) + chip = 0; + else + chip = 1; fillbitmap(bitmap, 0, cliprect); @@ -568,7 +572,7 @@ static UINT32 GCU_r(int chip, UINT32 offset, UINT32 mem_mask) return 0xffffffff; } -static void GCU_w(int chip, UINT32 offset, UINT32 data, UINT32 mem_mask) +static void GCU_w(running_machine *machine, int chip, UINT32 offset, UINT32 data, UINT32 mem_mask) { int reg = offset * 4; @@ -591,22 +595,21 @@ static void GCU_w(int chip, UINT32 offset, UINT32 data, UINT32 mem_mask) COMBINE_DATA( &gcu[chip].visible_area ); if (ACCESSING_LSW32) { - int numscreens = video_screen_count(Machine->config); - int screen = chip; - int width, height; - screen_state *state = &Machine->screen[screen]; - rectangle visarea = state->visarea; - - width = (gcu[chip].visible_area & 0xffff); - height = (gcu[chip].visible_area >> 16) & 0xffff; - //set_visible_area(0, width, 0, height); - - visarea.max_x = width-1; - visarea.max_y = height-1; - - // only try and update the screen if the driver says we have one - if (screen < numscreens) - video_screen_configure_scrnum(screen, visarea.max_x + 1, visarea.max_y + 1, &visarea, video_screen_get_frame_period(Machine->primary_screen).attoseconds); + const device_config *screen = device_list_find_by_index(machine->config->devicelist, VIDEO_SCREEN, chip); + + if (screen != NULL) + { + rectangle visarea = *video_screen_get_visible_area(screen); + int width, height; + + width = (gcu[chip].visible_area & 0xffff); + height = (gcu[chip].visible_area >> 16) & 0xffff; + + visarea.max_x = width-1; + visarea.max_y = height-1; + + video_screen_configure(screen, visarea.max_x + 1, visarea.max_y + 1, &visarea, video_screen_get_frame_period(screen).attoseconds); + } } break; } @@ -650,7 +653,7 @@ static READ32_HANDLER(gcu0_r) static WRITE32_HANDLER(gcu0_w) { - GCU_w(0, offset, data, mem_mask); + GCU_w(machine, 0, offset, data, mem_mask); } static READ32_HANDLER(gcu1_r) @@ -660,7 +663,7 @@ static READ32_HANDLER(gcu1_r) static WRITE32_HANDLER(gcu1_w) { - GCU_w(1, offset, data, mem_mask); + GCU_w(machine, 1, offset, data, mem_mask); } /*****************************************************************************/ diff --git a/src/mame/drivers/system18.c b/src/mame/drivers/system18.c index c12fc3fab41..334fadc1255 100644 --- a/src/mame/drivers/system18.c +++ b/src/mame/drivers/system18.c @@ -76,7 +76,6 @@ void fd1094_driver_init(void (*set_decrypted)(UINT8 *)); /* video/segac2.c */ extern void update_system18_vdp( bitmap_t *bitmap, const rectangle *cliprect ); -extern void start_system18_vdp(void); extern READ16_HANDLER( segac2_vdp_r ); extern WRITE16_HANDLER( segac2_vdp_w ); diff --git a/src/mame/video/genesis.c b/src/mame/video/genesis.c index 595ea050d1f..bf3dee6d107 100644 --- a/src/mame/video/genesis.c +++ b/src/mame/video/genesis.c @@ -15,7 +15,7 @@ VIDEO_START( megaplay_normal ); VIDEO_UPDATE( megaplay_normal ); -static int genesis_screen_number; +static const device_config *genesis_screen; /****************************************************************************** @@ -126,7 +126,7 @@ static UINT8 window_width; /* window width */ ******************************************************************************/ -static void start_genesis_vdp(int screen_number) +static void start_genesis_vdp(const device_config *screen) { static const UINT8 vdp_init[24] = { @@ -136,7 +136,7 @@ static void start_genesis_vdp(int screen_number) }; int i; - genesis_screen_number = screen_number; + genesis_screen = screen; /* allocate memory for the VDP, the lookup table, and the buffer bitmap */ vdp_vram = auto_malloc(VRAM_SIZE); @@ -203,13 +203,13 @@ static void start_genesis_vdp(int screen_number) VIDEO_START(genesis) { - start_genesis_vdp(0); + start_genesis_vdp(machine->primary_screen); } VIDEO_START( segac2 ) { - start_genesis_vdp(0); + start_genesis_vdp(machine->primary_screen); /* C2 has separate sprite/background palettes */ genesis_sp_pal_lookup[0] = 0x100; @@ -223,9 +223,9 @@ VIDEO_START( segac2 ) -void start_system18_vdp(void) +void system18_vdp_start(running_machine *machine) { - start_genesis_vdp(0); + start_genesis_vdp(machine->primary_screen); genesis_palette_base = 0x1800; genesis_bg_pal_lookup[0] = genesis_sp_pal_lookup[0] = 0x1800; @@ -295,7 +295,7 @@ VIDEO_UPDATE( megaplay ) return 0; } -void update_system18_vdp( bitmap_t *bitmap, const rectangle *cliprect ) +void system18_vdp_update( bitmap_t *bitmap, const rectangle *cliprect ) { int y; @@ -347,8 +347,8 @@ READ16_HANDLER( genesis_vdp_r ) case 0x06: case 0x07: { - int xpos = video_screen_get_hpos(machine->primary_screen); - int ypos = video_screen_get_vpos(machine->primary_screen); + int xpos = video_screen_get_hpos(genesis_screen); + int ypos = video_screen_get_vpos(genesis_screen); /* adjust for the weird counting rules */ if (xpos > 0xe9) xpos -= (342 - 0x100); @@ -666,13 +666,13 @@ static void vdp_register_w(int data, int vblank) break; } { - screen_state *state = &Machine->screen[genesis_screen_number]; - rectangle visarea = state->visarea; - attoseconds_t refresh = video_screen_get_frame_period_scrnum(genesis_screen_number).attoseconds; + int height = video_screen_get_height(genesis_screen); + rectangle visarea = *video_screen_get_visible_area(genesis_screen); + attoseconds_t refresh = video_screen_get_frame_period(genesis_screen).attoseconds; /* this gets called from the init! */ visarea.max_x = scrwidth*8-1; - video_screen_configure_scrnum(genesis_screen_number, scrwidth*8, state->height, &visarea, refresh); + video_screen_configure(genesis_screen, scrwidth*8, height, &visarea, refresh); } break; diff --git a/src/mame/video/segas18.c b/src/mame/video/segas18.c index 7d154325079..7e33aac5163 100644 --- a/src/mame/video/segas18.c +++ b/src/mame/video/segas18.c @@ -41,8 +41,8 @@ static UINT8 vdp_mixing; * *************************************/ -extern void start_system18_vdp(void); -extern void update_system18_vdp(bitmap_t *bitmap, const rectangle *cliprect); +void system18_vdp_start(running_machine *machine); +void system18_vdp_update(bitmap_t *bitmap, const rectangle *cliprect); @@ -64,7 +64,7 @@ VIDEO_START( system18 ) segaic16_sprites_init(0, SEGAIC16_SPRITES_16B, 0x400, 0); /* create the VDP */ - start_system18_vdp(); + system18_vdp_start(machine); /* create a temp bitmap to draw the VDP data into */ tempbitmap = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, BITMAP_FORMAT_INDEXED16); @@ -213,7 +213,7 @@ VIDEO_UPDATE( system18 ) /* if the VDP is enabled, update our tempbitmap */ if (vdp_enable) - update_system18_vdp(tempbitmap, cliprect); + system18_vdp_update(tempbitmap, cliprect); /* reset priorities */ fillbitmap(priority_bitmap, 0, cliprect); diff --git a/src/mame/video/system16.c b/src/mame/video/system16.c index b1284d37715..d41ed861f4a 100644 --- a/src/mame/video/system16.c +++ b/src/mame/video/system16.c @@ -94,11 +94,11 @@ type1 type0 function #include "video/resnet.h" /* video/segac2.c */ -extern void update_system18_vdp( bitmap_t *bitmap, const rectangle *cliprect ); -extern void start_system18_vdp(void); -extern READ16_HANDLER( segac2_vdp_r ); -extern WRITE16_HANDLER( segac2_vdp_w ); -static UINT16 sys18_ddcrew_bankregs[0x20]; +void system18_vdp_update( bitmap_t *bitmap, const rectangle *cliprect ); +void system18_vdp_start(running_machine *machine); +READ16_HANDLER( segac2_vdp_r ); +WRITE16_HANDLER( segac2_vdp_w ); +UINT16 sys18_ddcrew_bankregs[0x20]; @@ -864,7 +864,7 @@ VIDEO_START( system18old ){ sys16_bg1_trans=1; - start_system18_vdp(); + system18_vdp_start(machine); /* clear these registers to -1 so that writes of 0 get picked up */ for (i=0;i<0x20;i++) @@ -1118,7 +1118,7 @@ VIDEO_UPDATE( system18old ){ tilemap_draw( bitmap,cliprect, background, TILEMAP_DRAW_OPAQUE | 1, 0 ); //?? tilemap_draw( bitmap,cliprect, background, TILEMAP_DRAW_OPAQUE | 2, 0 ); //?? - if (!strcmp(screen->machine->gamedrv->name,"astorm")) update_system18_vdp(bitmap,cliprect); // kludge: render vdp here for astorm + if (!strcmp(screen->machine->gamedrv->name,"astorm")) system18_vdp_update(bitmap,cliprect); // kludge: render vdp here for astorm /* ASTORM also draws some sprites with the vdp, needs to be higher priority..*/ // sprite_draw(sprite_list,3); @@ -1133,15 +1133,15 @@ VIDEO_UPDATE( system18old ){ if(sys18_fg2_active) tilemap_draw( bitmap,cliprect, foreground2, 1, 0x7 ); tilemap_draw( bitmap,cliprect, foreground, 1, 0x7 ); - if (!strcmp(screen->machine->gamedrv->name,"ddcrew")) update_system18_vdp(bitmap,cliprect); // kludge: render vdp here for ddcrew + if (!strcmp(screen->machine->gamedrv->name,"ddcrew")) system18_vdp_update(bitmap,cliprect); // kludge: render vdp here for ddcrew tilemap_draw( bitmap,cliprect, text_layer, 1, 0x7 ); // sprite_draw(sprite_list,0); tilemap_draw( bitmap,cliprect, text_layer, 0, 0xf ); - if (!strcmp(screen->machine->gamedrv->name,"cltchitr")) update_system18_vdp(bitmap,cliprect); // kludge: render vdp here for clthitr, draws the ball in game! - if (!strcmp(screen->machine->gamedrv->name,"cltchtrj")) update_system18_vdp(bitmap,cliprect); // kludge: render vdp here for clthitr, draws the ball in game! -// if (!strcmp(screen->machine->gamedrv->name,"astorm")) update_system18_vdp(bitmap,cliprect); // kludge: render vdp here for astorm + if (!strcmp(screen->machine->gamedrv->name,"cltchitr")) system18_vdp_update(bitmap,cliprect); // kludge: render vdp here for clthitr, draws the ball in game! + if (!strcmp(screen->machine->gamedrv->name,"cltchtrj")) system18_vdp_update(bitmap,cliprect); // kludge: render vdp here for clthitr, draws the ball in game! +// if (!strcmp(screen->machine->gamedrv->name,"astorm")) system18_vdp_update(bitmap,cliprect); // kludge: render vdp here for astorm draw_sprites(screen->machine, bitmap,cliprect, 0 ); return 0; |
