예제 #1
0
void do_keypad()
{
	static int pausecnt = 0;
	unsigned int joy = sdl_input_read();
	int bVert = BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL;

	FBA_KEYPAD[0] = 0;
	FBA_KEYPAD[1] = 0;
	FBA_KEYPAD[2] = 0;
	FBA_KEYPAD[3] = 0;
	ServiceRequest = 0;
	P1P2Start = 0;

	if (joy & BUTTON_UP) FBA_KEYPAD[0] |= bVert ? 0x0004 : 0x0001;
	if (joy & BUTTON_DOWN) FBA_KEYPAD[0] |= bVert ? 0x0008 : 0x0002;
	if (joy & BUTTON_LEFT) FBA_KEYPAD[0] |= bVert ? 0x0002 : 0x0004;
	if (joy & BUTTON_RIGHT) FBA_KEYPAD[0] |= bVert ? 0x0001 : 0x0008;

	if (joy & BUTTON_SELECT) FBA_KEYPAD[0] |= 0x0010;
	if (joy & BUTTON_START) FBA_KEYPAD[0] |= 0x0020;

	if (joy & BUTTON_A) FBA_KEYPAD[0] |= 0x0040;		// A
	if (joy & BUTTON_B) FBA_KEYPAD[0] |= 0x0080;		// B
	if (joy & BUTTON_X) FBA_KEYPAD[0] |= 0x0100;		// C
	if (joy & BUTTON_Y) FBA_KEYPAD[0] |= 0x0200;		// D
	if (joy & BUTTON_SL) FBA_KEYPAD[0] |= 0x0400;	// E
	if (joy & BUTTON_SR) FBA_KEYPAD[0] |= 0x0800;	// F

	if (joy & BUTTON_QT) GameLooping=false;
	if (pausecnt > 0) pausecnt--;
	if ((joy & BUTTON_PAUSE) && (pausecnt==0))
	{
		bPauseOn=!bPauseOn;
		pausecnt=20;
		if (config_options.option_sound_enable == 2) SDL_PauseAudio(bPauseOn);
	}

	if ((joy & BUTTON_SL) && (joy & BUTTON_SR)) {
		if (joy & BUTTON_Y) ChangeFrameskip();
		else if (joy & BUTTON_START) GameLooping = false;
		else if (joy & BUTTON_SELECT) ServiceRequest = 1;
	}
	else if ((joy & BUTTON_START) && (joy & BUTTON_SELECT)) P1P2Start = 1; // put enter GUI here later
}
예제 #2
0
void do_keypad()
{
	int bVert = !options.rotate && (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL);

	FBA_KEYPAD[0] = 0;
	FBA_KEYPAD[1] = 0;
	FBA_KEYPAD[2] = 0;
	FBA_KEYPAD[3] = 0;
	ServiceRequest = 0;
	P1P2Start = 0;

	sdl_input_read(false);
	for (int it = 0; it < autofire_count; it++) {
		if (autofire_state[it].state == 0 && (keypc & autofire_state[it].keypc)) {
			autofire_state[it].state = 1;
		}
		if (autofire_state[it].state != 0 && !(keypc & autofire_state[it].keypc)) {
			autofire_state[it].state = 0;
		}
	}
	sdl_input_read(true);

	// process redefinable keypresses
	if (keypad & KEYPAD_UP) FBA_KEYPAD[0] |= bVert ? KEYPAD_LEFT : KEYPAD_UP;
	if (keypad & KEYPAD_DOWN) FBA_KEYPAD[0] |= bVert ? KEYPAD_RIGHT : KEYPAD_DOWN;
	if (keypad & KEYPAD_LEFT) FBA_KEYPAD[0] |= bVert ? KEYPAD_DOWN : KEYPAD_LEFT;
	if (keypad & KEYPAD_RIGHT) FBA_KEYPAD[0] |= bVert ? KEYPAD_UP : KEYPAD_RIGHT;

	if (keypad & KEYPAD_COIN) FBA_KEYPAD[0] |= KEYPAD_COIN;
	if (keypad & KEYPAD_START) FBA_KEYPAD[0] |= KEYPAD_START;

	if (keypad & KEYPAD_FIRE1) FBA_KEYPAD[0] |= KEYPAD_FIRE1;		// A
	if (keypad & KEYPAD_FIRE2) FBA_KEYPAD[0] |= KEYPAD_FIRE2;		// B
	if (keypad & KEYPAD_FIRE3) FBA_KEYPAD[0] |= KEYPAD_FIRE3;		// X
	if (keypad & KEYPAD_FIRE4) FBA_KEYPAD[0] |= KEYPAD_FIRE4;		// Y
	if (keypad & KEYPAD_FIRE5) FBA_KEYPAD[0] |= KEYPAD_FIRE5;		// L
	if (keypad & KEYPAD_FIRE6) FBA_KEYPAD[0] |= KEYPAD_FIRE6;		// R

	// process non-redefinable keypresses
	if (keypc & BUTTON_QT) {
		GameLooping = false;
		keypc = keypad = 0;
	}

	if (keypc & BUTTON_MENU) {
		keypc = keypad = 0;
		SndPause(1);
		gui_Run();
		SndPause(0);
	}

	if (keypc & BUTTON_PAUSE) {
		bPauseOn = !bPauseOn;
		SndPause(bPauseOn);
		keypc &= ~BUTTON_PAUSE;
	}

	if(!bPauseOn) { // savestate fails inside pause
		if (keypc & BUTTON_QSAVE) {
			StatedSave(nSavestateSlot);
			keypc &= ~BUTTON_QSAVE;
		}

		if (keypc & BUTTON_QLOAD) {
			StatedLoad(nSavestateSlot);
			keypc &= ~BUTTON_QLOAD;
			bPauseOn = 0;
		}
	}
	if ((keypc & BUTTON_SL) && (keypc & BUTTON_SR)) {
		if (keypc & BUTTON_Y) { 
			ChangeFrameskip();
			keypc &= ~BUTTON_Y;
		} else if (keypc & BUTTON_B && !bPauseOn) {
			StatedSave(nSavestateSlot);
			keypc &= ~BUTTON_B;
		} else if (keypc & BUTTON_A && !bPauseOn) {
			StatedLoad(nSavestateSlot);
			keypc &= ~BUTTON_A;
			bPauseOn = 0;
		} else if (keypc & BUTTON_START) {
			keypc = keypad = 0;
			SndPause(1);
			gui_Run();
			SndPause(0);
		} else if (keypc & BUTTON_SELECT) ServiceRequest = 1;
	}
	else if ((keypc & BUTTON_START) && (keypc & BUTTON_SELECT)) P1P2Start = 1;
}