コード例 #1
0
static SCREEN_UPDATE(magicard)
{
	magicard_state *state = screen->machine().driver_data<magicard_state>();
	int x,y;
	UINT32 count;

	bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine())); //TODO

	if(!(SCC_DE_VREG)) //display enable
		return 0;

	count = ((SCC_VSR_VREG)/2);

	if(SCC_FG_VREG) //4bpp gfx
	{
		for(y=0;y<300;y++)
		{
			for(x=0;x<84;x++)
			{
				UINT32 color;

				color = ((state->m_magicram[count]) & 0x000f)>>0;

				if(((x*4)+3)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y)
					*BITMAP_ADDR32(bitmap, y, (x*4)+3) = screen->machine().pens[color];

				color = ((state->m_magicram[count]) & 0x00f0)>>4;

				if(((x*4)+2)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y)
					*BITMAP_ADDR32(bitmap, y, (x*4)+2) = screen->machine().pens[color];

				color = ((state->m_magicram[count]) & 0x0f00)>>8;

				if(((x*4)+1)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y)
					*BITMAP_ADDR32(bitmap, y, (x*4)+1) = screen->machine().pens[color];

				color = ((state->m_magicram[count]) & 0xf000)>>12;

				if(((x*4)+0)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y)
					*BITMAP_ADDR32(bitmap, y, (x*4)+0) = screen->machine().pens[color];

				count++;
			}
		}
	}
	else //8bpp gfx
	{
		for(y=0;y<300;y++)
コード例 #2
0
ファイル: m79amb.c プロジェクト: esn3s/mame-rr
static SCREEN_UPDATE( ramtek )
{
	m79amb_state *state = screen->machine().driver_data<m79amb_state>();
	offs_t offs;

	for (offs = 0; offs < 0x2000; offs++)
	{
		int i;

		UINT8 data = state->m_videoram[offs];
		int y = offs >> 5;
		int x = (offs & 0x1f) << 3;

		for (i = 0; i < 8; i++)
		{
			pen_t pen = (data & 0x80) ? RGB_WHITE : RGB_BLACK;
			*BITMAP_ADDR32(bitmap, y, x) = pen;

			x++;
			data <<= 1;
		}
	}

	return 0;
}
コード例 #3
0
ファイル: calchase.c プロジェクト: AltimorTASDK/shmupmametgm
static VIDEO_UPDATE(calchase)
{
	int x,y,count,i;

	bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine));

	count = (0);

	for(y=0;y<256;y++)
	{
		for(x=0;x<320;x+=32)
		{
			for (i=0;i<32;i++)
			{
				UINT32 color;

				color = (vga_vram[count])>>(32-i) & 0x1;

				if((x+i)<video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y)
					*BITMAP_ADDR32(bitmap, y, x+(32-i)) = screen->machine->pens[color];

			}

			count++;
		}
	}

	return 0;
}
コード例 #4
0
ファイル: sliver.c プロジェクト: broftkd/historic-mame
static void plot_pixel_pal(int x, int y, int addr)
{
	UINT32 r,g,b;
	UINT16 color;
	if(y<0 ||x<0 || x>383 || y> 255) return;
	addr*=3;

	b=colorram[addr]<<2;
	g=colorram[addr+1]<<2;
	r=colorram[addr+2]<<2;

	if (sliver_bitmap_fg->bpp == 32)
	{

		*BITMAP_ADDR32(sliver_bitmap_fg, y, x) = r | (g<<8) | (b<<16);
	}
	else
	{
		r>>=3;
		g>>=3;
		b>>=3;
		color = r|(g<<5)|(b<<10);
		*BITMAP_ADDR16(sliver_bitmap_fg, y, x) = color;
	}
}
コード例 #5
0
ファイル: beaminv.c プロジェクト: esn3s/mame-rr
static SCREEN_UPDATE( beaminv )
{
	beaminv_state *state = screen->machine().driver_data<beaminv_state>();
	offs_t offs;

	for (offs = 0; offs < state->m_videoram_size; offs++)
	{
		int i;

		UINT8 y = offs;
		UINT8 x = offs >> 8 << 3;
		UINT8 data = state->m_videoram[offs];

		for (i = 0; i < 8; i++)
		{
			pen_t pen = (data & 0x01) ? RGB_WHITE : RGB_BLACK;
			*BITMAP_ADDR32(bitmap, y, x) = pen;

			data = data >> 1;
			x = x + 1;
		}
	}

	return 0;
}
コード例 #6
0
static SCREEN_UPDATE( minivadr )
{
	minivadr_state *state = screen->machine().driver_data<minivadr_state>();
	offs_t offs;

	for (offs = 0; offs < state->m_videoram_size; offs++)
	{
		int i;

		UINT8 x = offs << 3;
		int y = offs >> 5;
		UINT8 data = state->m_videoram[offs];

		for (i = 0; i < 8; i++)
		{
			pen_t pen = (data & 0x80) ? RGB_WHITE : RGB_BLACK;
			*BITMAP_ADDR32(bitmap, y, x) = pen;

			data = data << 1;
			x = x + 1;
		}
	}

	return 0;
}
コード例 #7
0
ファイル: m20.c プロジェクト: cdenix/psmame
static SCREEN_UPDATE( m20 )
{
	m20_state *state = screen->machine().driver_data<m20_state>();
	int x,y,i;
	UINT8 pen;
	UINT32 count;

	bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine()));

	count = (0);

	for(y=0;y<256;y++)
	{
		for(x=0;x<256;x+=16)
		{
			for (i = 0; i < 16; i++)
			{
				pen = (state->m_vram[count]) >> (15 - i) & 1;

				if ((x + i) <= screen->visible_area().max_x && (y + 0) < screen->visible_area().max_y)
					*BITMAP_ADDR32(bitmap, y, x + i) = screen->machine().pens[pen];
			}

			count++;
		}
	}
    return 0;
}
コード例 #8
0
static VIDEO_UPDATE( atarisy4 )
{
	int y;
	UINT32 offset = 0;

	if (gpu.bcrw & 0x80)
	{
		offset = 0;
	}
	else if (gpu.bcrx & 0x80)
	{
		offset = 0x10 << 5;
	}

	//UINT32 offset = gpu.dpr << 5;

	for (y = cliprect->min_y; y <= cliprect->max_y; ++y)
	{
		UINT16 *src = &screen_ram[(offset + (4096 * y)) / 2];
		UINT32 *dest = BITMAP_ADDR32(bitmap, y, cliprect->min_x);
		int x;

		for (x = cliprect->min_x; x < cliprect->max_x; x += 2)
		{
			UINT16 data = *src++;

			*dest++ = screen->machine->pens[data & 0xff];
			*dest++ = screen->machine->pens[data >> 8];
		}
	}
	return 0;
}
コード例 #9
0
ファイル: avalnche.c プロジェクト: AltimorTASDK/shmupmametgm
static VIDEO_UPDATE( avalnche )
{
	avalnche_state *state = (avalnche_state *)screen->machine->driver_data;
	offs_t offs;

	for (offs = 0; offs < state->videoram_size; offs++)
	{
		int i;

		UINT8 x = offs << 3;
		int y = offs >> 5;
		UINT8 data = state->videoram[offs];

		for (i = 0; i < 8; i++)
		{
			pen_t pen;

			if (state->avalance_video_inverted)
				pen = (data & 0x80) ? RGB_WHITE : RGB_BLACK;
			else
				pen = (data & 0x80) ? RGB_BLACK : RGB_WHITE;

			*BITMAP_ADDR32(bitmap, y, x) = pen;

			data = data << 1;
			x = x + 1;
		}
	}

	return 0;
}
コード例 #10
0
ファイル: sliver.c プロジェクト: rogerjowett/ClientServerMAME
static void plot_pixel_pal(running_machine &machine, int x, int y, int addr)
{
	sliver_state *state = machine.driver_data<sliver_state>();
	UINT32 r,g,b;
	UINT16 color;

	if (y < 0 || x < 0 || x > 383 || y > 255)
		return;

	addr*=3;

	b=state->m_colorram[addr] << 2;
	g=state->m_colorram[addr+1] << 2;
	r=state->m_colorram[addr+2] << 2;

	if (state->m_bitmap_fg->bpp == 32)
	{

		*BITMAP_ADDR32(state->m_bitmap_fg, y, x) = r | (g<<8) | (b<<16);
	}
	else
	{
		r>>=3;
		g>>=3;
		b>>=3;
		color = r|(g<<5)|(b<<10);
		*BITMAP_ADDR16(state->m_bitmap_fg, y, x) = color;
	}
}
コード例 #11
0
/* this is needed as this driver doesn't emulate the shift register like mw8080bw does */
static void clear_extra_columns( running_machine *machine, bitmap_t *bitmap, pen_t *pens, UINT8 color )
{
	mw8080bw_state *state = machine->driver_data<mw8080bw_state>();
	UINT8 x;

	for (x = 0; x < 4; x++)
	{
		UINT8 y;

		for (y = MW8080BW_VCOUNTER_START_NO_VBLANK; y != 0; y++)
		{
			if (state->c8080bw_flip_screen)
				*BITMAP_ADDR32(bitmap, MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - (256 + x)) = pens[color];
			else
				*BITMAP_ADDR32(bitmap, y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + x) = pens[color];
		}
	}
}
コード例 #12
0
ファイル: bingor.c プロジェクト: rogerjowett/ClientServerMAME
static SCREEN_UPDATE(bingor)
{
	bingor_state *state = screen->machine().driver_data<bingor_state>();
	int x,y,count;

	bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine()));

	count = (0x2000/2);

	for(y=0;y<256;y++)
	{
		for(x=0;x<286;x+=4)
		{
			UINT32 color;

			color = (state->m_blit_ram[count] & 0xf000)>>12;

			if((x+3)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y)
				*BITMAP_ADDR32(bitmap, y, x+3) = screen->machine().pens[color];

			color = (state->m_blit_ram[count] & 0x0f00)>>8;

			if((x+2)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y)
				*BITMAP_ADDR32(bitmap, y, x+2) = screen->machine().pens[color];

			color = (state->m_blit_ram[count] & 0x00f0)>>4;

			if((x+1)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y)
				*BITMAP_ADDR32(bitmap, y, x+1) = screen->machine().pens[color];

			color = (state->m_blit_ram[count] & 0x000f)>>0;

			if((x+0)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y)
				*BITMAP_ADDR32(bitmap, y, x+0) = screen->machine().pens[color];

			count++;
		}
	}

	return 0;
}
コード例 #13
0
ファイル: bingor.c プロジェクト: nitrologic/emu
static VIDEO_UPDATE(bingor)
{
	int x,y,count;

	bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine));

	count = (0x2000/2);

	for(y=0;y<256;y++)
	{
		for(x=0;x<286;x+=4)
		{
			UINT32 color;

			color = (blit_ram[count] & 0xf000)>>12;

			if((x+3)<video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y)
				*BITMAP_ADDR32(bitmap, y, x+3) = screen->machine->pens[color];

			color = (blit_ram[count] & 0x0f00)>>8;

			if((x+2)<video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y)
				*BITMAP_ADDR32(bitmap, y, x+2) = screen->machine->pens[color];

			color = (blit_ram[count] & 0x00f0)>>4;

			if((x+1)<video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y)
				*BITMAP_ADDR32(bitmap, y, x+1) = screen->machine->pens[color];

			color = (blit_ram[count] & 0x000f)>>0;

			if((x+0)<video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y)
				*BITMAP_ADDR32(bitmap, y, x+0) = screen->machine->pens[color];

			count++;
		}
	}

	return 0;
}
コード例 #14
0
static MC6845_UPDATE_ROW( update_row )
{
	int extra_video_bank_bit = 0; // not used?
	int lscnblk = 0; // not used?


	UINT8 cx;
	pen_t *pens = (pen_t *)param;
	UINT8 *gfx[2];
	UINT16 x = 0;
	int rlen;

	gfx[0] = device->machine->region("gfx1")->base();
	gfx[1] = device->machine->region("gfx2")->base();
	rlen = device->machine->region("gfx2")->bytes();

	//ma = ma ^ 0x7ff;
	for (cx = 0; cx < x_count; cx++)
	{
		int i;
		int attr = ram_attr[ma & 0x7ff];
		int region = (attr & 0x40) >> 6;
		int addr = ((ram_video[ma & 0x7ff] | ((attr & 0x80) << 1) | (extra_video_bank_bit)) << 4) | (ra & 0x0f);
		int colour = (attr & 0x7f) << 3;
		UINT8	*data;

		addr &= (rlen-1);
		data = gfx[region];

		for (i = 7; i>=0; i--)
		{
			int col = colour;

			col |= (BIT(data[0x0000 | addr],i)<<2);
			if (region==0)
			{
				col |= (BIT(data[rlen | addr],i)<<1);
				col |= (BIT(data[rlen<<1 | addr],i)<<0);
			}
			else
				col |= 0x03;

			col = ram_palette[col & 0x3ff];
			*BITMAP_ADDR32(bitmap, y, x) = pens[col ? col : (lscnblk ? 8 : 0)];

			x++;
		}
		ma++;
	}
}
コード例 #15
0
ファイル: vcombat.c プロジェクト: poliva/mame-rr
static SCREEN_UPDATE( vcombat )
{
	vcombat_state *state = screen->machine().driver_data<vcombat_state>();
	int y;
	const rgb_t *const pens = tlc34076_get_pens(screen->machine().device("tlc34076"));
	device_t *aux = screen->machine().device("aux");

	UINT16 *m68k_buf = state->m_m68k_framebuffer[(*state->m_framebuffer_ctrl & 0x20) ? 1 : 0];
	UINT16 *i860_buf = state->m_i860_framebuffer[(screen == aux) ? 1 : 0][0];

	/* TODO: It looks like the leftmost chunk of the ground should really be on the right side? */
	/*       But the i860 draws the background correctly, so it may be an original game issue. */
	/*       There's also some garbage in the upper-left corner. Might be related to this 'wraparound'. */
	/*       Or maybe it's related to the 68k's alpha?  It might come from the 68k side of the house.  */

	for (y = cliprect->min_y; y <= cliprect->max_y; ++y)
	{
		int x;
		int src_addr = 256/2 * y;
		const UINT16 *m68k_src = &m68k_buf[src_addr];
		const UINT16 *i860_src = &i860_buf[src_addr];
		UINT32 *dst = BITMAP_ADDR32(bitmap, y, cliprect->min_x);

		for (x = cliprect->min_x; x <= cliprect->max_x; x += 2)
		{
			int i;
			UINT16 m68k_pix = *m68k_src++;
			UINT16 i860_pix = *i860_src++;

			/* Draw two pixels */
			for (i = 0; i < 2; ++i)
			{
				/* Vcombat's screen renders 'flopped' - very likely because VR headset displays may reflect off mirrors.
                Shadfgtr isn't flopped, so it's not a constant feature of the hardware. */

				/* Combine the two layers */
				if ((m68k_pix & 0xff) == 0)
					*dst++ = pens[i860_pix & 0xff];
				else
					*dst++ = pens[m68k_pix & 0xff];

				m68k_pix >>= 8;
				i860_pix >>= 8;
			}
		}
	}

	return 0;
}
コード例 #16
0
ファイル: gpworld.c プロジェクト: broftkd/historic-mame
INLINE void draw_pixel(mame_bitmap *bitmap,const rectangle *cliprect,int x,int y,int color)
{
	if (flip_screen)
	{
		x = bitmap->width - x - 1;
		y = bitmap->height - y - 1;
	}

	if (x < cliprect->min_x ||
		x > cliprect->max_x ||
		y < cliprect->min_y ||
		y > cliprect->max_y)
		return;

	*BITMAP_ADDR32(bitmap, y, x) = color;
}
コード例 #17
0
ファイル: skeetsht.c プロジェクト: AltimorTASDK/shmupmametgm
static void skeetsht_scanline_update(running_device *screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params)
{
    skeetsht_state *state = (skeetsht_state *)screen->machine->driver_data;
    const rgb_t *const pens = tlc34076_get_pens();
    UINT16 *vram = &state->tms_vram[(params->rowaddr << 8) & 0x3ff00];
    UINT32 *dest = BITMAP_ADDR32(bitmap, scanline, 0);
    int coladdr = params->coladdr;
    int x;

    for (x = params->heblnk; x < params->hsblnk; x += 2)
    {
        UINT16 pixels = vram[coladdr++ & 0xff];
        dest[x + 0] = pens[pixels & 0xff];
        dest[x + 1] = pens[pixels >> 8];
    }
}
コード例 #18
0
ファイル: gameplan.c プロジェクト: kkalmaz/psmame
static SCREEN_UPDATE( leprechn )
{
	gameplan_state *state = screen->machine().driver_data<gameplan_state>();
	pen_t pens[LEPRECHN_NUM_PENS];
	offs_t offs;

	leprechn_get_pens(pens);

	for (offs = 0; offs < state->m_videoram_size; offs++)
	{
		UINT8 y = offs >> 8;
		UINT8 x = offs & 0xff;

		*BITMAP_ADDR32(bitmap, y, x) = pens[state->m_videoram[offs]];
	}

	return 0;
}
コード例 #19
0
bitmap_t *sdl_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, INT32 &width, INT32 &xoffs, INT32 &yoffs)
{
	TTF_Font *ttffont;
	bitmap_t *bitmap = (bitmap_t *)NULL;
	SDL_Surface *drawsurf;
	SDL_Color fcol = { 0xff, 0xff, 0xff };
	UINT16 ustr[16];

	ttffont = (TTF_Font *)font;

	memset(ustr,0,sizeof(ustr));
	ustr[0] = (UINT16)chnum;
	drawsurf = TTF_RenderUNICODE_Solid(ttffont, ustr, fcol);

	// was nothing returned?
	if (drawsurf)
	{
		// allocate a MAME destination bitmap
		bitmap = auto_alloc(machine(), bitmap_t(drawsurf->w, drawsurf->h, BITMAP_FORMAT_ARGB32));

		// copy the rendered character image into it
		for (int y = 0; y < bitmap->height; y++)
		{
			UINT32 *dstrow = BITMAP_ADDR32(bitmap, y, 0);
			UINT8 *srcrow = (UINT8 *)drawsurf->pixels;

			srcrow += (y * drawsurf->pitch);

			for (int x = 0; x < drawsurf->w; x++)
			{
				dstrow[x] = srcrow[x] ? MAKE_ARGB(0xff,0xff,0xff,0xff) : MAKE_ARGB(0x00,0xff,0xff,0xff);
			}
		}

		// what are these?
		xoffs = yoffs = 0;
		width = drawsurf->w;

		SDL_FreeSurface(drawsurf);
	}

	return bitmap;
}
コード例 #20
0
ファイル: sliver.c プロジェクト: broftkd/historic-mame
static void plot_pixel_rgb(int x, int y, UINT32 r, UINT32 g, UINT32 b)
{
	UINT16 color;

	if(y<0 ||x<0 || x>383 || y> 255) return;

	if (sliver_bitmap_bg->bpp == 32)
	{
		*BITMAP_ADDR32(sliver_bitmap_bg, y, x) = r | (g<<8) | (b<<16);
	}
	else
	{
		r>>=3;
		g>>=3;
		b>>=3;
		color = r|(g<<5)|(b<<10);
		*BITMAP_ADDR16(sliver_bitmap_bg, y, x) = color;
	}
}
コード例 #21
0
ファイル: ssingles.c プロジェクト: DarrenBranford/MAME4iOS
static MC6845_UPDATE_ROW( update_row )
{
	ssingles_state *state = device->machine->driver_data<ssingles_state>();
	int cx,x;
	UINT32 tile_address;
	UINT16 cell,palette;
	UINT8 b0,b1;
	const UINT8 *gfx = memory_region(device->machine, "gfx1");

	for(cx=0;cx<x_count;++cx)
	{
		int address=((ma>>1)+(cx>>1))&0xff;

		cell=state->videoram[address]+(state->colorram[address]<<8);

		tile_address=((cell&0x3ff)<<4)+ra;
		palette=(cell>>10)&0x1c;

		if(cx&1)
		{
			b0=gfx[tile_address+0x0000]; /*  9.bin */
			b1=gfx[tile_address+0x8000]; /* 11.bin */
		}
		else
		{
			b0=gfx[tile_address+0x4000]; /* 10.bin */
			b1=gfx[tile_address+0xc000]; /* 12.bin */
		}

		for(x=7;x>=0;--x)
		{
			*BITMAP_ADDR32(bitmap, y, (cx<<3)|(x)) = state->pens[palette+((b1&1)|((b0&1)<<1))];
			b0>>=1;
			b1>>=1;
		}
	}
}
コード例 #22
0
ファイル: m79amb.c プロジェクト: Paulodx/sdl-mame-wii
static VIDEO_UPDATE( ramtek )
{
	offs_t offs;

	for (offs = 0; offs < 0x2000; offs++)
	{
		int i;

		UINT8 data = ramtek_videoram[offs];
		int y = offs >> 5;
		int x = (offs & 0x1f) << 3;

		for (i = 0; i < 8; i++)
		{
			pen_t pen = (data & 0x80) ? RGB_WHITE : RGB_BLACK;
			*BITMAP_ADDR32(bitmap, y, x) = pen;

			x++;
			data <<= 1;
		}
	}

	return 0;
}
コード例 #23
0
ファイル: rotaryf.c プロジェクト: DarrenBranford/MAME4iOS
static VIDEO_UPDATE( rotaryf )
{
	offs_t offs;

	for (offs = 0; offs < rotaryf_videoram_size; offs++)
	{
		int i;

		UINT8 x = offs << 3;
		int y = offs >> 5;
		UINT8 data = rotaryf_videoram[offs];

		for (i = 0; i < 8; i++)
		{
			pen_t pen = (data & 0x01) ? RGB_WHITE : RGB_BLACK;
			*BITMAP_ADDR32(bitmap, y, x) = pen;

			data = data >> 1;
			x = x + 1;
		}
	}

	return 0;
}
コード例 #24
0
ファイル: nubus_radiustpd.c プロジェクト: poliva/mame-rr
static SCREEN_UPDATE( radiustpd )
{
	UINT32 *scanline;
	int x, y;
	nubus_radiustpd_device *card = downcast<nubus_radiustpd_device *>(screen->owner());
	UINT8 pixels, *vram;

	// first time?  kick off the VBL timer
	if (!card->m_screen)
	{
		card->m_screen = screen;
		card->m_timer->adjust(card->m_screen->time_until_pos(479, 0), 0);
	}

	vram = card->m_vram + 0x200;

	for (y = 0; y < 880; y++)
	{
		scanline = BITMAP_ADDR32(bitmap, y, 0);
		for (x = 0; x < 1152/8; x++)
		{
			pixels = vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))];

			*scanline++ = card->m_palette[((pixels>>7)&0x1)];
			*scanline++ = card->m_palette[((pixels>>6)&0x1)];
			*scanline++ = card->m_palette[((pixels>>5)&0x1)];
			*scanline++ = card->m_palette[((pixels>>4)&0x1)];
			*scanline++ = card->m_palette[((pixels>>3)&0x1)];
			*scanline++ = card->m_palette[((pixels>>2)&0x1)];
			*scanline++ = card->m_palette[((pixels>>1)&0x1)];
			*scanline++ = card->m_palette[(pixels&1)];
		}
	}

	return 0;
}
コード例 #25
0
ファイル: galpani3.c プロジェクト: nitrologic/emu
static VIDEO_UPDATE(galpani3)
{
	int x,y;
	UINT16* src1;
	UINT32* dst;
	UINT16 pixdata1;
	const pen_t *paldata = screen->machine->pens;

	bitmap_fill(bitmap, cliprect, 0x0000);

	{
		int drawy, drawx;
		for (drawy=0;drawy<512;drawy++)
		{
			int srcline1 = (drawy+galpani3_framebuffer1_scrolly+11)&0x1ff;
			int srcline2 = (drawy+galpani3_framebuffer2_scrolly+11)&0x1ff;
			int srcline3 = (drawy+galpani3_framebuffer3_scrolly+11)&0x1ff;

			int priline  = (drawy+galpani3_priority_buffer_scrolly+11)&0x1ff;

			for (drawx=0;drawx<512;drawx++)
			{
				int srcoffs1 = (drawx+galpani3_framebuffer1_scrollx+67)&0x1ff;
				int srcoffs2 = (drawx+galpani3_framebuffer2_scrollx+67)&0x1ff;
				int srcoffs3 = (drawx+galpani3_framebuffer3_scrollx+67)&0x1ff;

				int prioffs  = (drawx+galpani3_priority_buffer_scrollx+66)&0x1ff;

				UINT8 dat1 = galpani3_framebuffer1[(srcline1*0x200)+srcoffs1];
				UINT8 dat2 = galpani3_framebuffer2[(srcline2*0x200)+srcoffs2];
				UINT8 dat3 = galpani3_framebuffer3[(srcline3*0x200)+srcoffs3];

				UINT8 pridat = galpani3_priority_buffer[(priline*0x200)+prioffs];

				UINT32* dst = BITMAP_ADDR32(bitmap, drawy, drawx);



				// this is all wrong
				if (pridat==0x0f) // relates to the area you've drawn over
				{
					if (dat1 && galpani3_framebuffer1_enable)
					{
						dst[0] = paldata[dat1+0x4000];
					}

					if (dat2 && galpani3_framebuffer2_enable)
					{
						dst[0] = paldata[dat2+0x4100];
					}

				}
				else if (pridat==0xcf) // the girl
				{
					dst[0] = paldata[0x4300];
				}
				else
				{
					/* this isn't right, but the registers have something to do with
                       alpha / mixing, and bit 0x8000 of the palette is DEFINITELY alpha
                       enable -- see fading in intro */
					if (dat1 && galpani3_framebuffer1_enable)
					{
						UINT16 pen = dat1+0x4000;
						UINT32 pal = paldata[pen];

						if (gp3_is_alpha_pen(pen))
						{
							int r,g,b;
							r = (pal & 0x00ff0000)>>16;
							g = (pal & 0x0000ff00)>>8;
							b = (pal & 0x000000ff)>>0;

							r = (r * galpani3_framebuffer1_bright2[0]) / 0xff;
							g = (g * galpani3_framebuffer1_bright2[0]) / 0xff;
							b = (b * galpani3_framebuffer1_bright2[0]) / 0xff;

							pal = (r & 0x000000ff)<<16;
							pal |=(g & 0x000000ff)<<8;
							pal |=(b & 0x000000ff)<<0;

							dst[0] = pal;
						}
						else
						{
							dst[0] = pal;
						}
					}

					if (dat2 && galpani3_framebuffer2_enable)
					{
						UINT16 pen = dat2+0x4100;
						UINT32 pal = paldata[pen];

						if (gp3_is_alpha_pen(pen))
						{
							int r,g,b;
							r = (pal & 0x00ff0000)>>16;
							g = (pal & 0x0000ff00)>>8;
							b = (pal & 0x000000ff)>>0;

							r = (r * galpani3_framebuffer2_bright2[0]) / 0xff;
							g = (g * galpani3_framebuffer2_bright2[0]) / 0xff;
							b = (b * galpani3_framebuffer2_bright2[0]) / 0xff;

							pal = (r & 0x000000ff)<<16;
							pal |=(g & 0x000000ff)<<8;
							pal |=(b & 0x000000ff)<<0;

							dst[0] |= pal;
						}
						else
						{
							dst[0] = pal;
						}
					}

					if (dat3 && galpani3_framebuffer3_enable)
					{
						dst[0] = paldata[dat3+0x4200];
					}
				}
コード例 #26
0
ファイル: jalblend.c プロジェクト: AltimorTASDK/shmupmametgm
void jal_blend_drawgfx(bitmap_t *dest_bmp,const rectangle *clip,const gfx_element *gfx,
							UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
							int transparent_color)
{
	if (jal_blend_table == NULL)
	{
		drawgfx_transpen(dest_bmp,clip,gfx,code,color,flipx,flipy,offsx,offsy,transparent_color);
		return;
	}

	/* Start drawing */
	if (gfx)
	{
		const pen_t *pal = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
		const UINT8 *alpha = &jal_blend_table[gfx->color_granularity * (color % gfx->total_colors)];
		const UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements);
		int x_index_base, y_index, sx, sy, ex, ey;
		int xinc, yinc;

		xinc = flipx ? -1 : 1;
		yinc = flipy ? -1 : 1;

		x_index_base = flipx ? gfx->width-1 : 0;
		y_index = flipy ? gfx->height-1 : 0;

		/* start coordinates */
		sx = offsx;
		sy = offsy;

		/* end coordinates */
		ex = sx + gfx->width;
		ey = sy + gfx->height;

		if (clip)
		{
			if (sx < clip->min_x)
			{ /* clip left */
				int pixels = clip->min_x-sx;
				sx += pixels;
				x_index_base += xinc*pixels;
			}
			if (sy < clip->min_y)
			{ /* clip top */
				int pixels = clip->min_y-sy;
				sy += pixels;
				y_index += yinc*pixels;
			}
			/* NS 980211 - fixed incorrect clipping */
			if (ex > clip->max_x+1)
			{ /* clip right */
				ex = clip->max_x+1;
			}
			if (ey > clip->max_y+1)
			{ /* clip bottom */
				ey = clip->max_y+1;
			}
		}

		if (ex > sx)
		{ /* skip if inner loop doesn't draw anything */
			int x, y;

			/* 32-bit destination bitmap */
			if (dest_bmp->bpp == 32)
			{
				/* taken from case 7: TRANSPARENCY_ALPHARANGE */
				for (y = sy; y < ey; y++)
				{
					const UINT8 *source = source_base + y_index*gfx->line_modulo;
					UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0);
					int x_index = x_index_base;
					for (x = sx; x < ex; x++)
					{
						int c = source[x_index];
						if (c != transparent_color)
						{
							if (alpha[c] & 8)
							{
								/* Comp with clamp */
								dest[x] = jal_blend_func(dest[x], pal[c], alpha[c]);
							}
							else
							{
								/* Skip the costly alpha step altogether */
								dest[x] = pal[c];
							}
						}
						x_index += xinc;
					}
					y_index += yinc;
				}
			}

			/* 16-bit destination bitmap */
			else
			{
				/* taken from case 7: TRANSPARENCY_ALPHARANGE */
				for (y = sy; y < ey; y++)
				{
					const UINT8 *source = source_base + y_index*gfx->line_modulo;
					UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0);
					int x_index = x_index_base;
					for (x = sx; x < ex; x++)
					{
						int c = source[x_index];
						if (c != transparent_color)
						{
							if (alpha[c] & 8)
							{
								/* Comp with clamp */
								dest[x] = jal_blend_func(dest[x], pal[c], alpha[c]);
							}
							else
							{
								/* Skip the costly alpha step altogether */
								dest[x] = pal[c];
							}
						}
						x_index += xinc;
					}
					y_index += yinc;
				}
			}
		}
	}
}
コード例 #27
0
ファイル: nyny.c プロジェクト: cdenix/ps3-mame-0125
static MC6845_UPDATE_ROW( update_row )
{
	UINT8 cx;

	pen_t *pens = (pen_t *)param;
	UINT8 x = 0;

	for (cx = 0; cx < x_count; cx++)
	{
		int i;
		UINT8 data1, data2, color1, color2;

		/* the memory is hooked up to the MA, RA lines this way */
		offs_t offs = ((ma << 5) & 0x8000) |
		   			  ((ma << 3) & 0x1f00) |
		   			  ((ra << 5) & 0x00e0) |
		   			  ((ma << 0) & 0x001f);

		if (flipscreen)
			offs = offs ^ 0x9fff;

		data1 = nyny_videoram_1[offs];
		data2 = nyny_videoram_2[offs];
		color1 = nyny_colorram_1[offs] & 0x07;
		color2 = nyny_colorram_2[offs] & 0x07;

		for (i = 0; i < 8; i++)
		{
			UINT8 bit1, bit2, color;

			if (flipscreen)
			{
				bit1 = data1 & 0x80;
				bit2 = data2 & 0x80;

				data1 = data1 << 1;
				data2 = data2 << 1;
			}
			else
			{
				bit1 = data1 & 0x01;
				bit2 = data2 & 0x01;

				data1 = data1 >> 1;
				data2 = data2 >> 1;
			}

			/* plane 1 has priority over plane 2 */
			if (bit1)
				color = color1;
			else
				color = bit2 ? color2 : 0;

			*BITMAP_ADDR32(bitmap, y, x) = pens[color];

			x = x + 1;
		}

		ma = ma + 1;
	}
}
コード例 #28
0
static void mlc_drawgfxzoom(
		bitmap_t *dest_bmp,const rectangle *clip,const gfx_element *gfx,
		UINT32 code1,UINT32 code2, UINT32 color,int flipx,int flipy,int sx,int sy,
		int transparent_color,int use8bpp,
		int scalex, int scaley,int alpha)
{
	rectangle myclip;

	if (!scalex || !scaley) return;

	/*
    scalex and scaley are 16.16 fixed point numbers
    1<<15 : shrink to 50%
    1<<16 : uniform scale
    1<<17 : double to 200%
    */

	/* KW 991012 -- Added code to force clip to bitmap boundary */
	if(clip)
	{
		myclip.min_x = clip->min_x;
		myclip.max_x = clip->max_x;
		myclip.min_y = clip->min_y;
		myclip.max_y = clip->max_y;

		if (myclip.min_x < 0) myclip.min_x = 0;
		if (myclip.max_x >= dest_bmp->width) myclip.max_x = dest_bmp->width-1;
		if (myclip.min_y < 0) myclip.min_y = 0;
		if (myclip.max_y >= dest_bmp->height) myclip.max_y = dest_bmp->height-1;

		clip=&myclip;
	}

	{
		if( gfx )
		{
			const pen_t *pal = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
			const UINT8 *code_base1 = gfx_element_get_data(gfx, code1 % gfx->total_elements);
			const UINT8 *code_base2 = gfx_element_get_data(gfx, code2 % gfx->total_elements);

			int sprite_screen_height = (scaley*gfx->height+(sy&0xffff))>>16;
			int sprite_screen_width = (scalex*gfx->width+(sx&0xffff))>>16;

			sx>>=16;
			sy>>=16;

			if (sprite_screen_width && sprite_screen_height)
			{
				/* compute sprite increment per screen pixel */
				int dx = (gfx->width<<16)/sprite_screen_width;
				int dy = (gfx->height<<16)/sprite_screen_height;

				int ex = sx+sprite_screen_width;
				int ey = sy+sprite_screen_height;

				int x_index_base;
				int y_index;

				if( flipx )
				{
					x_index_base = (sprite_screen_width-1)*dx;
					dx = -dx;
				}
				else
				{
					x_index_base = 0;
				}

				if( flipy )
				{
					y_index = (sprite_screen_height-1)*dy;
					dy = -dy;
				}
				else
				{
					y_index = 0;
				}

				if( clip )
				{
					if( sx < clip->min_x)
					{ /* clip left */
						int pixels = clip->min_x-sx;
						sx += pixels;
						x_index_base += pixels*dx;
					}
					if( sy < clip->min_y )
					{ /* clip top */
						int pixels = clip->min_y-sy;
						sy += pixels;
						y_index += pixels*dy;
					}
					/* NS 980211 - fixed incorrect clipping */
					if( ex > clip->max_x+1 )
					{ /* clip right */
						int pixels = ex-clip->max_x-1;
						ex -= pixels;
					}
					if( ey > clip->max_y+1 )
					{ /* clip bottom */
						int pixels = ey-clip->max_y-1;
						ey -= pixels;
					}
				}

				if( ex>sx )
				{ /* skip if inner loop doesn't draw anything */
					int y;

					/* case 1: no alpha */
					if (alpha == 0xff)
					{
						{
							for( y=sy; y<ey; y++ )
							{
								const UINT8 *source1 = code_base1 + (y_index>>16) * gfx->line_modulo;
								const UINT8 *source2 = code_base2 + (y_index>>16) * gfx->line_modulo;
								UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0);

								int x, x_index = x_index_base;

								for( x=sx; x<ex; x++ )
								{
									int c = source1[x_index>>16];
									if (use8bpp)
										c=(c<<4)|source2[x_index>>16];

									if( c != transparent_color ) dest[x] = pal[c];

									x_index += dx;
								}

								y_index += dy;
							}
						}
					}

					/* case 6: alpha blended */
					else
					{
						{
							for( y=sy; y<ey; y++ )
							{
								const UINT8 *source = code_base1 + (y_index>>16) * gfx->line_modulo;
								UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0);

								int x, x_index = x_index_base;
								for( x=sx; x<ex; x++ )
								{
									int c = source[x_index>>16];
									if( c != transparent_color ) dest[x] = alpha_blend_r32(dest[x], 0, alpha); //pal[c]);
									x_index += dx;
								}

								y_index += dy;
							}
						}
					}
				}
コード例 #29
0
ファイル: regrep.c プロジェクト: DarrenBranford/MAME4iOS
static int compare_screenshots(summary_file *curfile)
{
	bitmap_t *bitmaps[MAX_COMPARES];
	int unique[MAX_COMPARES];
	int numunique = 0;
	int listnum;

	/* iterate over all files and load their bitmaps */
	for (listnum = 0; listnum < list_count; listnum++)
	{
		bitmaps[listnum] = NULL;
		if (curfile->status[listnum] == STATUS_SUCCESS)
		{
			astring *fullname = astring_alloc();
			file_error filerr;
			core_file *file;

			/* get the filename for the image */
			astring_printf(fullname, "%s" PATH_SEPARATOR "snap" PATH_SEPARATOR "%s" PATH_SEPARATOR "final.png", lists[listnum].dir, curfile->name);

			/* open the file */
			filerr = core_fopen(astring_c(fullname), OPEN_FLAG_READ, &file);

			/* if that failed, look in the old location */
			if (filerr != FILERR_NONE)
			{
				/* get the filename for the image */
				astring_printf(fullname, "%s" PATH_SEPARATOR "snap" PATH_SEPARATOR "_%s.png", lists[listnum].dir, curfile->name);

				/* open the file */
				filerr = core_fopen(astring_c(fullname), OPEN_FLAG_READ, &file);
			}

			/* if that worked, load the file */
			if (filerr == FILERR_NONE)
			{
				png_read_bitmap(file, &bitmaps[listnum]);
				core_fclose(file);
			}
			astring_free(fullname);
		}
	}

	/* now find all the different bitmap types */
	for (listnum = 0; listnum < list_count; listnum++)
	{
		curfile->matchbitmap[listnum] = 0xff;
		if (bitmaps[listnum] != NULL)
		{
			bitmap_t *this_bitmap = bitmaps[listnum];
			int compnum;

			/* compare against all unique bitmaps */
			for (compnum = 0; compnum < numunique; compnum++)
			{
				bitmap_t *base_bitmap = bitmaps[unique[compnum]];
				int bitmaps_differ;
				int x, y;

				/* if the sizes are different, we differ; otherwise start off assuming we are the same */
				bitmaps_differ = (this_bitmap->width != base_bitmap->width || this_bitmap->height != base_bitmap->height);

				/* compare scanline by scanline */
				for (y = 0; y < this_bitmap->height && !bitmaps_differ; y++)
				{
					UINT32 *base = BITMAP_ADDR32(base_bitmap, y, 0);
					UINT32 *curr = BITMAP_ADDR32(this_bitmap, y, 0);

					/* scan the scanline */
					for (x = 0; x < this_bitmap->width; x++)
						if (*base++ != *curr++)
							break;
					bitmaps_differ = (x != this_bitmap->width);
				}

				/* if we matched, remember which listnum index we matched, and stop */
				if (!bitmaps_differ)
				{
					curfile->matchbitmap[listnum] = unique[compnum];
					break;
				}

				/* if different from the first unique entry, adjust the status */
				if (bitmaps_differ && compnum == 0)
					curfile->status[listnum] = STATUS_SUCCESS_DIFFERENT;
			}

			/* if we're unique, add ourselves to the list */
			if (compnum >= numunique)
			{
				unique[numunique++] = listnum;
				curfile->matchbitmap[listnum] = listnum;
				continue;
			}
		}
	}

	/* free the bitmaps */
	for (listnum = 0; listnum < list_count; listnum++)
		if (bitmaps[listnum] != NULL)
			bitmap_free(bitmaps[listnum]);

	/* if all screenshots matched, we're good */
	if (numunique == 1)
		return BUCKET_GOOD;

	/* if the last screenshot matched the first unique one, we're good but changed */
	if (curfile->matchbitmap[listnum - 1] == unique[0])
		return BUCKET_GOOD_BUT_CHANGED_SCREENSHOTS;

	/* otherwise we're just changed */
	return BUCKET_CHANGED;
}
コード例 #30
0
ファイル: regrep.c プロジェクト: DarrenBranford/MAME4iOS
static int generate_png_diff(const summary_file *curfile, const astring *destdir, const char *destname)
{
	bitmap_t *bitmaps[MAX_COMPARES] = { NULL };
	astring *srcimgname = astring_alloc();
	astring *dstfilename = astring_alloc();
	astring *tempname = astring_alloc();
	bitmap_t *finalbitmap = NULL;
	int width, height, maxwidth;
	int bitmapcount = 0;
	int listnum, bmnum;
	core_file *file = NULL;
	file_error filerr;
	png_error pngerr;
	int error = -1;
	int starty;

	/* generate the common source filename */
	astring_printf(dstfilename, "%s" PATH_SEPARATOR "%s", astring_c(destdir), destname);
	astring_printf(srcimgname, "snap" PATH_SEPARATOR "%s" PATH_SEPARATOR "final.png", curfile->name);

	/* open and load all unique bitmaps */
	for (listnum = 0; listnum < list_count; listnum++)
		if (curfile->matchbitmap[listnum] == listnum)
		{
			astring_printf(tempname, "%s" PATH_SEPARATOR "%s", lists[listnum].dir, astring_c(srcimgname));

			/* open the source image */
			filerr = core_fopen(astring_c(tempname), OPEN_FLAG_READ, &file);
			if (filerr != FILERR_NONE)
				goto error;

			/* load the source image */
			pngerr = png_read_bitmap(file, &bitmaps[bitmapcount++]);
			core_fclose(file);
			if (pngerr != PNGERR_NONE)
				goto error;
		}

	/* if there's only one unique bitmap, skip it */
	if (bitmapcount <= 1)
		goto error;

	/* determine the size of the final bitmap */
	height = width = 0;
	maxwidth = bitmaps[0]->width;
	for (bmnum = 1; bmnum < bitmapcount; bmnum++)
	{
		int curwidth;

		/* determine the maximal width */
		maxwidth = MAX(maxwidth, bitmaps[bmnum]->width);
		curwidth = bitmaps[0]->width + BITMAP_SPACE + maxwidth + BITMAP_SPACE + maxwidth;
		width = MAX(width, curwidth);

		/* add to the height */
		height += MAX(bitmaps[0]->height, bitmaps[bmnum]->height);
		if (bmnum != 1)
			height += BITMAP_SPACE;
	}

	/* allocate the final bitmap */
	finalbitmap = bitmap_alloc(width, height, BITMAP_FORMAT_ARGB32);
	if (finalbitmap == NULL)
		goto error;

	/* now copy and compare each set of bitmaps */
	starty = 0;
	for (bmnum = 1; bmnum < bitmapcount; bmnum++)
	{
		bitmap_t *bitmap1 = bitmaps[0];
		bitmap_t *bitmap2 = bitmaps[bmnum];
		int curheight = MAX(bitmap1->height, bitmap2->height);
		int x, y;

		/* iterate over rows in these bitmaps */
		for (y = 0; y < curheight; y++)
		{
			UINT32 *src1 = (y < bitmap1->height) ? BITMAP_ADDR32(bitmap1, y, 0) : NULL;
			UINT32 *src2 = (y < bitmap2->height) ? BITMAP_ADDR32(bitmap2, y, 0) : NULL;
			UINT32 *dst1 = BITMAP_ADDR32(finalbitmap, starty + y, 0);
			UINT32 *dst2 = BITMAP_ADDR32(finalbitmap, starty + y, bitmap1->width + BITMAP_SPACE);
			UINT32 *dstdiff = BITMAP_ADDR32(finalbitmap, starty + y, bitmap1->width + BITMAP_SPACE + maxwidth + BITMAP_SPACE);

			/* now iterate over columns */
			for (x = 0; x < maxwidth; x++)
			{
				int pix1 = -1, pix2 = -2;

				if (src1 != NULL && x < bitmap1->width)
					pix1 = dst1[x] = src1[x];
				if (src2 != NULL && x < bitmap2->width)
					pix2 = dst2[x] = src2[x];
				dstdiff[x] = (pix1 != pix2) ? 0xffffffff : 0xff000000;
			}
		}

		/* update the starting Y position */
		starty += BITMAP_SPACE + MAX(bitmap1->height, bitmap2->height);
	}

	/* write the final PNG */
	filerr = core_fopen(astring_c(dstfilename), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file);
	if (filerr != FILERR_NONE)
		goto error;
	pngerr = png_write_bitmap(file, NULL, finalbitmap, 0, NULL);
	core_fclose(file);
	if (pngerr != PNGERR_NONE)
		goto error;

	/* if we get here, we are error free */
	error = 0;

error:
	if (finalbitmap != NULL)
		bitmap_free(finalbitmap);
	for (bmnum = 0; bmnum < bitmapcount; bmnum++)
		if (bitmaps[bmnum] != NULL)
			bitmap_free(bitmaps[bmnum]);
	if (error)
		osd_rmfile(astring_c(dstfilename));
	astring_free(dstfilename);
	astring_free(srcimgname);
	astring_free(tempname);
	return error;
}