mirror of
https://github.com/dborth/vbagx.git
synced 2024-12-27 03:01:50 +01:00
commit
220326cd47
@ -24,7 +24,7 @@
|
||||
* and for displaying the name of said button
|
||||
***************************************************************************/
|
||||
|
||||
CtrlrMap ctrlr_def[4] = {
|
||||
CtrlrMap ctrlr_def[5] = {
|
||||
// Gamecube controller btn def
|
||||
{
|
||||
{
|
||||
@ -112,5 +112,27 @@ CtrlrMap ctrlr_def[4] = {
|
||||
},
|
||||
15,
|
||||
CTRLR_CLASSIC
|
||||
},
|
||||
// Wii U pro controller
|
||||
{
|
||||
{
|
||||
{WPAD_CLASSIC_BUTTON_DOWN, "DOWN"},
|
||||
{WPAD_CLASSIC_BUTTON_UP, "UP"},
|
||||
{WPAD_CLASSIC_BUTTON_LEFT, "LEFT"},
|
||||
{WPAD_CLASSIC_BUTTON_RIGHT, "RIGHT"},
|
||||
{WPAD_CLASSIC_BUTTON_A, "A"},
|
||||
{WPAD_CLASSIC_BUTTON_B, "B"},
|
||||
{WPAD_CLASSIC_BUTTON_X, "X"},
|
||||
{WPAD_CLASSIC_BUTTON_Y, "Y"},
|
||||
{WPAD_CLASSIC_BUTTON_PLUS, "PLUS"},
|
||||
{WPAD_CLASSIC_BUTTON_MINUS, "MINUS"},
|
||||
{WPAD_CLASSIC_BUTTON_HOME, "HOME"},
|
||||
{WPAD_CLASSIC_BUTTON_FULL_L, "L"},
|
||||
{WPAD_CLASSIC_BUTTON_FULL_R, "R"},
|
||||
{WPAD_CLASSIC_BUTTON_ZL, "ZL"},
|
||||
{WPAD_CLASSIC_BUTTON_ZR, "ZR"}
|
||||
},
|
||||
15,
|
||||
CTRLR_WUPC
|
||||
}
|
||||
};
|
||||
|
@ -16,11 +16,12 @@ enum {
|
||||
CTRLR_GCPAD,
|
||||
CTRLR_WIIMOTE,
|
||||
CTRLR_NUNCHUK,
|
||||
CTRLR_CLASSIC
|
||||
CTRLR_CLASSIC,
|
||||
CTRLR_WUPC
|
||||
};
|
||||
|
||||
const char ctrlrName[4][20] =
|
||||
{ "GameCube Controller", "Wiimote", "Nunchuk + Wiimote", "Classic Controller" };
|
||||
const char ctrlrName[5][0x20] =
|
||||
{ "GameCube Controller", "Wiimote", "Nunchuk + Wiimote", "Classic Controller", "Wii U Pro Controller" };
|
||||
|
||||
typedef struct _btn_map {
|
||||
u32 btn; // button 'id'
|
||||
@ -33,6 +34,6 @@ typedef struct _ctrlr_map {
|
||||
u16 type; // controller type
|
||||
} CtrlrMap;
|
||||
|
||||
extern CtrlrMap ctrlr_def[4];
|
||||
extern CtrlrMap ctrlr_def[5];
|
||||
|
||||
#endif
|
||||
|
BIN
source/images/icon_settings_wiiupro.png
Normal file
BIN
source/images/icon_settings_wiiupro.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
@ -43,7 +43,7 @@ static bool cartridgeRumble = false, possibleCartridgeRumble = false;
|
||||
static int gameRumbleCount = 0, menuRumbleCount = 0, rumbleCountAlready = 0;
|
||||
|
||||
static unsigned int vbapadmap[10]; // VBA controller buttons
|
||||
u32 btnmap[4][10]; // button mapping
|
||||
u32 btnmap[5][10]; // button mapping
|
||||
|
||||
void ResetControls(int wiiCtrl)
|
||||
{
|
||||
@ -126,6 +126,21 @@ void ResetControls(int wiiCtrl)
|
||||
btnmap[CTRLR_NUNCHUK][i++] = WPAD_BUTTON_2;
|
||||
btnmap[CTRLR_NUNCHUK][i++] = WPAD_BUTTON_1;
|
||||
}
|
||||
/*** Wii U Pro Padmap ***/
|
||||
if(wiiCtrl == CTRLR_WUPC || wiiCtrl == -1)
|
||||
{
|
||||
i=0;
|
||||
btnmap[CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_Y;
|
||||
btnmap[CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_B;
|
||||
btnmap[CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_MINUS;
|
||||
btnmap[CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_PLUS;
|
||||
btnmap[CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_UP;
|
||||
btnmap[CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_DOWN;
|
||||
btnmap[CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_LEFT;
|
||||
btnmap[CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_RIGHT;
|
||||
btnmap[CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_FULL_L;
|
||||
btnmap[CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_FULL_R;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -538,9 +553,17 @@ u32 DecodeClassic(unsigned short pad)
|
||||
u32 wpad_btns_h = wp->btns_h;
|
||||
|
||||
if(wp->exp.type == WPAD_EXP_CLASSIC){
|
||||
for (u32 i = 0; i < MAXJP; ++i){
|
||||
if (wpad_btns_h & btnmap[CTRLR_CLASSIC][i] )
|
||||
J |= vbapadmap[i];
|
||||
if (wp->exp.classic.type == 2) {
|
||||
for (u32 i = 0; i < MAXJP; ++i){
|
||||
if (wpad_btns_h & btnmap[CTRLR_WUPC][i] )
|
||||
J |= vbapadmap[i];
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (u32 i = 0; i < MAXJP; ++i){
|
||||
if (wpad_btns_h & btnmap[CTRLR_CLASSIC][i] )
|
||||
J |= vbapadmap[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -551,9 +574,10 @@ u32 DecodeNunchuk(unsigned short pad)
|
||||
{
|
||||
u32 J = 0;
|
||||
#ifdef HW_RVL
|
||||
u32 wpad_btns_h = userInput[pad].wpad->btns_h;
|
||||
WPADData * wp = WPAD_Data(pad);
|
||||
u32 wpad_btns_h = wp->btns_h;
|
||||
|
||||
if(userInput[pad].wpad->exp.type == WPAD_EXP_NUNCHUK){
|
||||
if(wp->exp.type == WPAD_EXP_NUNCHUK){
|
||||
for (u32 i = 0; i < MAXJP; ++i){
|
||||
if (wpad_btns_h & btnmap[CTRLR_NUNCHUK][i] )
|
||||
J |= vbapadmap[i];
|
||||
@ -830,6 +854,7 @@ static u32 DecodeJoy(unsigned short pad)
|
||||
#ifdef HW_RVL
|
||||
u32 wpad_btns_h = userInput[pad].wpad->btns_h;
|
||||
int wpad_exp_type = userInput[pad].wpad->exp.type;
|
||||
bool isWUPC = userInput[pad].wpad->exp.classic.type == 2;
|
||||
|
||||
if(wpad_exp_type == WPAD_EXP_NONE)
|
||||
{ // wiimote
|
||||
@ -844,16 +869,23 @@ static u32 DecodeJoy(unsigned short pad)
|
||||
}
|
||||
else if(wpad_exp_type == WPAD_EXP_CLASSIC)
|
||||
{ // classic controller
|
||||
|
||||
for (u32 i =0; i < MAXJP; ++i)
|
||||
{
|
||||
if ((pad_btns_h & btnmap[CTRLR_GCPAD][i]) // gamecube controller
|
||||
|| ( (wpad_btns_h & btnmap[CTRLR_CLASSIC][i]) ))
|
||||
J |= vbapadmap[i];
|
||||
if (isWUPC) {
|
||||
for (u32 i =0; i < MAXJP; ++i)
|
||||
{
|
||||
if ((pad_btns_h & btnmap[CTRLR_GCPAD][i]) // gamecube controller
|
||||
|| ( (wpad_btns_h & btnmap[CTRLR_WUPC][i]) ))
|
||||
J |= vbapadmap[i];
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (u32 i =0; i < MAXJP; ++i)
|
||||
{
|
||||
if ((pad_btns_h & btnmap[CTRLR_GCPAD][i]) // gamecube controller
|
||||
|| ( (wpad_btns_h & btnmap[CTRLR_CLASSIC][i]) ))
|
||||
J |= vbapadmap[i];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if(wpad_exp_type == WPAD_EXP_NUNCHUK)
|
||||
{ // nunchuk + wiimote
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
#define VBA_CAPTURE 2048
|
||||
|
||||
extern int rumbleRequest[4];
|
||||
extern u32 btnmap[4][10];
|
||||
extern u32 btnmap[5][10];
|
||||
|
||||
void ResetControls(int wc = -1);
|
||||
void ShutoffRumble();
|
||||
|
@ -2082,7 +2082,7 @@ static int MenuSettingsMappings()
|
||||
GuiImageData iconClassic(icon_settings_classic_png);
|
||||
GuiImageData iconGamecube(icon_settings_gamecube_png);
|
||||
GuiImageData iconNunchuk(icon_settings_nunchuk_png);
|
||||
|
||||
GuiImageData iconWiiupro(icon_settings_wiiupro_png);
|
||||
GuiText gamecubeBtnTxt("GameCube Controller", 22, (GXColor){0, 0, 0, 255});
|
||||
gamecubeBtnTxt.SetWrap(true, btnLargeOutline.GetWidth()-30);
|
||||
GuiImage gamecubeBtnImg(&btnLargeOutline);
|
||||
@ -2100,6 +2100,24 @@ static int MenuSettingsMappings()
|
||||
gamecubeBtn.SetTrigger(trigA);
|
||||
gamecubeBtn.SetTrigger(trig2);
|
||||
gamecubeBtn.SetEffectGrow();
|
||||
|
||||
GuiText wiiuproBtnTxt("Wii U Pro Controller", 22, (GXColor){0, 0, 0, 255});
|
||||
wiiuproBtnTxt.SetWrap(true, btnLargeOutline.GetWidth()-20);
|
||||
GuiImage wiiuproBtnImg(&btnLargeOutline);
|
||||
GuiImage wiiuproBtnImgOver(&btnLargeOutlineOver);
|
||||
GuiImage wiiuproBtnIcon(&iconWiiupro);
|
||||
GuiButton wiiuproBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
||||
wiiuproBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
wiiuproBtn.SetPosition(0, 250);
|
||||
wiiuproBtn.SetLabel(&wiiuproBtnTxt);
|
||||
wiiuproBtn.SetImage(&wiiuproBtnImg);
|
||||
wiiuproBtn.SetImageOver(&wiiuproBtnImgOver);
|
||||
wiiuproBtn.SetIcon(&wiiuproBtnIcon);
|
||||
wiiuproBtn.SetSoundOver(&btnSoundOver);
|
||||
wiiuproBtn.SetSoundClick(&btnSoundClick);
|
||||
wiiuproBtn.SetTrigger(trigA);
|
||||
wiiuproBtn.SetTrigger(trig2);
|
||||
wiiuproBtn.SetEffectGrow();
|
||||
|
||||
GuiText wiimoteBtnTxt("Wiimote", 22, (GXColor){0, 0, 0, 255});
|
||||
GuiImage wiimoteBtnImg(&btnLargeOutline);
|
||||
@ -2183,6 +2201,7 @@ static int MenuSettingsMappings()
|
||||
w.Append(&wiimoteBtn);
|
||||
w.Append(&nunchukBtn);
|
||||
w.Append(&classicBtn);
|
||||
w.Append(&wiiuproBtn);
|
||||
#endif
|
||||
w.Append(&backBtn);
|
||||
|
||||
@ -2209,6 +2228,11 @@ static int MenuSettingsMappings()
|
||||
menu = MENU_GAMESETTINGS_MAPPINGS_MAP;
|
||||
mapMenuCtrl = CTRLR_CLASSIC;
|
||||
}
|
||||
else if(wiiuproBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
menu = MENU_GAMESETTINGS_MAPPINGS_MAP;
|
||||
mapMenuCtrl = CTRLR_WUPC;
|
||||
}
|
||||
else if(gamecubeBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
menu = MENU_GAMESETTINGS_MAPPINGS_MAP;
|
||||
@ -2256,6 +2280,9 @@ ButtonMappingWindow()
|
||||
sprintf(msg, "Press any button on the GameCube Controller now. Press the C-Stick in any direction to clear the existing mapping.");
|
||||
#endif
|
||||
break;
|
||||
case CTRLR_WUPC:
|
||||
sprintf(msg, "Press any button on the Wii U Pro Controller now. Press Home to clear the existing mapping.");
|
||||
break;
|
||||
case CTRLR_WIIMOTE:
|
||||
sprintf(msg, "Press any button on the Wiimote now. Press Home to clear the existing mapping.");
|
||||
break;
|
||||
@ -2315,14 +2342,18 @@ ButtonMappingWindow()
|
||||
if(pressed > 0x1000)
|
||||
pressed = 0; // not a valid input
|
||||
break;
|
||||
|
||||
case CTRLR_CLASSIC:
|
||||
if(userInput[0].wpad->exp.type != WPAD_EXP_CLASSIC)
|
||||
if(userInput[0].wpad->exp.type != WPAD_EXP_CLASSIC && userInput[0].wpad->exp.classic.type < 2)
|
||||
pressed = 0; // not a valid input
|
||||
else if(pressed <= 0x1000)
|
||||
pressed = 0;
|
||||
break;
|
||||
case CTRLR_WUPC:
|
||||
if(userInput[0].wpad->exp.type != WPAD_EXP_CLASSIC && userInput[0].wpad->exp.classic.type == 2)
|
||||
pressed = 0; // not a valid input
|
||||
else if(pressed <= 0x1000)
|
||||
pressed = 0;
|
||||
break;
|
||||
|
||||
case CTRLR_NUNCHUK:
|
||||
if(userInput[0].wpad->exp.type != WPAD_EXP_NUNCHUK)
|
||||
pressed = 0; // not a valid input
|
||||
|
@ -222,6 +222,7 @@ preparePrefsData ()
|
||||
createXMLController(btnmap[CTRLR_WIIMOTE], "wmpadmap", "Wiimote");
|
||||
createXMLController(btnmap[CTRLR_CLASSIC], "ccpadmap", "Classic Controller");
|
||||
createXMLController(btnmap[CTRLR_NUNCHUK], "ncpadmap", "Nunchuk");
|
||||
createXMLController(btnmap[CTRLR_WUPC], "wupcpadmap", "Wii U Pro Controller");
|
||||
|
||||
createXMLSection("Emulation", "Emulation Settings");
|
||||
|
||||
@ -530,6 +531,7 @@ decodePrefsData ()
|
||||
loadXMLController(btnmap[CTRLR_WIIMOTE], "wmpadmap");
|
||||
loadXMLController(btnmap[CTRLR_CLASSIC], "ccpadmap");
|
||||
loadXMLController(btnmap[CTRLR_NUNCHUK], "ncpadmap");
|
||||
loadXMLController(btnmap[CTRLR_WUPC], "wupcpadmap");
|
||||
|
||||
// Emulation Settings
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user