コード例 #1
0
ファイル: realbrk.c プロジェクト: broftkd/mess-cvs
static READ16_HANDLER( pkgnshdx_input_r )
{
	UINT16 sel = ~realbrk_dsw_select[0];

	switch(offset)
	{
		case 0x00/2: return 0xffff;
		case 0x02/2: return input_port_0_word_r(0,0);/*Service buttons*/
		/*DSW,same handling as realbrk*/
		case 0x04/2:
			if (sel & 0x01)	return	(input_port_1_word_r(0,0) & 0x00ff) << 8;		// DSW1 low bits
			if (sel & 0x02)	return	(input_port_2_word_r(0,0) & 0x00ff) << 8;		// DSW2 low bits
			if (sel & 0x04)	return	(input_port_3_word_r(0,0) & 0x00ff) << 8;		// DSW3 low bits
			if (sel & 0x08)	return	(input_port_4_word_r(0,0) & 0x00ff) << 8;		// DSW4 low bits

			if (sel & 0x10)	return	((input_port_1_word_r(0,0) & 0x0300) << 0) |	// DSWs high 2 bits
									((input_port_2_word_r(0,0) & 0x0300) << 2) |
									((input_port_3_word_r(0,0) & 0x0300) << 4) |
									((input_port_4_word_r(0,0) & 0x0300) << 6) ;

			return 0xffff;
		case 0x06/2: return input_port_6_word_r(0,0);/*Buttons+Handle 2p*/
		case 0x08/2: return input_port_5_word_r(0,0);/*Buttons+Handle 1p*/
		case 0x0a/2: return 0xffff;
		case 0x0c/2: return 0xffff;
		case 0x0e/2: return 0xffff;
		case 0x10/2: return 0xffff;
		case 0x12/2: return 0xffff;
	}

	return 0xffff;
}
コード例 #2
0
ファイル: opwolf.c プロジェクト: broftkd/historic-mess
static READ16_HANDLER( opwolf_lightgun_r )
{
	int scaled;

	switch (offset)
	{
		case 0x00:	/* P1X - Have to remap 8 bit input value, into 0-319 visible range */
			scaled=(input_port_4_word_r(0,mem_mask) * 320 ) / 256;
			return (scaled + 0x15 + opwolf_gun_xoffs);
		case 0x01:	/* P1Y */
			return (input_port_5_word_r(0,mem_mask) - 0x24 + opwolf_gun_yoffs);
	}

	return 0xff;
}
コード例 #3
0
ファイル: realbrk.c プロジェクト: broftkd/mess-cvs
static READ16_HANDLER( pkgnsh_input_r )
{
	switch(offset)
	{
		case 0x00/2: return 0xffff;
		case 0x02/2: return 0xffff;
		case 0x04/2: return input_port_0_word_r(0,0);/*Service buttons*/
		case 0x06/2: return input_port_1_word_r(0,0);/*DIP 2*/
		case 0x08/2: return input_port_2_word_r(0,0);/*DIP 1*/
		case 0x0a/2: return input_port_3_word_r(0,0);/*DIP 1+2 Hi-Bits*/
		case 0x0c/2: return input_port_4_word_r(0,0);/*Handle 1p*/
		case 0x0e/2: return input_port_5_word_r(0,0);/*Buttons 1p*/
		case 0x10/2: return input_port_6_word_r(0,0);/*Handle 2p*/
		case 0x12/2: return input_port_7_word_r(0,0);/*Buttons 2p*/
	}
	return 0xffff;
}
コード例 #4
0
ファイル: superchs.c プロジェクト: joolswills/advancemame
static READ32_HANDLER( superchs_stick_r )
{
	int fake = input_port_6_word_r(0,0);
	int accel;

	if (!(fake &0x10))	/* Analogue steer (the real control method) */
	{
		steer = input_port_2_word_r(0,0);
	}
	else	/* Digital steer, with smoothing - speed depends on how often stick_r is called */
	{
		int delta;
		int goal = 0x80;
		if (fake &0x04) goal = 0xff;		/* pressing left */
		if (fake &0x08) goal = 0x0;		/* pressing right */

		if (steer!=goal)
		{
			delta = goal - steer;
			if (steer < goal)
			{
				if (delta >2) delta = 2;
			}
			else
			{
				if (delta < (-2)) delta = -2;
			}
			steer += delta;
		}
	}

	/* Accelerator is an analogue input but the game treats it as digital (on/off) */
	if (input_port_6_word_r(0,0) & 0x1)	/* pressing B1 */
		accel = 0x0;
	else
		accel = 0xff;

	/* Todo: Verify brake - and figure out other input */
	return (steer << 24) | (accel << 16) | (input_port_4_word_r(0,0) << 8) | input_port_5_word_r(0,0);
}