Ejemplo n.º 1
0
u32 ReturnOfTheKingInput(unsigned short pad) {
	// Only Nunchuk controls available
	// Wiimote, Gamecube and Classic controls depend on user configuration
	u32 J = StandardMovement(pad) | DecodeGamecube(pad) | 
	DecodeWiimote(pad) | DecodeClassic(pad);
	bool AbilityButton=0, AttackButton=0, UseButton=0, ChangeSkillButton=0, PauseButton=0,
	ItemsButton=0, SpeedButton=0;
#ifdef HW_RVL
	WPADData * wp = WPAD_Data(pad);
	// Nunchuk controls are made up
	if (wp->exp.type == WPAD_EXP_NUNCHUK) {
		J |= StandardDPad(pad);
		AbilityButton = wp->btns_h & WPAD_BUTTON_B;
		UseButton = wp->btns_h & WPAD_BUTTON_A;
		PauseButton = wp->btns_h & WPAD_BUTTON_PLUS;
		ItemsButton = wp->btns_h & WPAD_BUTTON_MINUS;
		SpeedButton = wp->btns_h & WPAD_NUNCHUK_BUTTON_C;
		ChangeSkillButton = wp->btns_h & WPAD_NUNCHUK_BUTTON_Z;
		AttackButton = (fabs(wp->gforce.x)> 1.5);
	}
#endif
	
	if (AbilityButton) J |= VBA_BUTTON_A;
	if (AttackButton) J |= VBA_BUTTON_B;
	if (ChangeSkillButton) J |= VBA_BUTTON_L;
	if (ItemsButton) J |= VBA_BUTTON_START;
	if (UseButton) J |= VBA_BUTTON_R;
	if (SpeedButton) J |= VBA_SPEED;
	if (PauseButton) J |= VBA_BUTTON_SELECT;

	return J;
}
Ejemplo n.º 2
0
u32 HarryPotter5Input(unsigned short pad) {
	u32 J = StandardMovement(pad) | DecodeGamecube(pad);
#ifdef HW_RVL

	WPADData * wp = WPAD_Data(pad);

	// Wand cursor, normally controlled by DPad, now controlled by Wiimote!
	int cx = 0;
	int cy = 0;
	static int oldcx = 0;
	static int oldcy = 0;
	u8 WandOut = CPUReadByte(0x200e0dd);
	if (WandOut && CursorValid) {
		cx = (CursorX * 268)/640;
		cy = (CursorY * 187)/480;
		if (cx<0x14) cx=0x14;
		else if (cx>0xf8) cx=0xf8;
		if (cy<0x13) cy=0x13;
		else if (cy>0xa8) cy=0xa8;
		CPUWriteByte(0x200e0fe, cx);
		CPUWriteByte(0x200e102, cy);
	}
	oldcx = cx;
	oldcy = cy;

	// DPad works in the map
	if (wp->btns_h & WPAD_BUTTON_RIGHT)
		J |= VBA_BUTTON_R;
	if (wp->btns_h & WPAD_BUTTON_LEFT)
		J |= VBA_BUTTON_L;
	if (wp->btns_h & WPAD_BUTTON_UP)
		J |= VBA_UP;
	if (wp->btns_h & WPAD_BUTTON_DOWN)
		J |= VBA_DOWN;

	// Pause
	if (wp->btns_h & WPAD_BUTTON_PLUS)
		J |= VBA_BUTTON_START;
	// Map (actually objectives)
	if (wp->btns_h & WPAD_BUTTON_MINUS)
		J |= VBA_BUTTON_SELECT;

	// talk or interact
	if (wp->btns_h & WPAD_BUTTON_A)
		J |= VBA_BUTTON_A;
	// spells
	if (wp->btns_h & WPAD_BUTTON_B)
		J |= VBA_BUTTON_B;

	// Run (uses emulator speed button)
	if ((wp->exp.type == WPAD_EXP_NUNCHUK) && (wp->btns_h & WPAD_NUNCHUK_BUTTON_Z))
		J |= VBA_SPEED;

	// CAKTODO spell gestures
#endif

	return J;
}
Ejemplo n.º 3
0
u32 MohUndergroundInput(unsigned short pad) {
	u32 J = StandardMovement(pad) | DecodeClassic(pad) | DecodeWiimote(pad) | DecodeGamecube(pad);
	static bool crouched = false;
#ifdef HW_RVL	
	WPADData * wp = WPAD_Data(pad);

	if (wp->exp.type == WPAD_EXP_NUNCHUK) {
		// Joystick controls L and R, not left and right
		if (J & VBA_LEFT)
		J |= VBA_BUTTON_L;
		if (J & VBA_RIGHT)
		J |= VBA_BUTTON_R;
		J &= ~(VBA_LEFT | VBA_RIGHT);
		// Cursor controls left and right for turning
		CursorVisible = true;
		if (CursorValid) {
			if (CursorX < 320 - 40)
			J |= VBA_LEFT;
			else if (CursorX> 320 + 40)
			J |= VBA_RIGHT;
		}
		// Crouch
		if (wp->btns_h & WPAD_BUTTON_DOWN)
		crouched = !crouched;

		// Pause, objectives, menu
		if (wp->btns_h & WPAD_BUTTON_PLUS)
			J |= VBA_BUTTON_START;
		// Action button, not needed in this game
		if (wp->btns_h & WPAD_BUTTON_MINUS)
			J |= 0;
		// Use sights/scope, not needed in this game
		if (wp->btns_h & WPAD_BUTTON_A)
			J |= VBA_BUTTON_A;
		// Shoot
		if (wp->btns_h & WPAD_BUTTON_B)
			J |= VBA_BUTTON_A;
		// Reload
		if (fabs(wp->gforce.y)> 1.6 || wp->btns_h & WPAD_BUTTON_UP || wp->btns_h & WPAD_BUTTON_2)
			J |= VBA_BUTTON_SELECT;
		// Change weapon
		if (wp->btns_h & WPAD_BUTTON_LEFT || wp->btns_h & WPAD_BUTTON_RIGHT)
			J |= VBA_BUTTON_B;
		// Speed
		if (wp->btns_h & WPAD_BUTTON_1)
			J |= VBA_SPEED;
	} else {
		CursorVisible = false;
	}
#endif

	if (crouched && (!(J & VBA_BUTTON_L)) && (!(J & VBA_BUTTON_R)))
		J |= VBA_BUTTON_L | VBA_BUTTON_R;

	return J;
}
Ejemplo n.º 4
0
u32 CastlevaniaCircleMoonInput(unsigned short pad) {
	// Only Nunchuk and Classic controls available
	// Wiimote and Gamecube controls depend on user configuration
	u32 J = StandardMovement(pad) | DecodeGamecube(pad) | DecodeWiimote(pad) | DecodeClassic(pad);
	bool JumpButton=0, AttackButton=0, ShootButton=0, GuardButton=0, PauseButton=0, SelectButton=0, SpeedButton=0, HyperButton=0,
	LButton=0, RButton=0;
#ifdef HW_RVL
	WPADData * wp = WPAD_Data(pad);
	// Nunchuk controls are based on Castlevania Wii
	if (wp->exp.type == WPAD_EXP_NUNCHUK) {
		ShootButton = wp->btns_h & WPAD_BUTTON_A;
		AttackButton = (fabs(wp->gforce.x)> 1.5) || (fabs(wp->gforce.y)> 1.5) || wp->btns_h & WPAD_BUTTON_B;
		JumpButton = wp->btns_h & WPAD_NUNCHUK_BUTTON_C;
		GuardButton = wp->btns_h & WPAD_NUNCHUK_BUTTON_Z;
		PauseButton = wp->btns_h & WPAD_BUTTON_PLUS;
		SelectButton = wp->btns_h & WPAD_BUTTON_MINUS;
		SpeedButton = (wp->btns_h & WPAD_BUTTON_A) && (wp->btns_h & WPAD_BUTTON_B);
		HyperButton = wp->btns_h & WPAD_BUTTON_DOWN;
		LButton = wp->btns_h & WPAD_BUTTON_1;
		RButton = wp->btns_h & WPAD_BUTTON_2;
	// Classic controls are based on ...?
	} else if (wp->exp.type == WPAD_EXP_CLASSIC) {
		ShootButton = wp->btns_h & WPAD_CLASSIC_BUTTON_Y;
		AttackButton = wp->btns_h & WPAD_CLASSIC_BUTTON_B;
		JumpButton = wp->btns_h & (WPAD_CLASSIC_BUTTON_FULL_R);
		GuardButton = wp->btns_h & (WPAD_CLASSIC_BUTTON_FULL_L);
		PauseButton = wp->btns_h & WPAD_CLASSIC_BUTTON_PLUS;
		SelectButton = wp->btns_h & WPAD_CLASSIC_BUTTON_MINUS;
		SpeedButton = wp->btns_h & WPAD_CLASSIC_BUTTON_A;
		HyperButton = wp->btns_h & WPAD_CLASSIC_BUTTON_X;
		LButton = wp->btns_h & WPAD_CLASSIC_BUTTON_ZL;
		RButton = wp->btns_h & WPAD_CLASSIC_BUTTON_ZR;
	}
#endif
	
	if (JumpButton) J |= VBA_BUTTON_A;
	if (AttackButton) {
		J &= ~VBA_UP;
		J |= VBA_BUTTON_B;
	}
	if (HyperButton) J |= VBA_BUTTON_A | VBA_BUTTON_B;
	if (ShootButton) J |= VBA_UP | VBA_BUTTON_B;
	if (PauseButton) J |= VBA_BUTTON_START;
	if (SelectButton) J |= VBA_BUTTON_SELECT;
	if (SpeedButton) J |= VBA_SPEED;
	if (GuardButton) {
		J &= ~VBA_UP;
		J |= VBA_DOWN;
	}
	if (LButton) J |= VBA_BUTTON_L;
	if (RButton) J |= VBA_BUTTON_R;
	return J;
}
Ejemplo n.º 5
0
u32 Boktai2Input(unsigned short pad) {
	u32 J = StandardMovement(pad) | StandardDPad(pad)
			| DecodeGamecube(pad) | DecodeClassic(pad);
#ifdef HW_RVL
	WPADData * wp = WPAD_Data(pad);
	static bool GunRaised = false;
		// Action
		if (wp->btns_h & WPAD_BUTTON_A)
			J |= VBA_BUTTON_A;
		// Hold gun or hand up to the light to recharge
		if ((-wp->orient.pitch)> 45) {
			GunRaised = true;
		} else if ((-wp->orient.pitch) < 40) {
			GunRaised = false;
		}
		if (GunRaised)
			J |= VBA_BUTTON_A;
		// Fire Gun Del Sol
		if (wp->btns_h & WPAD_BUTTON_B)
			J |= VBA_BUTTON_B;
		// Swing sword or hammer or stab spear
		if (fabs(wp->gforce.x)> 1.8)
			J |= VBA_BUTTON_B;
		// Look around or change subscreen
		if (wp->btns_h & WPAD_BUTTON_2)
			J |= VBA_BUTTON_R;
		// Start
		if (wp->btns_h & WPAD_BUTTON_PLUS)
			J |= VBA_BUTTON_START;
		// Select
		if (wp->btns_h & WPAD_BUTTON_MINUS)
			J |= VBA_BUTTON_SELECT;

	if (wp->exp.type == WPAD_EXP_NUNCHUK) {
		// Look around
		if (wp->btns_h & WPAD_NUNCHUK_BUTTON_C)
			J |= VBA_BUTTON_R;
		// Change element or change subscreen
		if (wp->btns_h & WPAD_NUNCHUK_BUTTON_Z)
			J |= VBA_BUTTON_L;

		if (wp->btns_h & WPAD_BUTTON_1)
		J |= VBA_SPEED;
	} else {
		// Change element or change subscreen
		if (wp->btns_h & WPAD_BUTTON_1)
		J |= VBA_BUTTON_L;
	}
#endif

	return J;
}
Ejemplo n.º 6
0
u32 HarryPotter4Input(unsigned short pad) {
	u32 J = StandardMovement(pad) | DecodeGamecube(pad);
#ifdef HW_RVL

	WPADData * wp = WPAD_Data(pad);

	// DPad works in the map
	if (wp->btns_h & WPAD_BUTTON_RIGHT)
		J |= VBA_BUTTON_R;
	if (wp->btns_h & WPAD_BUTTON_LEFT)
		J |= VBA_BUTTON_L;
	if (wp->btns_h & WPAD_BUTTON_UP)
		J |= VBA_UP;
	if (wp->btns_h & WPAD_BUTTON_DOWN)
		J |= VBA_DOWN;

	// Pause
	if (wp->btns_h & WPAD_BUTTON_PLUS)
		J |= VBA_BUTTON_START;
	// Map doesn't exist. Select Needed for starting game.
	if (wp->btns_h & WPAD_BUTTON_MINUS)
		J |= VBA_BUTTON_SELECT;

	// talk or interact or jinx
	if (wp->btns_h & WPAD_BUTTON_A)
		J |= VBA_BUTTON_A;
	if (fabs(wp->gforce.x)> 1.5)
		J |= VBA_BUTTON_A;
	// Charms
	if (wp->btns_h & WPAD_BUTTON_B)
		J |= VBA_BUTTON_B;

	// L and R
	if (wp->btns_h & WPAD_BUTTON_1)
		J |= VBA_BUTTON_L;
	if (wp->btns_h & WPAD_BUTTON_2)
		J |= VBA_BUTTON_R;

	// Run (uses emulator speed button)
	if ((wp->exp.type == WPAD_EXP_NUNCHUK) && (wp->btns_h & WPAD_NUNCHUK_BUTTON_Z))
		J |= VBA_SPEED;

	// CAKTODO spell gestures
	// swing sideways for Flipendo
	// point at ceiling for Lumos
#endif

	return J;
}
Ejemplo n.º 7
0
u32 HarryPotter2Input(unsigned short pad) {
	u32 J = StandardMovement(pad) 
			| DecodeGamecube(pad);
#ifdef HW_RVL
	WPADData * wp = WPAD_Data(pad);

	// DPad works in the map
	if (wp->btns_h & WPAD_BUTTON_RIGHT)
		J |= VBA_BUTTON_R;
	if (wp->btns_h & WPAD_BUTTON_LEFT)
		J |= VBA_BUTTON_L;
	if (wp->btns_h & WPAD_BUTTON_UP)
		J |= VBA_UP;
	if (wp->btns_h & WPAD_BUTTON_DOWN)
		J |= VBA_DOWN;

	// Pause
	if (wp->btns_h & WPAD_BUTTON_PLUS)
		J |= VBA_BUTTON_START;
	// Map
	if (wp->btns_h & WPAD_BUTTON_MINUS)
		J |= VBA_BUTTON_SELECT;

	// talk or interact or sneak
	if (wp->btns_h & WPAD_BUTTON_A)
		J |= VBA_BUTTON_B;
	// spells
	if (wp->btns_h & WPAD_BUTTON_B)
		J |= VBA_BUTTON_A;
	if (fabs(wp->gforce.x)> 1.5)
		J |= VBA_BUTTON_A;

	if (wp->btns_h & WPAD_BUTTON_1)
		J |= VBA_BUTTON_L;
	if (wp->btns_h & WPAD_BUTTON_2)
		J |= VBA_BUTTON_L;

	// Sneak instead of run
	if ((wp->exp.type == WPAD_EXP_NUNCHUK) && (wp->btns_h & WPAD_NUNCHUK_BUTTON_Z))
		J |= VBA_BUTTON_B;
	// Jump with C button
	if ((wp->exp.type == WPAD_EXP_NUNCHUK) && (wp->btns_h & WPAD_NUNCHUK_BUTTON_C))
		J |= VBA_BUTTON_R;

	// CAKTODO spell gestures
#endif

	return J;
}
Ejemplo n.º 8
0
// WarioWare Twisted
u32 TwistedInput(unsigned short pad) {
	// Change this to true if you want to see the screen tilt.
	TiltScreen = false;
	u32 J = StandardMovement(pad) | DecodeGamecube(pad);
#ifdef HW_RVL
	WPADData * wp = WPAD_Data(pad);

	if (wp->exp.type == WPAD_EXP_NUNCHUK) {
		TiltSideways = false;
		J |= StandardDPad(pad);
		// Pause
		if (wp->btns_h & WPAD_BUTTON_PLUS)
			J |= VBA_BUTTON_START;
		// Select and L do nothing!
		if (wp->btns_h & WPAD_BUTTON_MINUS)
			J |= VBA_BUTTON_SELECT;
		if (wp->btns_h & WPAD_BUTTON_1)
			J |= VBA_BUTTON_L | VBA_SPEED;
		if (wp->btns_h & WPAD_BUTTON_2)
			J |= VBA_BUTTON_L | VBA_SPEED;

		// A Button
		if (wp->btns_h & WPAD_BUTTON_A)
			J |= VBA_BUTTON_A;
		// B Button
		if (wp->btns_h & WPAD_BUTTON_B)
			J |= VBA_BUTTON_B;
		// Grab an icon and prevent menu from spinning
		if (wp->btns_h & WPAD_NUNCHUK_BUTTON_Z)
			J |= VBA_BUTTON_R;
		// Calibrate
		if (wp->btns_h & WPAD_NUNCHUK_BUTTON_C) {
			CalibrateWario = true;
		} else CalibrateWario = false;
	} else if (wp->exp.type == WPAD_EXP_CLASSIC) {
		TiltSideways = false;
		J |= StandardDPad(pad) | StandardClassic(pad);

	} else {
		TiltSideways = true;
		J |= StandardSideways(pad);
		if (wp->btns_h & WPAD_BUTTON_B) {
			CalibrateWario = true;
		} else CalibrateWario = false;
	}
#endif
	return J;
}
Ejemplo n.º 9
0
u32 KirbyTntInput(unsigned short pad) {
	TiltScreen = false;
	u32 J = StandardMovement(pad) | DecodeGamecube(pad);
#ifdef HW_RVL
	WPADData * wp = WPAD_Data(pad);
	if (wp->exp.type == WPAD_EXP_NUNCHUK) {
		TiltSideways = false;
		J |= StandardDPad(pad);
		// Pause
		if (wp->btns_h & WPAD_BUTTON_PLUS)
			J |= VBA_BUTTON_START;
		// Select and L do nothing!
		if (wp->btns_h & WPAD_BUTTON_MINUS)
			J |= VBA_BUTTON_SELECT;
		if (wp->btns_h & WPAD_BUTTON_1)
			J |= VBA_BUTTON_B;
		if (wp->btns_h & WPAD_BUTTON_2)
			J |= VBA_BUTTON_A;

		// A Button
		if (wp->btns_h & WPAD_BUTTON_A)
			J |= VBA_BUTTON_A;
		// B Button
		if (wp->btns_h & WPAD_BUTTON_B)
			J |= VBA_BUTTON_B;
		// Speed
		if (wp->btns_h & WPAD_NUNCHUK_BUTTON_C)
			J |= VBA_SPEED;
	} else if (wp->exp.type == WPAD_EXP_CLASSIC) {
		TiltSideways = false;
		J |= StandardDPad(pad) | DecodeClassic(pad);
		if (wp->btns_h & WPAD_BUTTON_A)
			J |= VBA_BUTTON_A;
	} else {
		TiltSideways = true;
		J |= StandardSideways(pad);
		if (wp->btns_h & WPAD_BUTTON_A)
			J |= VBA_BUTTON_A;
		if (wp->btns_h & WPAD_BUTTON_B)
			J |= VBA_SPEED;
	}
#endif
	return J;
}
Ejemplo n.º 10
0
u32 HarryPotter1GBCInput(unsigned short pad) {
	u32 J = StandardMovement(pad) | StandardDPad(pad) 
			| DecodeGamecube(pad);
	//u8 ScreenMode = gbReadMemory(0xFFCF);
	//u8 CursorItem = gbReadMemory(0xFFD5);

#ifdef HW_RVL
	WPADData * wp = WPAD_Data(pad);

	// Pause Menu
	if (wp->btns_h & WPAD_BUTTON_PLUS)
		J |= VBA_BUTTON_START;
	// Map (well, it tells you where you are)
	if (wp->btns_h & WPAD_BUTTON_MINUS)
		J |= VBA_BUTTON_SELECT;

	// talk or interact
	if (wp->btns_h & WPAD_BUTTON_A)
		J |= VBA_BUTTON_A;
	// cancel
	if (wp->btns_h & WPAD_BUTTON_B)
		J |= VBA_BUTTON_B;
	// spells
	if (fabs(wp->gforce.x)> 1.5)
		J |= VBA_BUTTON_A;

	if (wp->btns_h & WPAD_BUTTON_1)
		J |= VBA_BUTTON_L;
	if (wp->btns_h & WPAD_BUTTON_1)
		J |= VBA_BUTTON_R;

	// Run (uses emulator speed button)
	if ((wp->exp.type == WPAD_EXP_NUNCHUK) && (wp->btns_h & WPAD_NUNCHUK_BUTTON_Z))
		J |= VBA_SPEED;
	// Camera, just tells you what room you are in. CAKTODO make press and release trigger it
	if ((wp->exp.type == WPAD_EXP_NUNCHUK) && (wp->btns_h & WPAD_NUNCHUK_BUTTON_C))
		J |= VBA_BUTTON_SELECT;
#endif

	// CAKTODO spell gestures

	return J;
}
Ejemplo n.º 11
0
u32 MohInfiltratorInput(unsigned short pad) {
	u32 J = StandardMovement(pad) | DecodeGamecube(pad);
#ifdef HW_RVL
	WPADData * wp = WPAD_Data(pad);
	if (wp->exp.type == WPAD_EXP_NONE)
		J |= DecodeWiimote(pad);
	else if (wp->exp.type == WPAD_EXP_CLASSIC) {
		J |= DecodeClassic(pad);
	} else if (wp->exp.type == WPAD_EXP_NUNCHUK) {
		// Pause, objectives, menu
		if (wp->btns_h & WPAD_BUTTON_PLUS)
			J |= VBA_BUTTON_START;
		// Action button, use
		if (wp->btns_h & WPAD_BUTTON_MINUS)
			J |= VBA_BUTTON_L;
		// Use sights/scope, not needed in this game
		if (wp->btns_h & WPAD_BUTTON_A)
			J |= VBA_BUTTON_A | VBA_BUTTON_L;
		// Shoot
		if (wp->btns_h & WPAD_BUTTON_B)
			J |= VBA_BUTTON_A;
		// Reload
		if (fabs(wp->gforce.y)> 1.6 || wp->btns_h & WPAD_BUTTON_UP || wp->btns_h & WPAD_BUTTON_2)
			J |= VBA_BUTTON_L;
		// Strafe
		if (wp->btns_h & WPAD_NUNCHUK_BUTTON_C)
			J |= VBA_BUTTON_R;
		// Change weapon
		if (wp->btns_h & WPAD_BUTTON_LEFT || wp->btns_h & WPAD_BUTTON_RIGHT)
			J |= VBA_BUTTON_B;
		// Speed
		if (wp->btns_h & WPAD_BUTTON_1)
			J |= VBA_SPEED;
	} else
		J |= DecodeWiimote(pad);
#endif
	return J;
}
Ejemplo n.º 12
0
u32 YoshiIslandInput(unsigned short pad)
{
	u32 J = StandardMovement(pad) | DecodeWiimote(pad) | DecodeGamecube(pad);

#ifdef HW_RVL
	WPADData * wp = WPAD_Data(pad);
	if (wp->exp.type == WPAD_EXP_NUNCHUK) {
		J |= StandardDPad(pad);
		// Pause
		if (wp->btns_h & WPAD_BUTTON_PLUS)
			J |= VBA_BUTTON_START;
		// Select
		if (wp->btns_h & WPAD_BUTTON_MINUS)
			J |= VBA_BUTTON_SELECT;

		// Jump
		if (wp->btns_h & WPAD_BUTTON_A)
			J |= VBA_BUTTON_A;
		// Run, pick up
		if (wp->btns_h & WPAD_BUTTON_B)
			J |= VBA_BUTTON_B;
		// throw
		if (wp->btns_h & WPAD_BUTTON_1 || wp->btns_h & WPAD_BUTTON_2)
			J |= VBA_BUTTON_R;

		// Crouch, lay egg
		if (wp->btns_h & WPAD_NUNCHUK_BUTTON_Z) {
			J |= VBA_DOWN; // Crouch
			J &= ~VBA_UP;
		}

		// Camera
		if (wp->btns_h & WPAD_NUNCHUK_BUTTON_C)
			J |= VBA_BUTTON_L;

	} else if (wp->exp.type == WPAD_EXP_CLASSIC) {
		J |= StandardDPad(pad);
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_PLUS)
			J |= VBA_BUTTON_START;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_MINUS)
			J |= VBA_BUTTON_SELECT;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_X)
			J |= VBA_BUTTON_B;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_Y)
			J |= VBA_BUTTON_R;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_B)
			J |= VBA_BUTTON_A;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_A || wp->btns_h & WPAD_CLASSIC_BUTTON_FULL_R)
			J |= VBA_BUTTON_R;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_FULL_L)
			J |= VBA_BUTTON_L;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_ZL || wp->btns_h & WPAD_CLASSIC_BUTTON_ZR)
		{
			J |= VBA_DOWN; // Crouch
			J &= ~VBA_UP;
		}
	}
#endif
	// Gamecube controller
	{
		u32 gc = PAD_ButtonsHeld(pad);
		if (gc & PAD_BUTTON_A)
			J |= VBA_BUTTON_A;
		if (gc & PAD_BUTTON_B)
			J |= VBA_BUTTON_B;
		if (gc & PAD_BUTTON_X)
			J |= VBA_BUTTON_R;
		if (gc & PAD_BUTTON_Y)
			J |= VBA_BUTTON_SELECT;
		if (gc & PAD_TRIGGER_R)
			J |= VBA_BUTTON_R;
		if (gc & PAD_TRIGGER_L)
			J |= VBA_BUTTON_L;
		if (gc & PAD_BUTTON_START)
			J |= VBA_BUTTON_START;
		if (gc & PAD_TRIGGER_Z) {
			J |= VBA_DOWN;
			J &= ~VBA_UP;
		}
	}
	return J;
}
Ejemplo n.º 13
0
u32 UniversalGravitationInput(unsigned short pad) {
	TiltScreen = true;
	u32 J = StandardMovement(pad) | DecodeGamecube(pad);
#ifdef HW_RVL
	WPADData * wp = WPAD_Data(pad);
	if (wp->exp.type == WPAD_EXP_NUNCHUK) {
		J |= StandardDPad(pad);
		TiltSideways = false;
		// Pause
		if (wp->btns_h & WPAD_BUTTON_PLUS)
			J |= VBA_BUTTON_START;
		// Select, L & R do nothing!
		if (wp->btns_h & WPAD_BUTTON_MINUS)
			J |= VBA_BUTTON_SELECT;
		if (wp->btns_h & WPAD_BUTTON_1)
			J |= VBA_BUTTON_L | VBA_SPEED;
		if (wp->btns_h & WPAD_BUTTON_2)
			J |= VBA_BUTTON_R | VBA_SPEED;

		// Jump
		if (wp->btns_h & WPAD_BUTTON_A)
			J |= VBA_BUTTON_A;
		// tongue
		if (wp->btns_h & WPAD_BUTTON_B)
			J |= VBA_BUTTON_B;
		// Crouch, butt stomp
		if (wp->btns_h & WPAD_NUNCHUK_BUTTON_Z) {
			J |= VBA_DOWN; // Crouch
			J &= ~VBA_UP;
		}
		// Camera
		if (wp->btns_h & WPAD_NUNCHUK_BUTTON_C) {
			J |= VBA_UP;
		}
	}
	else if (wp->exp.type == WPAD_EXP_CLASSIC) {
		TiltSideways = false;
		J |= StandardDPad(pad);
		// A bit stupid playing with the classic controller, but nevermind.
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_PLUS)
			J |= VBA_BUTTON_START;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_MINUS)
			J |= VBA_BUTTON_SELECT;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_X)
			J |= VBA_BUTTON_B;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_Y)
			J |= VBA_BUTTON_R;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_B || wp->btns_h & WPAD_CLASSIC_BUTTON_A)
			J |= VBA_BUTTON_A;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_FULL_L || wp->btns_h & WPAD_CLASSIC_BUTTON_ZL)
			J |= VBA_DOWN;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_FULL_R)
			J |= VBA_UP;
		if (WPAD_CLASSIC_BUTTON_ZR)
			J |= VBA_SPEED;
	} else {
		J |= StandardSideways(pad);
		TiltSideways = true;
	}
#endif
	return J;
}
Ejemplo n.º 14
0
u32 Mario3Input(unsigned short pad)
{
	u32 J = StandardMovement(pad) | DecodeGamecube(pad);
#ifdef HW_RVL
	WPADData * wp = WPAD_Data(pad);
	bool run = false;

	run = (wp->exp.type==WPAD_EXP_NUNCHUK && wp->exp.nunchuk.js.mag> 0.83) || (wp->exp.type==WPAD_EXP_CLASSIC && wp->exp.classic.ljs.mag> 0.83);
	run = run && ((J & VBA_LEFT) || (J & VBA_RIGHT));

	if (wp->exp.type == WPAD_EXP_NONE)
		J |= DecodeWiimote(pad);
	else if (wp->exp.type == WPAD_EXP_CLASSIC) {
		// DPad movement
		J |= StandardDPad(pad);
		// Pause
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_PLUS)
			J |= VBA_BUTTON_START;
		// Select
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_MINUS)
			J |= VBA_BUTTON_L;
		// Replay menu
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_FULL_R)
			J |= VBA_BUTTON_SELECT;
		// Jump
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_B)
			J |= VBA_BUTTON_A;
		// Run, pick up, throw, fire
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_X || wp->btns_h & WPAD_CLASSIC_BUTTON_Y || run)
			J |= VBA_BUTTON_B;
		// Spin attack (racoon costume, fire flower)
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_A)
			J |= VBA_BUTTON_B;
		// Crouch
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_ZL || wp->btns_h & WPAD_CLASSIC_BUTTON_FULL_L) {
			J |= VBA_DOWN;
			J &= ~VBA_UP;
		}
		// Speed
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_ZR)
			J |= VBA_SPEED;

	} else if (wp->exp.type == WPAD_EXP_NUNCHUK) {
		J |= StandardDPad(pad);
		// Pause
		if (wp->btns_h & WPAD_BUTTON_PLUS)
			J |= VBA_BUTTON_START;
		// Select
		if (wp->btns_h & WPAD_BUTTON_MINUS)
			J |= VBA_BUTTON_L;
		// Replay Menu
		if (wp->btns_h & WPAD_BUTTON_1)
			J |= VBA_BUTTON_SELECT;
		// Jump
		if (wp->btns_h & WPAD_BUTTON_A)
			J |= VBA_BUTTON_A;
		// Run, pick up, throw, fire
		if (wp->btns_h & WPAD_BUTTON_B || run)
			J |= VBA_BUTTON_B;
		// Spin attack (racoon, fire flower)
		if (fabs(wp->gforce.x)> 1.4)
			J |= VBA_BUTTON_B;
		// Crouch
		if (wp->btns_h & WPAD_NUNCHUK_BUTTON_Z)
		{
			J |= VBA_DOWN;
			J &= ~VBA_UP;
		}
		// Speed
		if (wp->btns_h & WPAD_BUTTON_2)
			J |= VBA_SPEED;
	}
#endif

	return J;
}
Ejemplo n.º 15
0
u32 MarioWorldInput(unsigned short pad) {
	u32 J = StandardMovement(pad) | DecodeGamecube(pad);
	u8 CarryState = CPUReadByte(0x3003F06); // 01 = carrying, 00 = not carrying
	u8 InYoshisMouth = CPUReadByte(0x3003F53); // FF = nothing, 00 = no level, else thing
	u8 FallState = CPUReadByte(0x3003FA1); // 0B = jump, 24 = fall
	u8 RidingYoshi = CPUReadByte(0x3004302); // 00 = not riding, 01 = riding
	static bool NeedStomp = false;
	bool dontrun = false;
	bool run = false;
	static bool dontletgo = false;
	dontrun = (InYoshisMouth != 0 && InYoshisMouth != 0xFF && RidingYoshi);
	bool BButton = false;
#ifdef HW_RVL
	WPADData * wp = WPAD_Data(pad);

	run = (wp->exp.type==WPAD_EXP_NUNCHUK && wp->exp.nunchuk.js.mag> 0.83) || (wp->exp.type==WPAD_EXP_CLASSIC && wp->exp.classic.ljs.mag> 0.83);
	BButton = (wp->exp.type == WPAD_EXP_CLASSIC && (wp->btns_h & WPAD_CLASSIC_BUTTON_X || wp->btns_h & WPAD_CLASSIC_BUTTON_Y)) || wp->btns_h & WPAD_BUTTON_B;
#endif
	u32 gc = PAD_ButtonsHeld(pad);
	BButton = BButton || gc & PAD_BUTTON_B;
	if (run && CarryState && !BButton)
		dontletgo = true;
	if (!CarryState)
		dontletgo = false;
#ifdef HW_RVL
	if (wp->exp.type == WPAD_EXP_NUNCHUK) {
		J |= StandardDPad(pad);
		// Pause
		if (wp->btns_h & WPAD_BUTTON_PLUS)
			J |= VBA_BUTTON_START;
		// Select
		if (wp->btns_h & WPAD_BUTTON_MINUS)
			J |= VBA_BUTTON_SELECT;

		// Jump
		if (wp->btns_h & WPAD_BUTTON_A)
			J |= VBA_BUTTON_A;
		// Run, pick up
		if ((run && !dontrun) || wp->btns_h & WPAD_BUTTON_B || dontletgo)
			J |= VBA_BUTTON_B;
		if (wp->btns_h & WPAD_BUTTON_B && dontletgo) {
			J = J & ~VBA_BUTTON_B;
			dontletgo = false;
		}
		// Spin attack
		if (fabs(wp->gforce.x)> 1.5)
			J |= VBA_BUTTON_R;

		// Butt stomp
		if (FallState!=0 && (wp->exp.type == WPAD_EXP_NUNCHUK) && (wp->btns_h & WPAD_NUNCHUK_BUTTON_Z) && (!RidingYoshi))
			NeedStomp = true;
		if (FallState!=0 && (wp->exp.type == WPAD_EXP_CLASSIC) && (wp->btns_h & WPAD_CLASSIC_BUTTON_ZL || wp->btns_h & WPAD_CLASSIC_BUTTON_ZR) && (!RidingYoshi))
			NeedStomp = true;
		// Crouch
		if (wp->btns_h & WPAD_NUNCHUK_BUTTON_Z) {
			J |= VBA_DOWN; // Crouch
			J &= ~VBA_UP;
		}

		// Camera
		if (wp->btns_h & WPAD_NUNCHUK_BUTTON_C) {
			if (J & VBA_DOWN || J & VBA_UP)
				J |= VBA_BUTTON_L;
			else if (J & VBA_RIGHT || J & VBA_LEFT) {
				J |= VBA_BUTTON_L;
				J &= ~VBA_RIGHT;
				J &= ~VBA_LEFT;
			}
		}
	} else if (wp->exp.type == WPAD_EXP_CLASSIC) {
		J |= StandardDPad(pad);
		// Pause
		if (wp->btns_h & WPAD_BUTTON_PLUS)
			J |= VBA_BUTTON_START;
		// Select
		if (wp->btns_h & WPAD_BUTTON_MINUS)
			J |= VBA_BUTTON_SELECT;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_PLUS)
			J |= VBA_BUTTON_START;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_MINUS)
			J |= VBA_BUTTON_SELECT;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_X || wp->btns_h & WPAD_CLASSIC_BUTTON_Y)
			J |= VBA_BUTTON_B;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_B)
			J |= VBA_BUTTON_A;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_A || wp->btns_h & WPAD_CLASSIC_BUTTON_FULL_R)
			J |= VBA_BUTTON_R;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_FULL_L)
			J |= VBA_BUTTON_L;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_ZL || wp->btns_h & WPAD_CLASSIC_BUTTON_ZR)
		{
			J |= VBA_DOWN; // Crouch
			J &= ~VBA_UP;
		}
	}

	BButton = (wp->exp.type == WPAD_EXP_CLASSIC && (wp->btns_h & WPAD_CLASSIC_BUTTON_X || wp->btns_h & WPAD_CLASSIC_BUTTON_Y)) || wp->btns_h & WPAD_BUTTON_B;
#endif
	// Gamecube controller
	if (gc & PAD_BUTTON_A)
		J |= VBA_BUTTON_A;
	if (gc & PAD_BUTTON_B)
		J |= VBA_BUTTON_B;
	if (gc & PAD_BUTTON_X)
		J |= VBA_BUTTON_R;
	if (gc & PAD_BUTTON_Y)
		J |= VBA_BUTTON_SELECT;
	if (gc & PAD_TRIGGER_R)
		J |= VBA_BUTTON_R;
	if (gc & PAD_TRIGGER_L)
		J |= VBA_BUTTON_L;
	if (gc & PAD_BUTTON_START)
		J |= VBA_BUTTON_START;
	if (gc & PAD_TRIGGER_Z) {
		J |= VBA_DOWN;
		J &= ~VBA_UP;
	}
	// if we try to use Yoshi's tongue while running, release run for one frame
	if (run && BButton && !dontrun && !dontletgo)
		J &= ~VBA_BUTTON_B;
	if (NeedStomp && FallState == 0 && !RidingYoshi) {
		J |= VBA_BUTTON_R; // spin attack only works when on ground
		NeedStomp = false;
	}

	return J;
}
Ejemplo n.º 16
0
u32 MarioLand2Input(unsigned short pad) {
	u32 J = StandardMovement(pad) | DecodeGamecube(pad);
#ifdef HW_RVL
	WPADData * wp = WPAD_Data(pad);
	bool run = false;

	run = (wp->exp.type==WPAD_EXP_NUNCHUK && wp->exp.nunchuk.js.mag> 0.83) || (wp->exp.type==WPAD_EXP_CLASSIC && wp->exp.classic.ljs.mag> 0.83);
	run = run && ((J & VBA_LEFT) || (J & VBA_RIGHT));

	if (wp->exp.type == WPAD_EXP_NONE)
		J |= StandardSideways(pad);
	else if (wp->exp.type == WPAD_EXP_CLASSIC) {
		J |= StandardDPad(pad);
		// Pause
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_PLUS)
			J |= VBA_BUTTON_START;
		// Select
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_MINUS)
			J |= VBA_BUTTON_SELECT;
		// Jump
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_B)
			J |= VBA_BUTTON_A;
		// Run, pick up, throw, fire
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_X || wp->btns_h & WPAD_CLASSIC_BUTTON_Y || run)
			J |= VBA_BUTTON_B;
		// Spin attack
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_A)
			J |= VBA_DOWN | VBA_BUTTON_A;
		// Camera
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_FULL_L)
			J |= VBA_DOWN | VBA_BUTTON_B;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_FULL_R)
			J |= VBA_UP | VBA_BUTTON_B;
		// Crouch
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_ZL && (!(wp->btns_h & WPAD_CLASSIC_BUTTON_A))) {
			J |= VBA_DOWN;
			// if the run button is held down, crouching also looks down
			// which we don't want when using the Z button
			J &= ~VBA_BUTTON_B;
			J &= ~VBA_UP;
		}
		// Speed
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_ZR)
			J |= VBA_SPEED;
	} else if (wp->exp.type == WPAD_EXP_NUNCHUK) {
		// Pause
		if (wp->btns_h & WPAD_BUTTON_PLUS)
			J |= VBA_BUTTON_START;
		// Select
		if (wp->btns_h & WPAD_BUTTON_MINUS)
			J |= VBA_BUTTON_SELECT;
		// Jump
		if (wp->btns_h & WPAD_BUTTON_A)
			J |= VBA_BUTTON_A;
		// Run, pick up, throw, fire
		if (wp->btns_h & WPAD_BUTTON_B || run)
			J |= VBA_BUTTON_B;
		// Spin attack
		if (fabs(wp->gforce.x)> 1.4)
			J |= VBA_DOWN | VBA_BUTTON_A;
		// Camera
		if (wp->btns_h & WPAD_NUNCHUK_BUTTON_C)
			J |= VBA_BUTTON_B;
		if (wp->btns_h & WPAD_BUTTON_UP)
			J |= VBA_BUTTON_B | VBA_UP;
		if (wp->btns_h & WPAD_BUTTON_DOWN)
			J |= VBA_BUTTON_B | VBA_DOWN;
		if (wp->btns_h & WPAD_BUTTON_LEFT)
			J |= VBA_BUTTON_B | VBA_LEFT;
		if (wp->btns_h & WPAD_BUTTON_RIGHT)
			J |= VBA_BUTTON_B | VBA_RIGHT;
		// Crouch
		if (wp->btns_h & WPAD_NUNCHUK_BUTTON_Z && (!(wp->btns_h & WPAD_BUTTON_A))) {
			J |= VBA_DOWN;
			// if the run button is held down, crouching also looks down
			// which we don't want when using the Z button
			J &= ~VBA_BUTTON_B;
			J &= ~VBA_UP;
		}
		// Speed
		if (wp->btns_h & WPAD_BUTTON_1 || wp->btns_h & WPAD_BUTTON_2)
			J |= VBA_SPEED;
	} else
		J |= DecodeWiimote(pad);
#endif
	return J;
}
Ejemplo n.º 17
0
u32 Mario1DXInput(unsigned short pad) {
	u32 J = StandardMovement(pad) | DecodeGamecube(pad);
#ifdef HW_RVL
	WPADData * wp = WPAD_Data(pad);

	bool run = false;
	run = (wp->exp.type==WPAD_EXP_NUNCHUK && wp->exp.nunchuk.js.mag> 0.83) || (wp->exp.type==WPAD_EXP_CLASSIC && wp->exp.classic.ljs.mag> 0.83);
	run = run && ((J & VBA_LEFT) || (J & VBA_RIGHT));

	if (wp->exp.type==WPAD_EXP_NUNCHUK) {
		// Pause
		if (wp->btns_h & WPAD_BUTTON_PLUS)
			J |= VBA_BUTTON_START;
		// Select
		if (wp->btns_h & WPAD_BUTTON_MINUS)
			J |= VBA_BUTTON_SELECT;

		// Jump
		if (wp->btns_h & WPAD_BUTTON_A)
			J |= VBA_BUTTON_A;
		// Run, pick up
		if (wp->btns_h & WPAD_BUTTON_B || run)
			J |= VBA_BUTTON_B;
		// Starspin shoots when using fireflower
		if (fabs(wp->gforce.x)> 1.5)
			J |= VBA_BUTTON_B;

		// Camera (must come before Crouch)
		if (!(wp->btns_h & WPAD_NUNCHUK_BUTTON_C))
			J &= ~(VBA_DOWN | VBA_UP);
		if (wp->btns_h & WPAD_BUTTON_UP)
			J |= VBA_UP;
		if (wp->btns_h & WPAD_BUTTON_DOWN)
			J |= VBA_DOWN;
		// Crouch (must come after Camera)
		if (wp->btns_h & WPAD_NUNCHUK_BUTTON_Z)
			J |= VBA_DOWN;

		// Speed
		if (wp->btns_h & WPAD_BUTTON_1 || wp->btns_h & WPAD_BUTTON_2)
			J |= VBA_SPEED;
	} else if (wp->exp.type == WPAD_EXP_CLASSIC) {
		// Pause
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_PLUS)
			J |= VBA_BUTTON_START;
		// Select
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_MINUS)
			J |= VBA_BUTTON_SELECT;
		// Jump
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_B)
			J |= VBA_BUTTON_A;
		// Run, pick up, throw, fire
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_X || wp->btns_h & WPAD_CLASSIC_BUTTON_Y || run)
			J |= VBA_BUTTON_B;
		// Spin attack
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_A)
			J |= VBA_BUTTON_B;
		// Camera
		J &= ~(VBA_DOWN | VBA_UP);
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_FULL_L)
			J |= VBA_DOWN;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_FULL_R)
			J |= VBA_UP;
		// Crouch
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_ZL) {
			J |= VBA_DOWN;
			J &= ~VBA_UP;
		}
		// DPad movement/camera
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_UP)
			J |= VBA_UP;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_DOWN)
			J |= VBA_DOWN;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_LEFT)
			J |= VBA_LEFT;
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_RIGHT)
			J |= VBA_RIGHT;
		// Speed
		if (wp->btns_h & WPAD_CLASSIC_BUTTON_ZR)
			J |= VBA_SPEED;
	} else
		J |= StandardSideways(pad);
#endif
	return J;
}
Ejemplo n.º 18
0
u32 KidDraculaInput(unsigned short pad) {
	// Only Nunchuk and Classic controls available
	// Wiimote and Gamecube controls depend on user configuration
	u32 J = StandardMovement(pad) | DecodeGamecube(pad) | DecodeWiimote(pad) | DecodeClassic(pad);
	bool JumpButton=0, ShootButton=0, PauseButton=0, SelectButton=0, SpeedButton=0, NorButton=0, BatButton=0;
#ifdef HW_RVL
	WPADData * wp = WPAD_Data(pad);
	if (wp->exp.type == WPAD_EXP_NUNCHUK) {
		JumpButton = wp->btns_h & WPAD_BUTTON_A;
		ShootButton = wp->btns_h & WPAD_BUTTON_B;
		PauseButton = wp->btns_h & WPAD_BUTTON_PLUS;
		SelectButton = wp->btns_h & WPAD_BUTTON_MINUS;
		SpeedButton = wp->btns_h & WPAD_BUTTON_1 || wp->btns_h & WPAD_BUTTON_2;
		NorButton = wp->btns_h & WPAD_NUNCHUK_BUTTON_Z;
		BatButton = wp->btns_h & WPAD_NUNCHUK_BUTTON_C;
	} else if (wp->exp.type == WPAD_EXP_CLASSIC) {
		JumpButton = wp->btns_h & (WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_A);
		ShootButton = wp->btns_h & WPAD_CLASSIC_BUTTON_Y;
		PauseButton = wp->btns_h & WPAD_CLASSIC_BUTTON_PLUS;
		SelectButton = wp->btns_h & WPAD_CLASSIC_BUTTON_MINUS;
		SpeedButton = wp->btns_h & (WPAD_CLASSIC_BUTTON_ZL | WPAD_CLASSIC_BUTTON_FULL_L);
		NorButton = wp->btns_h & WPAD_CLASSIC_BUTTON_X;
		BatButton = wp->btns_h & (WPAD_CLASSIC_BUTTON_ZR | WPAD_CLASSIC_BUTTON_FULL_R);
	}
#endif
	if (JumpButton) J |= VBA_BUTTON_A;
	if (ShootButton && !(KD_WeaponPressed && KD_LastWeapon != -1)) {
		J |= VBA_BUTTON_B;
		KD_LastWeapon = -1;
		// Insert original weapon and graphics
		KD_WeaponToMemory();
		gbWriteMemory(0xC8CB, KD_ActualItem);
		for (int i=0; i<64; i++) {
			gbWriteMemory(0x9110+i, KD_ACTUAL[i]);
		}
		for (int i=0; i<128; i++) {
			gbWriteMemory(0x8f40+i, KD_ACTUAL_GRAPHICS[i]);
		}
	}
	if (NorButton && !(KD_WeaponPressed && KD_LastWeapon != 0)) {
		J |= VBA_BUTTON_B;
		KD_LastWeapon = 0;
		// Insert NOR weapon and graphics
		KD_WeaponToMemory();
		gbWriteMemory(0xC8CB, 0);
		for (int i=0; i<64; i++) {
			gbWriteMemory(0x9110+i, KD_NOR[i]);
		}
		for (int i=0; i<128; i++) {
			gbWriteMemory(0x8f40+i, KD_NOR_GRAPHICS[i]);
		}
	}
	if (BatButton && !(KD_WeaponPressed && KD_LastWeapon != 4)) {
		J |= VBA_BUTTON_B;
		KD_LastWeapon = 4;
		// Insert BAT weapon and graphics
		KD_WeaponToMemory();
		gbWriteMemory(0xC8CB, 4);
		for (int i=0; i<64; i++) {
			gbWriteMemory(0x9110+i, KD_BAT[i]);
		}
	}
	if (PauseButton) J |= VBA_BUTTON_START;
	if (SelectButton) J |= VBA_BUTTON_SELECT;
	if (SpeedButton) J |= VBA_SPEED;
	KD_WeaponPressed = (ShootButton || NorButton || BatButton);
	return J;
}