Exemple #1
0
static WRITE8_HANDLER( gun_in0_w )
{
	static int zapstore;

	if (vsnes_do_vrom_bank)
	{
		/* switch vrom */
		ppu2c0x_set_videorom_bank( 0, 0, 8, ( data & 4 ) ? 1 : 0, 512 );
	}

	/* here we do things a little different */
	if ( data & 1 )
	{

		/* load up the latches */
		input_latch[0] = input_port_read_indexed(machine,  0 );

		/* do the gun thing */
		if ( vsnes_gun_controller )
		{
			int x = input_port_read_indexed(machine,  4 );
			int y = input_port_read_indexed(machine,  5 );
			UINT32 pix, color_base;

			/* get the pixel at the gun position */
			pix = ppu2c0x_get_pixel( 0, x, y );

			/* get the color base from the ppu */
			color_base = ppu2c0x_get_colorbase( 0 );

			/* look at the screen and see if the cursor is over a bright pixel */
			if ( ( pix == color_base+0x20 ) || ( pix == color_base+0x30 ) ||
				 ( pix == color_base+0x33 ) || ( pix == color_base+0x34 ) )
			{
				input_latch[0] |= 0x40;
			}
		}

		input_latch[1] = input_port_read_indexed(machine,  1 );
	}

    if ( ( zapstore & 1 ) && ( !( data & 1 ) ) )
	/* reset sound_fix to keep sound from hanging */
    {
		sound_fix = 0;
	}

    zapstore = data;
}
Exemple #2
0
static WRITE8_HANDLER( gun_in0_w )
{
	device_t *ppu1 = space->machine->device("ppu1");
	static int zapstore;

	if (vsnes_do_vrom_bank)
	{
		/* switch vrom */
		v_set_videorom_bank(space->machine, 0, 8, (data & 4) ? 8 : 0);
	}

	/* here we do things a little different */
	if (data & 1)
	{

		/* load up the latches */
		input_latch[0] = input_port_read(space->machine, "IN0");

		/* do the gun thing */
		int x = input_port_read(space->machine, "GUNX");
		int y = input_port_read(space->machine, "GUNY");
		UINT32 pix, color_base;

		/* get the pixel at the gun position */
		pix = ppu2c0x_get_pixel(ppu1, x, y);

		/* get the color base from the ppu */
		color_base = ppu2c0x_get_colorbase(ppu1);

		/* look at the screen and see if the cursor is over a bright pixel */
		if ((pix == color_base + 0x20 ) || (pix == color_base + 0x30) ||
			(pix == color_base + 0x33 ) || (pix == color_base + 0x34))
		{
			input_latch[0] |= 0x40;
		}

		input_latch[1] = input_port_read(space->machine, "IN1");
	}

    if ((zapstore & 1) && (!(data & 1)))
	/* reset sound_fix to keep sound from hanging */
    {
		sound_fix = 0;
	}

    zapstore = data;
}