2009-03-04 07:56:55 +01:00
/****************************************************************************
* Visual Boy Advance GX
*
* Carl Kenner Febuary 2009
*
* gameinput . cpp
*
2009-04-03 01:41:09 +02:00
* Wii / Gamecube controls for individual games
2009-03-04 07:56:55 +01:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# include <gccore.h>
# include <stdio.h>
2009-04-03 01:41:09 +02:00
# include <stdarg.h>
2009-03-04 07:56:55 +01:00
# include <stdlib.h>
# include <string.h>
# include <math.h>
# include <ogcsys.h>
# include <unistd.h>
# include <wiiuse/wpad.h>
2010-03-22 00:49:59 +01:00
# include "vbagx.h"
2009-03-04 07:56:55 +01:00
# include "button_mapping.h"
# include "audio.h"
# include "video.h"
# include "input.h"
# include "gameinput.h"
# include "vbasupport.h"
2010-03-22 00:49:59 +01:00
# include "vba/gba/GBA.h"
# include "vba/gba/bios.h"
# include "vba/gba/GBAinline.h"
2009-03-04 07:56:55 +01:00
2009-05-27 22:22:22 +02:00
extern bool CalibrateWario ;
2009-04-25 14:09:13 +02:00
char DebugStr [ 50 ] = " " ;
2009-03-04 07:56:55 +01:00
2009-04-09 13:36:14 +02:00
void DebugPrintf ( const char * format , . . . ) {
2009-04-03 01:41:09 +02:00
va_list args ;
va_start ( args , format ) ;
vsprintf ( DebugStr , format , args ) ;
va_end ( args ) ;
2009-04-25 14:09:13 +02:00
}
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
u32 TMNTInput ( unsigned short pad ) {
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad ) | StandardDPad ( pad ) ;
2009-04-03 01:41:09 +02:00
static u32 LastDir = VBA_RIGHT ;
static bool wait = false ;
static int holdcount = 0 ;
bool Jump = 0 , Attack = 0 , SpinKick = 0 , Roll = 0 , Pause = 0 , Select = 0 ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
# ifdef HW_RVL
WPADData * wp = WPAD_Data ( pad ) ;
if ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) {
Jump = ( wp - > btns_h & WPAD_BUTTON_A ) ;
Attack = ( fabs ( wp - > gforce . x ) > 1.5 ) ;
SpinKick = ( fabs ( wp - > exp . nunchuk . gforce . x ) > 0.5 ) ;
Roll = ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_Z | | wp - > btns_h & WPAD_NUNCHUK_BUTTON_C ) ;
Pause = ( wp - > btns_h & WPAD_BUTTON_PLUS ) ;
Select = ( wp - > btns_h & WPAD_BUTTON_MINUS ) ;
// Swap Turtles or super turtle summon
if ( wp - > btns_h & WPAD_BUTTON_B ) {
if ( wp - > exp . nunchuk . orient . pitch < - 35 & & wp - > orient . pitch < - 35 )
J | = VBA_BUTTON_L | VBA_BUTTON_R ;
else J | = VBA_BUTTON_R ;
}
} else if ( wp - > exp . type = = WPAD_EXP_CLASSIC ) {
Jump = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_B ) ;
Attack = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_A ) ;
SpinKick = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_X ) ;
Pause = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_PLUS ) ;
Select = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_MINUS ) ;
Roll = ( wp - > btns_h & ( WPAD_CLASSIC_BUTTON_FULL_L | WPAD_CLASSIC_BUTTON_FULL_R | WPAD_CLASSIC_BUTTON_ZL | WPAD_CLASSIC_BUTTON_ZR ) ) ;
// Swap Turtles or super turtle summon
if ( wp - > btns_h & WPAD_CLASSIC_BUTTON_Y ) {
holdcount + + ;
if ( holdcount > 20 )
J | = VBA_BUTTON_L | VBA_BUTTON_R ;
}
if ( wp - > btns_u & WPAD_CLASSIC_BUTTON_Y ) {
if ( holdcount < = 20 )
J | = VBA_BUTTON_R ;
holdcount = 0 ;
}
} else {
Jump = ( wp - > btns_h & WPAD_BUTTON_A ) ;
Attack = ( fabs ( wp - > gforce . x ) > 1.5 ) ;
Pause = ( wp - > btns_h & WPAD_BUTTON_PLUS ) ;
Select = ( wp - > btns_h & WPAD_BUTTON_MINUS ) ;
// Swap Turtles or super turtle summon
if ( wp - > btns_h & WPAD_BUTTON_B ) {
if ( wp - > orient . pitch < - 40 )
J | = VBA_BUTTON_L | VBA_BUTTON_R ;
else J | = VBA_BUTTON_R ;
}
SpinKick = ( wp - > btns_h & WPAD_BUTTON_1 ) ;
Roll = ( wp - > btns_h & WPAD_BUTTON_2 ) ;
}
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
# endif
u32 gc = PAD_ButtonsHeld ( pad ) ;
u32 released = PAD_ButtonsUp ( pad ) ;
// DPad moves
if ( gc & PAD_BUTTON_UP )
J | = VBA_UP ;
if ( gc & PAD_BUTTON_DOWN )
J | = VBA_DOWN ;
if ( gc & PAD_BUTTON_LEFT )
J | = VBA_LEFT ;
if ( gc & PAD_BUTTON_RIGHT )
J | = VBA_RIGHT ;
// Jump
if ( gc & PAD_BUTTON_A ) J | = VBA_BUTTON_A ;
// Swap turtles, hold for super family move
if ( gc & PAD_BUTTON_B ) {
holdcount + + ;
if ( holdcount > 20 )
J | = VBA_BUTTON_L | VBA_BUTTON_R ;
}
if ( released & PAD_BUTTON_B ) {
if ( holdcount < = 20 )
J | = VBA_BUTTON_R ;
holdcount = 0 ;
}
// Attack
if ( gc & PAD_BUTTON_X ) Attack = true ;
// Spin kick
if ( gc & PAD_BUTTON_Y ) SpinKick = true ;
// Pause
if ( gc & PAD_BUTTON_START ) Pause = true ;
// Select
if ( gc & PAD_TRIGGER_Z ) Select = true ;
// Roll
if ( gc & PAD_TRIGGER_L | | gc & PAD_TRIGGER_R ) Roll = true ;
if ( Jump ) J | = VBA_BUTTON_A ;
if ( Attack ) J | = VBA_BUTTON_B ;
if ( SpinKick ) J | = VBA_BUTTON_B | VBA_BUTTON_A ;
if ( Pause ) J | = VBA_BUTTON_START ;
if ( Select ) J | = VBA_BUTTON_SELECT ;
if ( Roll ) {
if ( ! wait ) {
2009-04-26 22:47:31 +02:00
J | = LastDir ; // Double tap D-Pad to roll
2009-04-03 01:41:09 +02:00
wait = true ;
} else wait = false ;
}
if ( J & VBA_RIGHT ) LastDir = VBA_RIGHT ;
else if ( J & VBA_LEFT ) LastDir = VBA_LEFT ;
2009-03-04 07:56:55 +01:00
return J ;
}
2009-04-25 14:09:13 +02:00
u32 TMNT1Input ( unsigned short pad ) {
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad ) | StandardDPad ( pad ) ;
2009-04-25 14:09:13 +02:00
static u32 LastDir = VBA_RIGHT ;
bool Jump = 0 , Attack = 0 , SpinKick = 0 , Roll = 0 , Pause = 0 , Select = 0 ;
# ifdef HW_RVL
WPADData * wp = WPAD_Data ( pad ) ;
if ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) {
Jump = ( wp - > btns_h & WPAD_BUTTON_A ) ;
Attack = ( fabs ( wp - > gforce . x ) > 1.5 ) ;
SpinKick = ( fabs ( wp - > exp . nunchuk . gforce . x ) > 0.5 ) ;
Roll = ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_Z | | wp - > btns_h & WPAD_NUNCHUK_BUTTON_C ) ;
Pause = ( wp - > btns_h & WPAD_BUTTON_PLUS ) ;
Select = ( wp - > btns_h & WPAD_BUTTON_MINUS ) ;
// Swap Turtles or super turtle summon
if ( wp - > btns_h & WPAD_BUTTON_B ) {
// N/A
}
} else if ( wp - > exp . type = = WPAD_EXP_CLASSIC ) {
J | = StandardDPad ( pad ) ;
Jump = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_B ) ;
Attack = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_A ) ;
SpinKick = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_X ) ;
Pause = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_PLUS ) ;
Select = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_MINUS ) ;
Roll = ( wp - > btns_h & ( WPAD_CLASSIC_BUTTON_FULL_L | WPAD_CLASSIC_BUTTON_FULL_R | WPAD_CLASSIC_BUTTON_ZL | WPAD_CLASSIC_BUTTON_ZR ) ) ;
// Swap Turtles or super turtle summon
if ( wp - > btns_h & WPAD_CLASSIC_BUTTON_Y ) {
// N/A
}
} else {
Jump = ( wp - > btns_h & WPAD_BUTTON_A ) ;
Attack = ( fabs ( wp - > gforce . x ) > 1.5 ) ;
Pause = ( wp - > btns_h & WPAD_BUTTON_PLUS ) ;
Select = ( wp - > btns_h & WPAD_BUTTON_MINUS ) ;
// Swap Turtles or super turtle summon
if ( wp - > btns_h & WPAD_BUTTON_B ) {
//N/A
}
SpinKick = ( wp - > btns_h & WPAD_BUTTON_1 ) ;
Roll = ( wp - > btns_h & WPAD_BUTTON_2 ) ;
}
# endif
u32 gc = PAD_ButtonsHeld ( pad ) ;
// DPad moves
if ( gc & PAD_BUTTON_UP )
J | = VBA_UP ;
if ( gc & PAD_BUTTON_DOWN )
J | = VBA_DOWN ;
if ( gc & PAD_BUTTON_LEFT )
J | = VBA_LEFT ;
if ( gc & PAD_BUTTON_RIGHT )
J | = VBA_RIGHT ;
// Jump
if ( gc & PAD_BUTTON_A ) J | = VBA_BUTTON_A ;
// Swap turtles, hold for super family move
if ( gc & PAD_BUTTON_B ) {
// N/A
}
// Attack
if ( gc & PAD_BUTTON_X ) Attack = true ;
// Spin kick
if ( gc & PAD_BUTTON_Y ) SpinKick = true ;
// Pause
if ( gc & PAD_BUTTON_START ) Pause = true ;
// Select
if ( gc & PAD_TRIGGER_Z ) Select = true ;
// Roll
if ( gc & PAD_TRIGGER_L | | gc & PAD_TRIGGER_R ) Roll = true ;
if ( Jump ) J | = VBA_BUTTON_A ;
if ( Attack | | SpinKick ) J | = VBA_BUTTON_B ;
if ( Pause ) J | = VBA_BUTTON_START ;
if ( Select ) J | = VBA_BUTTON_SELECT ;
if ( J & VBA_RIGHT ) LastDir = VBA_RIGHT ;
else if ( J & VBA_LEFT ) LastDir = VBA_LEFT ;
return J ;
}
u32 TMNT2Input ( unsigned short pad ) {
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad ) | StandardDPad ( pad ) ;
2009-04-25 14:09:13 +02:00
static u32 LastDir = VBA_RIGHT ;
bool Jump = 0 , Attack = 0 , SpinKick = 0 , Roll = 0 , Pause = 0 , Select = 0 ;
# ifdef HW_RVL
WPADData * wp = WPAD_Data ( pad ) ;
if ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) {
Jump = ( wp - > btns_h & WPAD_BUTTON_A ) ;
Attack = ( fabs ( wp - > gforce . x ) > 1.5 ) ;
SpinKick = ( fabs ( wp - > exp . nunchuk . gforce . x ) > 0.5 ) ;
Roll = ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_Z | | wp - > btns_h & WPAD_NUNCHUK_BUTTON_C ) ;
Pause = ( wp - > btns_h & WPAD_BUTTON_PLUS ) ;
Select = ( wp - > btns_h & WPAD_BUTTON_MINUS ) ;
// Swap Turtles or super turtle summon
if ( wp - > btns_h & WPAD_BUTTON_B ) {
// N/A
}
} else if ( wp - > exp . type = = WPAD_EXP_CLASSIC ) {
J | = StandardDPad ( pad ) ;
Jump = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_B ) ;
Attack = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_A ) ;
SpinKick = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_X ) ;
Pause = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_PLUS ) ;
Select = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_MINUS ) ;
Roll = ( wp - > btns_h & ( WPAD_CLASSIC_BUTTON_FULL_L | WPAD_CLASSIC_BUTTON_FULL_R | WPAD_CLASSIC_BUTTON_ZL | WPAD_CLASSIC_BUTTON_ZR ) ) ;
// Swap Turtles or super turtle summon
if ( wp - > btns_h & WPAD_CLASSIC_BUTTON_Y ) {
// N/A
}
} else {
Jump = ( wp - > btns_h & WPAD_BUTTON_A ) ;
Attack = ( fabs ( wp - > gforce . x ) > 1.5 ) ;
Pause = ( wp - > btns_h & WPAD_BUTTON_PLUS ) ;
Select = ( wp - > btns_h & WPAD_BUTTON_MINUS ) ;
// Swap Turtles or super turtle summon
if ( wp - > btns_h & WPAD_BUTTON_B ) {
//N/A
}
SpinKick = ( wp - > btns_h & WPAD_BUTTON_1 ) ;
Roll = ( wp - > btns_h & WPAD_BUTTON_2 ) ;
}
# endif
u32 gc = PAD_ButtonsHeld ( pad ) ;
// DPad moves
if ( gc & PAD_BUTTON_UP )
J | = VBA_UP ;
if ( gc & PAD_BUTTON_DOWN )
J | = VBA_DOWN ;
if ( gc & PAD_BUTTON_LEFT )
J | = VBA_LEFT ;
if ( gc & PAD_BUTTON_RIGHT )
J | = VBA_RIGHT ;
// Jump
if ( gc & PAD_BUTTON_A ) J | = VBA_BUTTON_A ;
// Swap turtles, hold for super family move
if ( gc & PAD_BUTTON_B ) {
// N/A
}
// Attack
if ( gc & PAD_BUTTON_X ) Attack = true ;
// Spin kick
if ( gc & PAD_BUTTON_Y ) SpinKick = true ;
// Pause
if ( gc & PAD_BUTTON_START ) Pause = true ;
// Select
if ( gc & PAD_TRIGGER_Z ) Select = true ;
// Roll
if ( gc & PAD_TRIGGER_L | | gc & PAD_TRIGGER_R ) Roll = true ;
if ( Jump ) J | = VBA_BUTTON_A ;
if ( Attack ) J | = VBA_BUTTON_B ;
if ( SpinKick | | Roll ) J | = VBA_BUTTON_B | VBA_BUTTON_A ;
if ( Pause ) J | = VBA_BUTTON_START ;
if ( Select ) J | = VBA_BUTTON_SELECT ;
if ( J & VBA_RIGHT ) LastDir = VBA_RIGHT ;
else if ( J & VBA_LEFT ) LastDir = VBA_LEFT ;
return J ;
}
u32 TMNT3Input ( unsigned short pad ) {
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad ) | StandardDPad ( pad ) ;
2009-04-25 14:09:13 +02:00
static u32 LastDir = VBA_RIGHT ;
bool Jump = 0 , Attack = 0 , SpinKick = 0 , Roll = 0 , Pause = 0 , Select = 0 ;
# ifdef HW_RVL
WPADData * wp = WPAD_Data ( pad ) ;
if ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) {
Jump = ( wp - > btns_h & WPAD_BUTTON_A ) ;
Attack = ( fabs ( wp - > gforce . x ) > 1.5 ) ;
SpinKick = ( fabs ( wp - > exp . nunchuk . gforce . x ) > 0.5 ) ;
Roll = ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_Z | | wp - > btns_h & WPAD_NUNCHUK_BUTTON_C ) ;
Pause = ( wp - > btns_h & WPAD_BUTTON_PLUS ) ;
Select = ( wp - > btns_h & WPAD_BUTTON_MINUS ) ;
// Swap Turtles or super turtle summon
if ( wp - > btns_h & WPAD_BUTTON_B ) {
J | = VBA_BUTTON_START ;
}
} else if ( wp - > exp . type = = WPAD_EXP_CLASSIC ) {
J | = StandardDPad ( pad ) ;
Jump = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_B ) ;
Attack = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_A ) ;
SpinKick = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_X ) ;
Pause = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_PLUS ) ;
Select = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_MINUS ) ;
Roll = ( wp - > btns_h & ( WPAD_CLASSIC_BUTTON_FULL_L | WPAD_CLASSIC_BUTTON_FULL_R | WPAD_CLASSIC_BUTTON_ZL | WPAD_CLASSIC_BUTTON_ZR ) ) ;
// Swap Turtles or super turtle summon
if ( wp - > btns_h & WPAD_CLASSIC_BUTTON_Y ) {
J | = VBA_BUTTON_START ;
}
} else {
Jump = ( wp - > btns_h & WPAD_BUTTON_A ) ;
Attack = ( fabs ( wp - > gforce . x ) > 1.5 ) ;
Pause = ( wp - > btns_h & WPAD_BUTTON_PLUS ) ;
Select = ( wp - > btns_h & WPAD_BUTTON_MINUS ) ;
// Swap Turtles or super turtle summon
if ( wp - > btns_h & WPAD_BUTTON_B ) {
J | = VBA_BUTTON_START ;
}
SpinKick = ( wp - > btns_h & WPAD_BUTTON_1 ) ;
Roll = ( wp - > btns_h & WPAD_BUTTON_2 ) ;
}
# endif
u32 gc = PAD_ButtonsHeld ( pad ) ;
// DPad moves
if ( gc & PAD_BUTTON_UP )
J | = VBA_UP ;
if ( gc & PAD_BUTTON_DOWN )
J | = VBA_DOWN ;
if ( gc & PAD_BUTTON_LEFT )
J | = VBA_LEFT ;
if ( gc & PAD_BUTTON_RIGHT )
J | = VBA_RIGHT ;
// Jump
if ( gc & PAD_BUTTON_A ) J | = VBA_BUTTON_A ;
// Swap turtles
if ( gc & PAD_BUTTON_B ) {
J | = VBA_BUTTON_START ;
}
// Attack
if ( gc & PAD_BUTTON_X ) Attack = true ;
// Spin kick
if ( gc & PAD_BUTTON_Y ) SpinKick = true ;
// Pause
if ( gc & PAD_BUTTON_START ) Pause = true ;
// Select
if ( gc & PAD_TRIGGER_Z ) Select = true ;
// Roll
if ( gc & PAD_TRIGGER_L | | gc & PAD_TRIGGER_R ) Roll = true ;
if ( Jump | | Roll ) J | = VBA_BUTTON_A ;
if ( Attack | | SpinKick ) J | = VBA_BUTTON_B ;
if ( Pause ) J | = VBA_BUTTON_SELECT ;
if ( Select ) J | = VBA_BUTTON_START ;
if ( J & VBA_RIGHT ) LastDir = VBA_RIGHT ;
else if ( J & VBA_LEFT ) LastDir = VBA_LEFT ;
return J ;
}
u32 TMNTGBAInput ( unsigned short pad ) {
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad ) | StandardDPad ( pad ) ;
2009-04-25 14:09:13 +02:00
static u32 LastDir = VBA_RIGHT ;
bool Jump = 0 , Attack = 0 , SpinKick = 0 , SpecialMove = 0 , Pause = 0 , Select = 0 ;
# ifdef HW_RVL
WPADData * wp = WPAD_Data ( pad ) ;
if ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) {
Jump = ( wp - > btns_h & WPAD_BUTTON_A ) ;
Attack = ( fabs ( wp - > gforce . x ) > 1.5 ) | | ( wp - > btns_h & WPAD_BUTTON_B ) ;
SpinKick = ( fabs ( wp - > exp . nunchuk . gforce . x ) > 0.5 ) ;
SpecialMove = ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_Z ) ;
Pause = ( wp - > btns_h & WPAD_BUTTON_PLUS ) ;
Select = ( wp - > btns_h & WPAD_BUTTON_MINUS ) ;
// Swap Turtles or super turtle summon
if ( wp - > btns_h & WPAD_BUTTON_B ) {
//J |= VBA_BUTTON_START;
}
} else if ( wp - > exp . type = = WPAD_EXP_CLASSIC ) {
Jump = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_B ) ;
Attack = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_A ) ;
SpinKick = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_X ) ;
Pause = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_PLUS ) ;
Select = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_MINUS ) ;
SpecialMove = ( wp - > btns_h & ( WPAD_CLASSIC_BUTTON_FULL_L | WPAD_CLASSIC_BUTTON_FULL_R | WPAD_CLASSIC_BUTTON_ZL | WPAD_CLASSIC_BUTTON_ZR ) ) ;
// Swap Turtles or super turtle summon
if ( wp - > btns_h & WPAD_CLASSIC_BUTTON_Y ) {
//J |= VBA_BUTTON_START;
}
} else {
Jump = ( wp - > btns_h & WPAD_BUTTON_A ) ;
Attack = ( fabs ( wp - > gforce . x ) > 1.5 ) | | ( wp - > btns_h & WPAD_BUTTON_B ) ;
Pause = ( wp - > btns_h & WPAD_BUTTON_PLUS ) ;
Select = ( wp - > btns_h & WPAD_BUTTON_MINUS ) ;
// Swap Turtles or super turtle summon
if ( wp - > btns_h & WPAD_BUTTON_B ) {
//J |= VBA_BUTTON_START;
}
SpinKick = ( wp - > btns_h & WPAD_BUTTON_1 ) ;
SpecialMove = ( wp - > btns_h & WPAD_BUTTON_2 ) ;
}
# endif
u32 gc = PAD_ButtonsHeld ( pad ) ;
// DPad moves
if ( gc & PAD_BUTTON_UP )
J | = VBA_UP ;
if ( gc & PAD_BUTTON_DOWN )
J | = VBA_DOWN ;
if ( gc & PAD_BUTTON_LEFT )
J | = VBA_LEFT ;
if ( gc & PAD_BUTTON_RIGHT )
J | = VBA_RIGHT ;
// Jump
if ( gc & PAD_BUTTON_A ) J | = VBA_BUTTON_A ;
// Swap turtles
if ( gc & PAD_BUTTON_B ) {
//J |= VBA_BUTTON_B;
}
// Attack
if ( gc & PAD_BUTTON_X ) Attack = true ;
// Spin kick
if ( gc & PAD_BUTTON_Y ) SpinKick = true ;
// Pause
if ( gc & PAD_BUTTON_START ) Pause = true ;
// Select
if ( gc & PAD_TRIGGER_Z ) Select = true ;
// SpecialMove
if ( gc & PAD_TRIGGER_L | | gc & PAD_TRIGGER_R ) SpecialMove = true ;
if ( Jump ) J | = VBA_BUTTON_A ;
if ( Attack ) J | = VBA_BUTTON_B ;
if ( SpinKick ) J | = VBA_BUTTON_R ;
if ( Pause ) J | = VBA_BUTTON_START ;
if ( Select ) J | = VBA_BUTTON_SELECT ;
if ( SpecialMove ) {
J | = VBA_BUTTON_R | VBA_BUTTON_A ; // CAKTODO
}
if ( J & VBA_RIGHT ) LastDir = VBA_RIGHT ;
else if ( J & VBA_LEFT ) LastDir = VBA_LEFT ;
return J ;
}
2009-05-27 19:31:18 +02:00
u32 TMNTGBA2Input ( unsigned short pad ) {
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad ) | StandardDPad ( pad ) ;
2009-05-27 19:31:18 +02:00
static u32 LastDir = VBA_RIGHT ;
2009-05-28 00:20:21 +02:00
//static bool wait = false;
//static int holdcount = 0;
2009-05-27 19:31:18 +02:00
bool Jump = 0 , Attack = 0 , SpinKick = 0 , SpecialMove = 0 , Pause = 0 , Select = 0 , Look = 0 ;
# ifdef HW_RVL
WPADData * wp = WPAD_Data ( pad ) ;
if ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) {
Jump = ( wp - > btns_h & WPAD_BUTTON_A ) ;
Attack = ( fabs ( wp - > gforce . x ) > 1.5 ) | | ( wp - > btns_h & WPAD_BUTTON_B ) ;
SpinKick = ( fabs ( wp - > exp . nunchuk . gforce . x ) > 0.5 ) ;
SpecialMove = ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_Z ) ;
Pause = ( wp - > btns_h & WPAD_BUTTON_PLUS ) ;
Select = ( wp - > btns_h & WPAD_BUTTON_MINUS ) ;
Look = ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_C ) ;
// Swap Turtles or super turtle summon
if ( wp - > btns_h & WPAD_BUTTON_B ) {
//J |= VBA_BUTTON_START;
}
} else if ( wp - > exp . type = = WPAD_EXP_CLASSIC ) {
Jump = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_B ) ;
Attack = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_A ) ;
SpinKick = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_X ) ;
Pause = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_PLUS ) ;
Select = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_MINUS ) ;
SpecialMove = ( wp - > btns_h & ( WPAD_CLASSIC_BUTTON_FULL_L | WPAD_CLASSIC_BUTTON_FULL_R | WPAD_CLASSIC_BUTTON_ZR ) ) ;
Look = ( wp - > btns_h & WPAD_CLASSIC_BUTTON_ZL ) ;
// Swap Turtles or super turtle summon
if ( wp - > btns_h & WPAD_CLASSIC_BUTTON_Y ) {
//J |= VBA_BUTTON_START;
}
} else {
Jump = ( wp - > btns_h & WPAD_BUTTON_A ) ;
Attack = ( fabs ( wp - > gforce . x ) > 1.5 ) | | ( wp - > btns_h & WPAD_BUTTON_B ) ;
Pause = ( wp - > btns_h & WPAD_BUTTON_PLUS ) ;
Select = ( wp - > btns_h & WPAD_BUTTON_MINUS ) ;
// Swap Turtles or super turtle summon
if ( wp - > btns_h & WPAD_BUTTON_B ) {
Look = true ;
}
SpinKick = ( wp - > btns_h & WPAD_BUTTON_1 ) ;
SpecialMove = ( wp - > btns_h & WPAD_BUTTON_2 ) ;
}
# endif
u32 gc = PAD_ButtonsHeld ( pad ) ;
// DPad moves
if ( gc & PAD_BUTTON_UP )
J | = VBA_UP ;
if ( gc & PAD_BUTTON_DOWN )
J | = VBA_DOWN ;
if ( gc & PAD_BUTTON_LEFT )
J | = VBA_LEFT ;
if ( gc & PAD_BUTTON_RIGHT )
J | = VBA_RIGHT ;
// Jump
if ( gc & PAD_BUTTON_A ) J | = VBA_BUTTON_A ;
// Swap turtles
if ( gc & PAD_BUTTON_B ) {
Look = true ;
}
// Attack
if ( gc & PAD_BUTTON_X ) Attack = true ;
// Spin kick
if ( gc & PAD_BUTTON_Y ) SpinKick = true ;
// Pause
if ( gc & PAD_BUTTON_START ) Pause = true ;
// Select
if ( gc & PAD_TRIGGER_Z ) Select = true ;
// SpecialMove
if ( gc & PAD_TRIGGER_L | | gc & PAD_TRIGGER_R ) SpecialMove = true ;
if ( Jump ) J | = VBA_BUTTON_A ;
if ( Attack ) J | = VBA_BUTTON_B ;
if ( SpinKick ) J | = VBA_BUTTON_R ;
if ( Pause ) J | = VBA_BUTTON_START ;
if ( Select ) J | = VBA_BUTTON_SELECT ;
if ( SpecialMove ) {
J | = VBA_UP | VBA_BUTTON_A ; // CAKTODO, currently works for Don and Mike
}
if ( J & VBA_RIGHT ) LastDir = VBA_RIGHT ;
else if ( J & VBA_LEFT ) LastDir = VBA_LEFT ;
return J ;
}
2009-04-03 01:41:09 +02:00
u32 HarryPotter1GBCInput ( unsigned short pad ) {
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad ) | StandardDPad ( pad )
2009-04-03 01:41:09 +02:00
| DecodeGamecube ( pad ) ;
//u8 ScreenMode = gbReadMemory(0xFFCF);
//u8 CursorItem = gbReadMemory(0xFFD5);
# ifdef HW_RVL
2009-03-04 07:56:55 +01:00
WPADData * wp = WPAD_Data ( pad ) ;
2009-04-03 01:41:09 +02:00
// 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 ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
// 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
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
// CAKTODO spell gestures
2009-03-04 07:56:55 +01:00
return J ;
}
2009-04-03 01:41:09 +02:00
u32 HarryPotter2GBCInput ( unsigned short pad ) {
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad ) | StandardDPad ( pad )
2009-04-03 01:41:09 +02:00
| DecodeGamecube ( pad ) ;
# ifdef HW_RVL
2009-03-04 07:56:55 +01:00
WPADData * wp = WPAD_Data ( pad ) ;
2009-04-03 01:41:09 +02:00
// 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 ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
if ( wp - > btns_h & WPAD_BUTTON_1 )
J | = VBA_BUTTON_L ;
if ( wp - > btns_h & WPAD_BUTTON_1 )
J | = VBA_BUTTON_R ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
// 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 ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
// CAKTODO spell gestures
# endif
2009-03-04 07:56:55 +01:00
return J ;
}
2009-04-03 01:41:09 +02:00
u32 HarryPotter1Input ( unsigned short pad ) {
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad )
2009-04-03 01:41:09 +02:00
| DecodeGamecube ( pad ) ;
# ifdef HW_RVL
2009-03-04 07:56:55 +01:00
WPADData * wp = WPAD_Data ( pad ) ;
2009-04-03 01:41:09 +02:00
// DPad works in the map
2009-03-04 07:56:55 +01:00
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 )
2009-04-03 01:41:09 +02:00
J | = VBA_UP ;
2009-03-04 07:56:55 +01:00
if ( wp - > btns_h & WPAD_BUTTON_DOWN )
2009-04-03 01:41:09 +02:00
J | = VBA_DOWN ;
2009-03-04 07:56:55 +01:00
// Pause
if ( wp - > btns_h & WPAD_BUTTON_PLUS )
J | = VBA_BUTTON_START ;
2009-04-03 01:41:09 +02:00
// Map
2009-03-04 07:56:55 +01:00
if ( wp - > btns_h & WPAD_BUTTON_MINUS )
J | = VBA_BUTTON_SELECT ;
2009-04-03 01:41:09 +02:00
// talk or interact
2009-03-04 07:56:55 +01:00
if ( wp - > btns_h & WPAD_BUTTON_A )
J | = VBA_BUTTON_A ;
2009-04-03 01:41:09 +02:00
// spells
2009-03-04 07:56:55 +01:00
if ( wp - > btns_h & WPAD_BUTTON_B )
J | = VBA_BUTTON_B ;
if ( fabs ( wp - > gforce . x ) > 1.5 )
J | = VBA_BUTTON_B ;
2009-04-03 01:41:09 +02:00
if ( wp - > btns_h & WPAD_BUTTON_1 | | wp - > btns_h & WPAD_BUTTON_2 )
J | = VBA_BUTTON_R ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
// Run (uses emulator speed button)
if ( ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) & & ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_Z ) )
J | = VBA_SPEED ;
// Flute
2009-03-04 07:56:55 +01:00
if ( ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) & & ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_C ) )
J | = VBA_BUTTON_L ;
2009-04-03 01:41:09 +02:00
// CAKTODO spell gestures
# endif
2009-03-04 07:56:55 +01:00
return J ;
}
2009-04-03 01:41:09 +02:00
u32 HarryPotter2Input ( unsigned short pad ) {
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad )
2009-04-03 01:41:09 +02:00
| DecodeGamecube ( pad ) ;
# ifdef HW_RVL
2009-03-04 07:56:55 +01:00
WPADData * wp = WPAD_Data ( pad ) ;
2009-04-03 01:41:09 +02:00
// 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 ;
2009-03-04 07:56:55 +01:00
// Pause
if ( wp - > btns_h & WPAD_BUTTON_PLUS )
J | = VBA_BUTTON_START ;
2009-04-03 01:41:09 +02:00
// Map
2009-03-04 07:56:55 +01:00
if ( wp - > btns_h & WPAD_BUTTON_MINUS )
J | = VBA_BUTTON_SELECT ;
2009-04-03 01:41:09 +02:00
// talk or interact or sneak
2009-03-04 07:56:55 +01:00
if ( wp - > btns_h & WPAD_BUTTON_A )
J | = VBA_BUTTON_B ;
2009-04-03 01:41:09 +02:00
// spells
if ( wp - > btns_h & WPAD_BUTTON_B )
J | = VBA_BUTTON_A ;
2009-03-04 07:56:55 +01:00
if ( fabs ( wp - > gforce . x ) > 1.5 )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_A ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
if ( wp - > btns_h & WPAD_BUTTON_1 )
J | = VBA_BUTTON_L ;
if ( wp - > btns_h & WPAD_BUTTON_2 )
J | = VBA_BUTTON_L ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
// Sneak instead of run
if ( ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) & & ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_Z ) )
2009-03-04 07:56:55 +01:00
J | = VBA_BUTTON_B ;
2009-04-03 01:41:09 +02:00
// Jump with C button
if ( ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) & & ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_C ) )
2009-03-04 07:56:55 +01:00
J | = VBA_BUTTON_R ;
2009-04-03 01:41:09 +02:00
// CAKTODO spell gestures
# endif
2009-03-04 07:56:55 +01:00
return J ;
}
2009-04-03 01:41:09 +02:00
u32 HarryPotter3Input ( unsigned short pad ) {
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad )
2009-04-03 01:41:09 +02:00
| DecodeGamecube ( pad ) ;
# ifdef HW_RVL
2009-03-04 07:56:55 +01:00
WPADData * wp = WPAD_Data ( pad ) ;
2009-04-03 01:41:09 +02:00
// 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 ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
// Pause
if ( wp - > btns_h & WPAD_BUTTON_PLUS )
J | = VBA_BUTTON_START ;
// Map doesn't exist. Options instead
if ( wp - > btns_h & WPAD_BUTTON_MINUS )
J | = VBA_BUTTON_SELECT ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
// 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 ;
if ( fabs ( wp - > gforce . x ) > 1.5 )
J | = VBA_BUTTON_B ;
// Change spells
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 ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
// CAKTODO spell gestures
// swing sideways for Flipendo
// point at ceiling for Lumos
# endif
2009-03-04 07:56:55 +01:00
return J ;
}
2009-04-03 01:41:09 +02:00
u32 HarryPotter4Input ( unsigned short pad ) {
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad ) | DecodeGamecube ( pad ) ;
2009-04-03 01:41:09 +02:00
# ifdef HW_RVL
2009-03-04 07:56:55 +01:00
WPADData * wp = WPAD_Data ( pad ) ;
2009-04-03 01:41:09 +02:00
// 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 ;
2009-03-04 07:56:55 +01:00
// Pause
if ( wp - > btns_h & WPAD_BUTTON_PLUS )
J | = VBA_BUTTON_START ;
2009-04-03 01:41:09 +02:00
// Map doesn't exist. Select Needed for starting game.
2009-03-04 07:56:55 +01:00
if ( wp - > btns_h & WPAD_BUTTON_MINUS )
J | = VBA_BUTTON_SELECT ;
2009-04-03 01:41:09 +02:00
// talk or interact or jinx
2009-03-04 07:56:55 +01:00
if ( wp - > btns_h & WPAD_BUTTON_A )
J | = VBA_BUTTON_A ;
2009-04-03 01:41:09 +02:00
if ( fabs ( wp - > gforce . x ) > 1.5 )
J | = VBA_BUTTON_A ;
// Charms
2009-03-04 07:56:55 +01:00
if ( wp - > btns_h & WPAD_BUTTON_B )
J | = VBA_BUTTON_B ;
2009-04-03 01:41:09 +02:00
// 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 ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
// Run (uses emulator speed button)
2009-03-04 07:56:55 +01:00
if ( ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) & & ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_Z ) )
2009-04-03 01:41:09 +02:00
J | = VBA_SPEED ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
// CAKTODO spell gestures
// swing sideways for Flipendo
// point at ceiling for Lumos
# endif
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
return J ;
}
u32 HarryPotter5Input ( unsigned short pad ) {
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad ) | DecodeGamecube ( pad ) ;
2009-04-03 01:41:09 +02:00
# 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 ) ;
2009-03-04 07:56:55 +01:00
}
2009-04-03 01:41:09 +02:00
oldcx = cx ;
oldcy = cy ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
// DPad works in the map
if ( wp - > btns_h & WPAD_BUTTON_RIGHT )
2009-03-04 07:56:55 +01:00
J | = VBA_BUTTON_R ;
2009-04-03 01:41:09 +02:00
if ( wp - > btns_h & WPAD_BUTTON_LEFT )
2009-03-04 07:56:55 +01:00
J | = VBA_BUTTON_L ;
2009-04-03 01:41:09 +02:00
if ( wp - > btns_h & WPAD_BUTTON_UP )
J | = VBA_UP ;
if ( wp - > btns_h & WPAD_BUTTON_DOWN )
2009-03-04 07:56:55 +01:00
J | = VBA_DOWN ;
2009-04-03 01:41:09 +02:00
// 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 ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
// 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 ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
// Run (uses emulator speed button)
if ( ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) & & ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_Z ) )
J | = VBA_SPEED ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
// CAKTODO spell gestures
# endif
2009-03-04 07:56:55 +01:00
return J ;
}
2009-05-27 22:22:22 +02:00
// WarioWare Twisted
2009-04-03 01:41:09 +02:00
u32 TwistedInput ( unsigned short pad ) {
2009-03-04 07:56:55 +01:00
// Change this to true if you want to see the screen tilt.
TiltScreen = false ;
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad ) | DecodeGamecube ( pad ) ;
2009-04-03 01:41:09 +02:00
# ifdef HW_RVL
2009-03-04 07:56:55 +01:00
WPADData * wp = WPAD_Data ( pad ) ;
2009-04-03 01:41:09 +02:00
if ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) {
2009-03-04 07:56:55 +01:00
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 ;
2009-05-27 22:22:22 +02:00
// Calibrate
if ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_C ) {
CalibrateWario = true ;
} else CalibrateWario = false ;
2009-04-03 01:41:09 +02:00
} else if ( wp - > exp . type = = WPAD_EXP_CLASSIC ) {
2009-03-04 07:56:55 +01:00
TiltSideways = false ;
J | = StandardDPad ( pad ) | StandardClassic ( pad ) ;
2009-04-03 01:41:09 +02:00
} else {
2009-03-04 07:56:55 +01:00
TiltSideways = true ;
J | = StandardSideways ( pad ) ;
2009-05-27 22:22:22 +02:00
if ( wp - > btns_h & WPAD_BUTTON_B ) {
CalibrateWario = true ;
} else CalibrateWario = false ;
2009-03-04 07:56:55 +01:00
}
2009-04-03 01:41:09 +02:00
# endif
2009-03-04 07:56:55 +01:00
return J ;
}
2009-04-03 01:41:09 +02:00
u32 KirbyTntInput ( unsigned short pad ) {
2009-03-04 07:56:55 +01:00
TiltScreen = false ;
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad ) | DecodeGamecube ( pad ) ;
2009-04-03 01:41:09 +02:00
# ifdef HW_RVL
2009-03-04 07:56:55 +01:00
WPADData * wp = WPAD_Data ( pad ) ;
2009-04-03 01:41:09 +02:00
if ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) {
2009-03-04 07:56:55 +01:00
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 ;
2009-04-03 01:41:09 +02:00
} else if ( wp - > exp . type = = WPAD_EXP_CLASSIC ) {
2009-03-04 07:56:55 +01:00
TiltSideways = false ;
2009-04-03 01:41:09 +02:00
J | = StandardDPad ( pad ) | DecodeClassic ( pad ) ;
2009-03-04 07:56:55 +01:00
if ( wp - > btns_h & WPAD_BUTTON_A )
J | = VBA_BUTTON_A ;
2009-04-03 01:41:09 +02:00
} else {
2009-03-04 07:56:55 +01:00
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 ;
}
2009-04-03 01:41:09 +02:00
# endif
2009-03-04 07:56:55 +01:00
return J ;
}
2009-04-03 01:41:09 +02:00
u32 MohInfiltratorInput ( unsigned short pad ) {
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad ) | DecodeGamecube ( pad ) ;
2009-04-03 01:41:09 +02:00
# ifdef HW_RVL
2009-03-04 07:56:55 +01:00
WPADData * wp = WPAD_Data ( pad ) ;
if ( wp - > exp . type = = WPAD_EXP_NONE )
2009-04-03 01:41:09 +02:00
J | = DecodeWiimote ( pad ) ;
else if ( wp - > exp . type = = WPAD_EXP_CLASSIC ) {
J | = DecodeClassic ( pad ) ;
} else if ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) {
2009-03-04 07:56:55 +01:00
// Pause, objectives, menu
if ( wp - > btns_h & WPAD_BUTTON_PLUS )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_START ;
2009-03-04 07:56:55 +01:00
// Action button, use
if ( wp - > btns_h & WPAD_BUTTON_MINUS )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_L ;
2009-03-04 07:56:55 +01:00
// Use sights/scope, not needed in this game
if ( wp - > btns_h & WPAD_BUTTON_A )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_A | VBA_BUTTON_L ;
2009-03-04 07:56:55 +01:00
// Shoot
if ( wp - > btns_h & WPAD_BUTTON_B )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_A ;
2009-03-04 07:56:55 +01:00
// Reload
if ( fabs ( wp - > gforce . y ) > 1.6 | | wp - > btns_h & WPAD_BUTTON_UP | | wp - > btns_h & WPAD_BUTTON_2 )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_L ;
2009-03-04 07:56:55 +01:00
// Strafe
if ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_C )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_R ;
2009-03-04 07:56:55 +01:00
// Change weapon
if ( wp - > btns_h & WPAD_BUTTON_LEFT | | wp - > btns_h & WPAD_BUTTON_RIGHT )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_B ;
2009-03-04 07:56:55 +01:00
// Speed
if ( wp - > btns_h & WPAD_BUTTON_1 )
2009-04-03 01:41:09 +02:00
J | = VBA_SPEED ;
} else
J | = DecodeWiimote ( pad ) ;
# endif
2009-03-04 07:56:55 +01:00
return J ;
}
2009-04-03 01:41:09 +02:00
u32 MohUndergroundInput ( unsigned short pad ) {
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad ) | DecodeClassic ( pad ) | DecodeWiimote ( pad ) | DecodeGamecube ( pad ) ;
2009-03-04 07:56:55 +01:00
static bool crouched = false ;
2009-04-03 01:41:09 +02:00
# ifdef HW_RVL
WPADData * wp = WPAD_Data ( pad ) ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
if ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) {
2009-03-04 07:56:55 +01:00
// 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 ;
2009-04-03 01:41:09 +02:00
if ( CursorValid ) {
2009-03-04 07:56:55 +01:00
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 )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_START ;
2009-03-04 07:56:55 +01:00
// Action button, not needed in this game
if ( wp - > btns_h & WPAD_BUTTON_MINUS )
2009-04-03 01:41:09 +02:00
J | = 0 ;
2009-03-04 07:56:55 +01:00
// Use sights/scope, not needed in this game
if ( wp - > btns_h & WPAD_BUTTON_A )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_A ;
2009-03-04 07:56:55 +01:00
// Shoot
if ( wp - > btns_h & WPAD_BUTTON_B )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_A ;
2009-03-04 07:56:55 +01:00
// Reload
if ( fabs ( wp - > gforce . y ) > 1.6 | | wp - > btns_h & WPAD_BUTTON_UP | | wp - > btns_h & WPAD_BUTTON_2 )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_SELECT ;
2009-03-04 07:56:55 +01:00
// Change weapon
if ( wp - > btns_h & WPAD_BUTTON_LEFT | | wp - > btns_h & WPAD_BUTTON_RIGHT )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_B ;
2009-03-04 07:56:55 +01:00
// Speed
if ( wp - > btns_h & WPAD_BUTTON_1 )
2009-04-03 01:41:09 +02:00
J | = VBA_SPEED ;
} else {
2009-03-04 07:56:55 +01:00
CursorVisible = false ;
}
2009-04-03 01:41:09 +02:00
# endif
2009-03-04 07:56:55 +01:00
if ( crouched & & ( ! ( J & VBA_BUTTON_L ) ) & & ( ! ( J & VBA_BUTTON_R ) ) )
J | = VBA_BUTTON_L | VBA_BUTTON_R ;
return J ;
}
2009-04-03 01:41:09 +02:00
u32 BoktaiInput ( unsigned short pad ) {
u32 J = StandardMovement ( pad ) | StandardDPad ( pad )
2010-03-11 07:04:53 +01:00
| DecodeGamecube ( pad ) | DecodeClassic ( pad ) ;
2009-04-03 01:41:09 +02:00
# ifdef HW_RVL
2009-03-04 07:56:55 +01:00
WPADData * wp = WPAD_Data ( pad ) ;
static bool GunRaised = false ;
// Action
if ( wp - > btns_h & WPAD_BUTTON_A )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_A ;
2009-03-04 07:56:55 +01:00
// Hold Gun Del Sol up to the light to recharge
2009-04-03 01:41:09 +02:00
if ( ( - wp - > orient . pitch ) > 45 ) {
2009-03-04 07:56:55 +01:00
GunRaised = true ;
2009-04-03 01:41:09 +02:00
} else if ( ( - wp - > orient . pitch ) < 40 ) {
2009-03-04 07:56:55 +01:00
GunRaised = false ;
}
if ( GunRaised )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_A ;
2009-03-04 07:56:55 +01:00
// Fire Gun Del Sol
if ( wp - > btns_h & WPAD_BUTTON_B )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_B ;
2009-03-04 07:56:55 +01:00
// Look around or change subscreen
if ( wp - > btns_h & WPAD_BUTTON_2 )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_R ;
2009-03-04 07:56:55 +01:00
// Start
if ( wp - > btns_h & WPAD_BUTTON_PLUS )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_START ;
2009-03-04 07:56:55 +01:00
// Select
if ( wp - > btns_h & WPAD_BUTTON_MINUS )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_SELECT ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
if ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) {
2009-03-04 07:56:55 +01:00
// Look around
if ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_C )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_R ;
2009-03-04 07:56:55 +01:00
// Change element or change subscreen
if ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_Z )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_L ;
2009-03-04 07:56:55 +01:00
if ( wp - > btns_h & WPAD_BUTTON_1 )
2009-04-03 01:41:09 +02:00
J | = VBA_SPEED ;
} else {
2009-03-04 07:56:55 +01:00
// Change element or change subscreen
if ( wp - > btns_h & WPAD_BUTTON_1 )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_L ;
2009-03-04 07:56:55 +01:00
}
2009-04-03 01:41:09 +02:00
# endif
2009-03-04 07:56:55 +01:00
return J ;
}
2009-04-03 01:41:09 +02:00
u32 Boktai2Input ( unsigned short pad ) {
u32 J = StandardMovement ( pad ) | StandardDPad ( pad )
2010-03-11 07:04:53 +01:00
| DecodeGamecube ( pad ) | DecodeClassic ( pad ) ;
2009-04-03 01:41:09 +02:00
# ifdef HW_RVL
2009-03-04 07:56:55 +01:00
WPADData * wp = WPAD_Data ( pad ) ;
static bool GunRaised = false ;
2009-04-03 01:41:09 +02:00
// 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 ;
2009-03-04 07:56:55 +01:00
2009-04-03 01:41:09 +02:00
if ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) {
2009-03-04 07:56:55 +01:00
// Look around
if ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_C )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_R ;
2009-03-04 07:56:55 +01:00
// Change element or change subscreen
if ( wp - > btns_h & WPAD_NUNCHUK_BUTTON_Z )
2009-04-03 01:41:09 +02:00
J | = VBA_BUTTON_L ;
2009-03-04 07:56:55 +01:00
if ( wp - > btns_h & WPAD_BUTTON_1 )
J | = VBA_SPEED ;
2009-04-03 01:41:09 +02:00
} else {
2009-03-04 07:56:55 +01:00
// Change element or change subscreen
if ( wp - > btns_h & WPAD_BUTTON_1 )
J | = VBA_BUTTON_L ;
}
2009-04-03 01:41:09 +02:00
# endif
2009-03-04 07:56:55 +01:00
return J ;
}
2009-04-03 01:41:09 +02:00
u32 OnePieceInput ( unsigned short pad ) {
// Only Nunchuk and Gamecube controls available
2010-03-11 07:04:53 +01:00
// Wiimote and Classic controls depend on user configuration
2009-04-03 01:41:09 +02:00
u32 J = StandardMovement ( pad )
2010-03-11 07:04:53 +01:00
| DecodeWiimote ( pad ) | DecodeClassic ( pad ) ;
2009-04-03 01:41:09 +02:00
static u32 LastDir = VBA_RIGHT ;
bool JumpButton = 0 , AttackButton = 0 , ViewButton = 0 , CharacterButton = 0 , PauseButton = 0 ,
DashButton = 0 , GrabButton = 0 , SpeedButton = 0 , AttackUpButton = 0 ;
# ifdef HW_RVL
WPADData * wp = WPAD_Data ( pad ) ;
// Nunchuk controls are based on One Piece: Unlimited Adventure for the Wii
if ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) {
J | = StandardDPad ( pad ) ;
JumpButton = wp - > btns_h & WPAD_BUTTON_B ;
AttackButton = wp - > btns_h & WPAD_BUTTON_A ;
CharacterButton = wp - > btns_h & WPAD_BUTTON_MINUS ;
PauseButton = wp - > btns_h & WPAD_BUTTON_PLUS ;
DashButton = wp - > btns_h & WPAD_NUNCHUK_BUTTON_C ;
GrabButton = wp - > btns_h & WPAD_NUNCHUK_BUTTON_Z ;
ViewButton = wp - > btns_h & WPAD_BUTTON_1 ; // doesn't do anything?
SpeedButton = wp - > btns_h & WPAD_BUTTON_2 ;
}
2009-03-04 07:56:55 +01:00
# endif
2009-04-03 01:41:09 +02:00
// Gamecube controls are based on One Piece Grand Adventure
{
u32 gc = PAD_ButtonsHeld ( pad ) ;
signed char gc_px = PAD_SubStickX ( pad ) ;
if ( gc_px > 70 ) J | = VBA_SPEED ;
JumpButton = JumpButton | | gc & PAD_BUTTON_Y ;
AttackButton = AttackButton | | gc & PAD_BUTTON_A ;
GrabButton = GrabButton | | gc & PAD_BUTTON_B ;
AttackUpButton = AttackUpButton | | gc & PAD_BUTTON_X ;
DashButton = DashButton | | gc & PAD_TRIGGER_L ;
PauseButton = PauseButton | | gc & PAD_BUTTON_START ;
CharacterButton = CharacterButton | | gc & PAD_TRIGGER_R ; // supposed to be block
}
if ( JumpButton ) J | = VBA_BUTTON_A ;
if ( AttackButton ) J | = VBA_BUTTON_B ;
if ( AttackUpButton ) J | = VBA_UP | VBA_BUTTON_B ;
if ( CharacterButton ) J | = VBA_BUTTON_L ;
if ( DashButton ) J | = LastDir ;
if ( PauseButton ) J | = VBA_BUTTON_START ;
if ( GrabButton ) J | = VBA_BUTTON_R ;
if ( SpeedButton ) J | = VBA_SPEED ;
if ( ViewButton ) J | = VBA_BUTTON_SELECT ; // doesn't do anything?
if ( J & VBA_RIGHT ) LastDir = VBA_RIGHT ;
else if ( J & VBA_LEFT ) LastDir = VBA_LEFT ;
return J ;
}
2009-05-27 19:31:18 +02:00
u32 HobbitInput ( unsigned short pad ) {
2010-03-11 07:04:53 +01:00
// Only Nunchuk controls available
2009-05-27 19:31:18 +02:00
// Wiimote, Gamecube and Classic controls depend on user configuration
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad ) | DecodeGamecube ( pad ) |
DecodeWiimote ( pad ) | DecodeClassic ( pad ) ;
2009-05-27 19:31:18 +02:00
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_B ;
if ( AttackButton ) J | = VBA_BUTTON_L ;
if ( ChangeSkillButton ) J | = VBA_BUTTON_L ;
if ( ItemsButton ) J | = VBA_BUTTON_SELECT ;
if ( UseButton ) J | = VBA_BUTTON_A ;
if ( SpeedButton ) J | = VBA_BUTTON_R ;
if ( PauseButton ) J | = VBA_BUTTON_START ;
return J ;
}
u32 FellowshipOfTheRingInput ( unsigned short pad ) {
2010-03-11 07:04:53 +01:00
// Only Nunchuk controls available
2009-05-27 19:31:18 +02:00
// Wiimote, Gamecube and Classic controls depend on user configuration
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad ) | DecodeGamecube ( pad ) |
DecodeWiimote ( pad ) | DecodeClassic ( pad ) ;
2009-05-27 19:31:18 +02:00
bool CancelButton = 0 , UseButton = 0 , ChangeCharButton = 0 , PauseButton = 0 ,
ItemsButton = 0 , SpeedButton = 0 , SelectButton = 0 ;
# ifdef HW_RVL
WPADData * wp = WPAD_Data ( pad ) ;
// Nunchuk controls are made up
if ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) {
J | = StandardDPad ( pad ) ;
CancelButton = 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 ;
ChangeCharButton = wp - > btns_h & WPAD_NUNCHUK_BUTTON_Z ;
CancelButton = CancelButton | | ( fabs ( wp - > gforce . x ) > 1.5 ) ;
SelectButton = wp - > btns_h & WPAD_BUTTON_1 ;
}
# endif
2010-03-11 07:04:53 +01:00
2009-05-27 19:31:18 +02:00
if ( UseButton ) J | = VBA_BUTTON_A ;
if ( CancelButton ) J | = VBA_BUTTON_B ;
if ( ChangeCharButton ) J | = VBA_BUTTON_L ;
if ( ItemsButton ) J | = VBA_BUTTON_R ;
if ( SpeedButton ) J | = VBA_SPEED ;
if ( PauseButton ) J | = VBA_BUTTON_START ;
if ( SelectButton ) J | = VBA_BUTTON_SELECT ;
return J ;
}
u32 ReturnOfTheKingInput ( unsigned short pad ) {
2010-03-11 07:04:53 +01:00
// Only Nunchuk controls available
2009-05-27 19:31:18 +02:00
// Wiimote, Gamecube and Classic controls depend on user configuration
2010-03-11 07:04:53 +01:00
u32 J = StandardMovement ( pad ) | DecodeGamecube ( pad ) |
DecodeWiimote ( pad ) | DecodeClassic ( pad ) ;
2009-05-27 19:31:18 +02:00
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 ;
}
2009-05-28 00:20:21 +02:00
u32 CastlevaniaAdventureInput ( unsigned short pad ) {
// Only Nunchuk and Classic controls available
2010-03-11 07:04:53 +01:00
// Wiimote and Gamecube controls depend on user configuration
u32 J = StandardMovement ( pad ) | DecodeGamecube ( pad ) | DecodeWiimote ( pad ) | DecodeClassic ( pad ) ;
2009-05-28 00:20:21 +02:00
bool JumpButton = 0 , AttackButton = 0 , GuardButton = 0 , PauseButton = 0 , SelectButton = 0 , SpeedButton = 0 ;
# ifdef HW_RVL
WPADData * wp = WPAD_Data ( pad ) ;
// Nunchuk controls are based on Castlevania Wii
if ( wp - > exp . type = = WPAD_EXP_NUNCHUK ) {
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 ) ;
// Classic controls are based on ...?
} else if ( wp - > exp . type = = WPAD_EXP_CLASSIC ) {
AttackButton = wp - > btns_h & WPAD_CLASSIC_BUTTON_B ;
JumpButton = wp - > btns_h & ( WPAD_CLASSIC_BUTTON_FULL_R | WPAD_CLASSIC_BUTTON_ZR ) ;
GuardButton = wp - > btns_h & ( WPAD_CLASSIC_BUTTON_FULL_L | WPAD_CLASSIC_BUTTON_ZL ) ;
PauseButton = wp - > btns_h & WPAD_CLASSIC_BUTTON_PLUS ;
SelectButton = wp - > btns_h & WPAD_CLASSIC_BUTTON_MINUS ;
SpeedButton = wp - > btns_h & WPAD_CLASSIC_BUTTON_A ;
}
# endif
if ( JumpButton ) J | = VBA_BUTTON_A ;
if ( AttackButton ) J | = 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 ;
}
return J ;
}
u32 CastlevaniaBelmontInput ( unsigned short pad ) {
// Only Nunchuk and Classic controls available
2010-03-11 07:04:53 +01:00
// Wiimote and Gamecube controls depend on user configuration
u32 J = StandardMovement ( pad ) | DecodeGamecube ( pad ) | DecodeWiimote ( pad ) | DecodeClassic ( pad ) ;
2009-05-28 00:20:21 +02:00
bool JumpButton = 0 , AttackButton = 0 , ShootButton = 0 , GuardButton = 0 , PauseButton = 0 , SelectButton = 0 , SpeedButton = 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 ) ;
// 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 | WPAD_CLASSIC_BUTTON_ZR ) ;
GuardButton = wp - > btns_h & ( WPAD_CLASSIC_BUTTON_FULL_L | WPAD_CLASSIC_BUTTON_ZL ) ;
PauseButton = wp - > btns_h & WPAD_CLASSIC_BUTTON_PLUS ;
SelectButton = wp - > btns_h & WPAD_CLASSIC_BUTTON_MINUS ;
SpeedButton = wp - > btns_h & WPAD_CLASSIC_BUTTON_A ;
}
# endif
if ( JumpButton ) J | = VBA_BUTTON_A ;
if ( AttackButton ) {
J & = ~ VBA_UP ;
J | = 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 ;
}
return J ;
}
u32 CastlevaniaLegendsInput ( unsigned short pad ) {
// Only Nunchuk and Classic controls available
2010-03-11 07:04:53 +01:00
// Wiimote and Gamecube controls depend on user configuration
u32 J = StandardMovement ( pad ) | DecodeGamecube ( pad ) | DecodeWiimote ( pad ) | DecodeClassic ( pad ) ;
2009-05-28 00:20:21 +02:00
bool JumpButton = 0 , AttackButton = 0 , ShootButton = 0 , GuardButton = 0 , PauseButton = 0 , SelectButton = 0 , SpeedButton = 0 , HyperButton = 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 ;
// 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 | WPAD_CLASSIC_BUTTON_ZR ) ;
GuardButton = wp - > btns_h & ( WPAD_CLASSIC_BUTTON_FULL_L | WPAD_CLASSIC_BUTTON_ZL ) ;
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 ;
}
# 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 ;
}
return J ;
}
2009-05-28 01:05:14 +02:00
u32 CastlevaniaCircleMoonInput ( unsigned short pad ) {
// Only Nunchuk and Classic controls available
2010-03-11 07:04:53 +01:00
// Wiimote and Gamecube controls depend on user configuration
u32 J = StandardMovement ( pad ) | DecodeGamecube ( pad ) | DecodeWiimote ( pad ) | DecodeClassic ( pad ) ;
2009-05-28 01:05:14 +02:00
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 ;
}
2016-06-05 00:59:43 +02:00
u8 KD_NOR [ 64 ] = {
0x7f , 0x00 , 0x98 , 0x67 , 0x00 , 0x99 , 0x00 , 0x89 , 0x00 , 0xa1 , 0x00 , 0xb1 , 0x10 , 0xa9 , 0x18 , 0x67 ,
0xff , 0x00 , 0x81 , 0x7e , 0x00 , 0x81 , 0x00 , 0xb9 , 0x10 , 0xa9 , 0x00 , 0xb9 , 0x00 , 0x81 , 0x81 , 0x7e ,
0xfe , 0x00 , 0x03 , 0xfc , 0x01 , 0x82 , 0x00 , 0xb9 , 0x00 , 0xb9 , 0x01 , 0x82 , 0x00 , 0xb9 , 0x10 , 0xef ,
0x00 , 0x00 , 0x00 , 0x20 , 0x00 , 0x70 , 0x00 , 0x20 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 } ;
u8 KD_BAT [ 64 ] = {
0x7f , 0x00 , 0x83 , 0x7c , 0x01 , 0x82 , 0x00 , 0xb9 , 0x01 , 0x82 , 0x00 , 0xb9 , 0x00 , 0x81 , 0x01 , 0x7e ,
0xff , 0x00 , 0x81 , 0x7e , 0x00 , 0x81 , 0x00 , 0xb9 , 0x00 , 0xb9 , 0x00 , 0x81 , 0x00 , 0xb9 , 0x10 , 0xef ,
0xfe , 0x00 , 0x00 , 0xff , 0x00 , 0x81 , 0x00 , 0xe7 , 0xc3 , 0x24 , 0xc3 , 0x24 , 0xc3 , 0x24 , 0xc2 , 0x3c ,
0x00 , 0x00 , 0x00 , 0x20 , 0x00 , 0x70 , 0x00 , 0x20 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 } ;
u8 KD_ACTUAL [ 64 ] ;
u8 KD_NOR_GRAPHICS [ 128 ] = {
0x00 , 0x00 , 0x00 , 0x0f , 0x04 , 0x07 , 0x18 , 0x1f , 0x0d , 0x0e , 0x40 , 0x7f , 0x18 , 0x1f , 0x70 , 0x7f ,
0xc0 , 0xff , 0x70 , 0x7f , 0x01 , 0x3e , 0x0c , 0x0f , 0x3e , 0x3f , 0x10 , 0x1f , 0x06 , 0x07 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x18 , 0xe0 , 0xe4 , 0x18 , 0x3a , 0xc4 , 0xfc , 0x02 , 0x3d , 0xc2 , 0xfe , 0x01 , 0x3e , 0xc1 ,
0x7e , 0x81 , 0x3e , 0xc1 , 0xfd , 0x02 , 0x7c , 0x82 , 0x1a , 0xe4 , 0xe4 , 0x18 , 0x10 , 0xe0 , 0x00 , 0x00 ,
0x04 , 0x03 , 0x13 , 0x0c , 0x2f , 0x10 , 0x5f , 0x20 , 0x5f , 0x20 , 0x3f , 0x40 , 0x2a , 0x55 , 0x2a , 0x55 ,
0x08 , 0x77 , 0x00 , 0x7f , 0x28 , 0x7f , 0x1a , 0x5f , 0x13 , 0x17 , 0x01 , 0x05 , 0x05 , 0x05 , 0x00 , 0x00 ,
0x20 , 0xc0 , 0xc8 , 0x30 , 0xf4 , 0x08 , 0xf8 , 0x04 , 0xfa , 0x04 , 0xf4 , 0x0a , 0xb4 , 0x4a , 0x24 , 0xda ,
0x20 , 0xde , 0x0a , 0xfe , 0x1a , 0xfe , 0x18 , 0xfc , 0x4c , 0xec , 0x48 , 0xe8 , 0xc0 , 0xc0 , 0x80 , 0x80 } ;
u8 KD_ACTUAL_GRAPHICS [ 128 ] ;
bool KD_WeaponPressed = false ;
s8 KD_LastWeapon ; // -1 for selected weapon, 0 for NOR, 4 for BAT
u8 KD_ActualItem ; // Item selected by the player (byte in memory)
void KD_WeaponToMemory ( ) {
// If the fourth 8x8 tile of the weapon indicator doesn't contain the "+" icon I made, the weapon has been changed in the game and has to be updated in memory.
bool hasPlusIcon = true ;
for ( int i = 48 ; i < 64 ; i + + ) {
if ( gbReadMemory ( 0x9110 + i ) ! = KD_BAT [ i ] ) {
hasPlusIcon = false ;
break ;
}
}
if ( hasPlusIcon ) return ;
KD_ActualItem = gbReadMemory ( 0xC8CB ) ;
for ( int i = 0 ; i < 64 ; i + + ) {
KD_ACTUAL [ i ] = gbReadMemory ( 0x9110 + i ) ;
}
for ( int i = 0 ; i < 128 ; i + + ) {
KD_ACTUAL_GRAPHICS [ i ] = gbReadMemory ( 0x8f40 + i ) ;
}
}
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 ;
}