/*************************************************************************** Start the video hardware emulation. ***************************************************************************/ int pbaction_vh_start(void) { int i; if (generic_vh_start() != 0) return 1; if ((dirtybuffer2 = malloc(videoram_size)) == 0) { generic_vh_stop(); return 1; } memset(dirtybuffer2,1,videoram_size); if ((tmpbitmap2 = osd_create_bitmap(Machine->drv->screen_width,Machine->drv->screen_height)) == 0) { free(dirtybuffer2); generic_vh_stop(); return 1; } /* leave everything at the default, but map all foreground 0 pens as transparent */ for (i = 0;i < 16;i++) palette_used_colors[8 * i] = PALETTE_COLOR_TRANSPARENT; return 0; }
int circus_vh_start(void) { int start_pen = 2; if (generic_vh_start()!=0) return 1; overlay_create(circus_ol, start_pen, Machine->drv->total_colors-start_pen); return 0; }
int vigilant_vh_start(void) { generic_vh_start(); if ((bg_bitmap = osd_create_bitmap(512*3,256)) == 0) { generic_vh_stop(); return 1; } return 0; }
int gottlieb_vh_start(void) { if (generic_vh_start() != 0) return 1; if ((dirtycharacter = malloc(MAX_CHARS)) == 0) { generic_vh_stop(); return 1; } /* Some games have character gfx data in ROM, some others in RAM. We don't */ /* want to recalculate chars if data is in ROM, so let's start with the array */ /* initialized to 0. */ memset(dirtycharacter,0,MAX_CHARS); return 0; }
int mcr12_vh_start(void) { const struct GfxElement *gfx = Machine->gfx[1]; /* allocate a temporary bitmap for the sprite rendering */ spritebitmap_width = Machine->drv->screen_width + 2 * 32; spritebitmap_height = Machine->drv->screen_height + 2 * 32; spritebitmap = (UINT8*)malloc(spritebitmap_width * spritebitmap_height); if (!spritebitmap) return 1; memset(spritebitmap, 0, spritebitmap_width * spritebitmap_height); /* if we're swapped in X/Y, the sprite data will be swapped */ /* but that's not what we want, so we swap it back here */ if (gfx && (Machine->orientation & ORIENTATION_SWAP_XY)) { UINT8 *base = gfx->gfxdata; int c, x, y; for (c = 0; c < gfx->total_elements; c++) { for (y = 0; y < gfx->height; y++) for (x = y; x < gfx->width; x++) { int temp = base[y * gfx->line_modulo + x]; base[y * gfx->line_modulo + x] = base[x * gfx->line_modulo + y]; base[x * gfx->line_modulo + y] = temp; } base += gfx->char_modulo; } } /* compute tile counts */ xtiles = Machine->drv->screen_width / 16; ytiles = Machine->drv->screen_height / 16; last_cocktail_flip = 0; /* start up the generic system */ if (generic_vh_start()) { free(spritebitmap); spritebitmap = NULL; return 1; } return 0; }
int atarifb_vh_start(void) { if (generic_vh_start()!=0) return 1; alphap1_dirtybuffer = (unsigned char*)malloc(atarifb_alphap1_vram_size); alphap2_dirtybuffer = (unsigned char*)malloc(atarifb_alphap2_vram_size); if ((!alphap1_dirtybuffer) || (!alphap2_dirtybuffer)) { generic_vh_stop(); return 1; } memset(alphap1_dirtybuffer, 1, atarifb_alphap1_vram_size); memset(alphap2_dirtybuffer, 1, atarifb_alphap2_vram_size); memset(dirtybuffer, 1, videoram_size); return 0; }
int exidy_vh_start(void) { exidy_collision_counter = 0; if (generic_vh_start()!=0) return 1; if ((motion_object_1_vid = osd_create_bitmap(16,16)) == 0) { generic_vh_stop(); return 1; } if ((motion_object_2_vid = osd_create_bitmap(16,16)) == 0) { osd_free_bitmap(motion_object_1_vid); generic_vh_stop(); return 1; } return 0; }
int sprint2_vh_start(void) { if (generic_vh_start()!=0) return 1; if ((back_vid = osd_create_bitmap(16,8)) == 0) { generic_vh_stop(); return 1; } if ((grey_cars_vid = osd_create_bitmap(16,8)) == 0) { osd_free_bitmap(back_vid); generic_vh_stop(); return 1; } if ((black_car_vid = osd_create_bitmap(16,8)) == 0) { osd_free_bitmap(back_vid); osd_free_bitmap(grey_cars_vid); generic_vh_stop(); return 1; } if ((white_car_vid = osd_create_bitmap(16,8)) == 0) { osd_free_bitmap(back_vid); osd_free_bitmap(grey_cars_vid); osd_free_bitmap(black_car_vid); generic_vh_stop(); return 1; } return 0; }
/*************************************************************************** Start the video hardware emulation. ***************************************************************************/ int congo_vh_start(void) { int offs; int sx,sy; struct osd_bitmap *prebitmap; if (generic_vh_start() != 0) return 1; /* large bitmap for the precalculated background */ if ((backgroundbitmap = osd_create_bitmap(512,2303+32)) == 0) { generic_vh_stop(); return 1; } /* create a temporary bitmap to prepare the background before converting it */ if ((prebitmap = osd_create_bitmap(4096,256)) == 0) { osd_free_bitmap(backgroundbitmap); generic_vh_stop(); return 1; } /* prepare the background */ for (offs = 0;offs < 0x4000;offs++) { sx = 8 * (511 - offs / 32); sy = 8 * (offs % 32); drawgfx(prebitmap,Machine->gfx[2], Machine->memory_region[2][offs] + 256 * (Machine->memory_region[2][0x4000 + offs] & 3), Machine->memory_region[2][0x4000 + offs] >> 4, 0,0, sx,sy, 0,TRANSPARENCY_NONE,0); } /* the background is stored as a rectangle, but is drawn by the hardware skewed: */ /* go right two pixels, then up one pixel. Doing the conversion at run time would */ /* be extremely expensive, so we do it now. To save memory, we squash the image */ /* horizontally (doing line shifts at run time is much less expensive than doing */ /* column shifts) */ for (offs = -510;offs < 4096;offs += 2) { sy = (2302-510/2) - offs/2; for (sx = 0;sx < 512;sx += 2) { if (offs + sx < 0 || offs + sx >= 4096) { backgroundbitmap->line[sy][sx] = Machine->background_pen; backgroundbitmap->line[sy][sx+1] = Machine->background_pen; } else { backgroundbitmap->line[sy][sx] = prebitmap->line[sx/2][offs + sx]; backgroundbitmap->line[sy][sx+1] = prebitmap->line[sx/2][offs + sx+1]; } } } osd_free_bitmap(prebitmap); /* free the graphics ROMs, they are no longer needed */ free(Machine->memory_region[2]); Machine->memory_region[2] = 0; return 0; }
int mario_vh_start(void) { gfx_bank = 0; return generic_vh_start(); }
int dkong3_vh_start(void) { gfx_bank = 0; return generic_vh_start(); }
/*************************************************************************** Start the video hardware emulation. ***************************************************************************/ int lwings_vh_start(void) { int i; if (generic_vh_start() != 0) return 1; if ((dirtybuffer2 = (unsigned char *)gp2x_malloc(lwings_backgroundram_size)) == 0) { generic_vh_stop(); return 1; } fast_memset(dirtybuffer2,1,lwings_backgroundram_size); if ((dirtybuffer4 = (unsigned char *)gp2x_malloc(lwings_backgroundram_size)) == 0) { generic_vh_stop(); return 1; } fast_memset(dirtybuffer4,1,lwings_backgroundram_size); /* the background area is twice as tall as the screen */ if ((tmpbitmap2 = osd_new_bitmap(2*Machine->drv->screen_width, 2*Machine->drv->screen_height,Machine->scrbitmap->depth)) == 0) { gp2x_free(dirtybuffer2); generic_vh_stop(); return 1; } #define COLORTABLE_START(gfxn,color_code) Machine->drv->gfxdecodeinfo[gfxn].color_codes_start + \ color_code * Machine->gfx[gfxn]->color_granularity #define GFX_COLOR_CODES(gfxn) Machine->gfx[gfxn]->total_colors #define GFX_ELEM_COLORS(gfxn) Machine->gfx[gfxn]->color_granularity fast_memset(palette_used_colors,PALETTE_COLOR_UNUSED,Machine->drv->total_colors * sizeof(unsigned char)); /* chars */ for (i = 0;i < GFX_COLOR_CODES(0);i++) { fast_memset(&palette_used_colors[COLORTABLE_START(0,i)], PALETTE_COLOR_USED, GFX_ELEM_COLORS(0)); palette_used_colors[COLORTABLE_START(0,i) + GFX_ELEM_COLORS(0)-1] = PALETTE_COLOR_TRANSPARENT; } /* bg tiles */ for (i = 0;i < GFX_COLOR_CODES(1);i++) { fast_memset(&palette_used_colors[COLORTABLE_START(1,i)], PALETTE_COLOR_USED, GFX_ELEM_COLORS(1)); } /* sprites */ for (i = 0;i < GFX_COLOR_CODES(2);i++) { fast_memset(&palette_used_colors[COLORTABLE_START(2,i)], PALETTE_COLOR_USED, GFX_ELEM_COLORS(2)); } return 0; }
/*************************************************************************** Start the video hardware emulation. ***************************************************************************/ int superqix_vh_start(void) { if (generic_vh_start() != 0) return 1; /* palette RAM is accessed thorough I/O ports, so we have to */ /* allocate it ourselves */ if ((paletteram = (unsigned char*)malloc(256 * sizeof(unsigned char))) == 0) { generic_vh_stop(); return 1; } if ((superqix_bitmapram = (unsigned char*)malloc(0x7000 * sizeof(unsigned char))) == 0) { free(paletteram); generic_vh_stop(); return 1; } if ((superqix_bitmapram2 = (unsigned char*)malloc(0x7000 * sizeof(unsigned char))) == 0) { free(superqix_bitmapram); free(paletteram); generic_vh_stop(); return 1; } if ((superqix_bitmapram_dirty = (unsigned char*)malloc(0x7000 * sizeof(unsigned char))) == 0) { free(superqix_bitmapram2); free(superqix_bitmapram); free(paletteram); generic_vh_stop(); return 1; } memset(superqix_bitmapram_dirty,1,0x7000); if ((superqix_bitmapram2_dirty = (unsigned char*)malloc(0x7000 * sizeof(unsigned char))) == 0) { free(superqix_bitmapram_dirty); free(superqix_bitmapram2); free(superqix_bitmapram); free(paletteram); generic_vh_stop(); return 1; } memset(superqix_bitmapram2_dirty,1,0x7000); if ((tmpbitmap2 = bitmap_alloc(256, 256)) == 0) { free(superqix_bitmapram2_dirty); free(superqix_bitmapram_dirty); free(superqix_bitmapram2); free(superqix_bitmapram); free(paletteram); generic_vh_stop(); return 1; } sqix_minx=0;sqix_maxx=127;sqix_miny=0;sqix_maxy=223; sqix_last_bitmap=0; return 0; }
int flstory_vh_start(void) { paletteram = (unsigned char*)malloc(0x200); paletteram_2 = (unsigned char*)malloc(0x200); return generic_vh_start(); }