re-add explicit Wii U Pro controller mappings

This commit is contained in:
Daryl Borth 2018-08-16 09:22:50 -06:00
parent 9f176ad0f0
commit 905f94b03e
8 changed files with 89 additions and 9 deletions

View File

@ -26,7 +26,7 @@
* and for displaying the name of said button
***/
CtrlrMap ctrlr_def[4] = {
CtrlrMap ctrlr_def[5] = {
// Gamecube controller btn def
{
CTRLR_GCPAD,
@ -114,5 +114,27 @@ CtrlrMap ctrlr_def[4] = {
{WPAD_CLASSIC_BUTTON_ZL, "ZL"},
{WPAD_CLASSIC_BUTTON_ZR, "ZR"}
}
},
// Wii U pro controller
{
CTRLR_WUPC,
15,
{
{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"}
}
}
};

View File

@ -18,11 +18,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][32] =
{ "GameCube Controller", "Wiimote", "Nunchuk + Wiimote", "Classic Controller", "Wii U Pro Controller" };
typedef struct _btn_map {
u32 btn; // button 'id'
@ -35,6 +36,6 @@ typedef struct _ctrlr_map {
BtnMap map[15]; // controller button map
} CtrlrMap;
extern CtrlrMap ctrlr_def[4];
extern CtrlrMap ctrlr_def[5];
#endif

View File

@ -107,6 +107,8 @@ extern const u8 icon_settings_gamecube_png[];
extern const u32 icon_settings_gamecube_png_size;
extern const u8 icon_settings_nunchuk_png[];
extern const u32 icon_settings_nunchuk_png_size;
extern const u8 icon_settings_wiiupro_png[];
extern const u32 icon_settings_wiiupro_png_size;
extern const u8 icon_settings_nescontroller_png[];
extern const u32 icon_settings_nescontroller_png_size;

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -2322,6 +2322,7 @@ static int MenuSettingsMappingsController()
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);
@ -2341,6 +2342,24 @@ static int MenuSettingsMappingsController()
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);
GuiImage wiimoteBtnImgOver(&btnLargeOutlineOver);
@ -2427,6 +2446,7 @@ static int MenuSettingsMappingsController()
{
w.Append(&nunchukBtn);
w.Append(&classicBtn);
w.Append(&wiiuproBtn);
}
#endif
w.Append(&backBtn);
@ -2454,6 +2474,11 @@ static int MenuSettingsMappingsController()
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;
@ -2507,6 +2532,9 @@ ButtonMappingWindow()
case CTRLR_CLASSIC:
sprintf(msg, "Press any button on the Classic Controller now. Press Home to clear the existing mapping.");
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_NUNCHUK:
sprintf(msg, "Press any button on the Wiimote or Nunchuk now. Press Home to clear the existing mapping.");
break;
@ -2561,10 +2589,16 @@ ButtonMappingWindow()
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:

View File

@ -39,7 +39,7 @@ static unsigned int myzappers[2][3];
u32 nespadmap[11]; // Original NES controller buttons
u32 zapperpadmap[11]; // Original NES Zapper controller buttons
u32 btnmap[2][4][12]; // button mapping
u32 btnmap[2][5][12]; // button mapping
void ResetControls(int consoleCtrl, int wiiCtrl)
{
@ -111,6 +111,23 @@ void ResetControls(int consoleCtrl, int wiiCtrl)
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_FULL_L;
}
/*** Classic Controller Padmap ***/
if(consoleCtrl == -1 || (consoleCtrl == CTRL_PAD && wiiCtrl == CTRLR_WUPC))
{
i=0;
btnmap[CTRL_PAD][CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_Y;
btnmap[CTRL_PAD][CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_B;
btnmap[CTRL_PAD][CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_X;
btnmap[CTRL_PAD][CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_A;
btnmap[CTRL_PAD][CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_MINUS;
btnmap[CTRL_PAD][CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_PLUS;
btnmap[CTRL_PAD][CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_UP;
btnmap[CTRL_PAD][CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_DOWN;
btnmap[CTRL_PAD][CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_LEFT;
btnmap[CTRL_PAD][CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_RIGHT;
btnmap[CTRL_PAD][CTRLR_WUPC][i++] = WPAD_CLASSIC_BUTTON_FULL_L;
}
/*** Nunchuk + wiimote Padmap ***/
if(consoleCtrl == -1 || (consoleCtrl == CTRL_PAD && wiiCtrl == CTRLR_NUNCHUK))
{
@ -366,6 +383,7 @@ static unsigned char DecodeJoy(unsigned short chan)
s8 wm_ax = userInput[chan].WPAD_StickX(0);
s8 wm_ay = userInput[chan].WPAD_StickY(0);
u32 wp = userInput[chan].wpad->btns_h;
bool isWUPC = userInput[chan].wpad->exp.classic.type == 2;
u32 exp_type;
if ( WPAD_Probe(chan, &exp_type) != 0 )
@ -468,7 +486,8 @@ static unsigned char DecodeJoy(unsigned short chan)
if ( (jp & btnmap[CTRL_PAD][CTRLR_GCPAD][i]) // gamecube controller
#ifdef HW_RVL
|| ( (exp_type == WPAD_EXP_NONE) && (wp & btnmap[CTRL_PAD][CTRLR_WIIMOTE][i]) ) // wiimote
|| ( (exp_type == WPAD_EXP_CLASSIC) && (wp & btnmap[CTRL_PAD][CTRLR_CLASSIC][i]) ) // classic controller
|| ( (exp_type == WPAD_EXP_CLASSIC && !isWUPC) && (wp & btnmap[CTRL_PAD][CTRLR_CLASSIC][i]) ) // classic controller
|| ( (exp_type == WPAD_EXP_CLASSIC && isWUPC) && (wp & btnmap[CTRL_PAD][CTRLR_WUPC][i]) ) // wii u pro controller
|| ( (exp_type == WPAD_EXP_NUNCHUK) && (wp & btnmap[CTRL_PAD][CTRLR_NUNCHUK][i]) ) // nunchuk + wiimote
#endif
)

View File

@ -22,7 +22,7 @@
#define RAPID_B 512
extern int rumbleRequest[4];
extern u32 btnmap[2][4][12];
extern u32 btnmap[2][5][12];
void SetControllers();
void ResetControls(int cc = -1, int wc = -1);

View File

@ -173,6 +173,7 @@ preparePrefsData ()
createXMLController(btnmap[CTRL_PAD][CTRLR_GCPAD], "btnmap_pad_gcpad", "NES Pad - GameCube Controller");
createXMLController(btnmap[CTRL_PAD][CTRLR_WIIMOTE], "btnmap_pad_wiimote", "NES Pad - Wiimote");
createXMLController(btnmap[CTRL_PAD][CTRLR_CLASSIC], "btnmap_pad_classic", "NES Pad - Classic Controller");
createXMLController(btnmap[CTRL_PAD][CTRLR_WUPC], "btnmap_pad_wupc", "NES Pad - Wii U Pro Controller");
createXMLController(btnmap[CTRL_PAD][CTRLR_NUNCHUK], "btnmap_pad_nunchuk", "NES Pad - Nunchuk + Wiimote");
createXMLController(btnmap[CTRL_ZAPPER][CTRLR_GCPAD], "btnmap_zapper_gcpad", "Zapper - GameCube Controller");
createXMLController(btnmap[CTRL_ZAPPER][CTRLR_WIIMOTE], "btnmap_zapper_wiimote", "Zapper - Wiimote");
@ -340,6 +341,7 @@ decodePrefsData ()
loadXMLController(btnmap[CTRL_PAD][CTRLR_GCPAD], "btnmap_pad_gcpad");
loadXMLController(btnmap[CTRL_PAD][CTRLR_WIIMOTE], "btnmap_pad_wiimote");
loadXMLController(btnmap[CTRL_PAD][CTRLR_CLASSIC], "btnmap_pad_classic");
loadXMLController(btnmap[CTRL_PAD][CTRLR_WUPC], "btnmap_pad_wupc");
loadXMLController(btnmap[CTRL_PAD][CTRLR_NUNCHUK], "btnmap_pad_nunchuk");
loadXMLController(btnmap[CTRL_ZAPPER][CTRLR_GCPAD], "btnmap_zapper_gcpad");
loadXMLController(btnmap[CTRL_ZAPPER][CTRLR_WIIMOTE], "btnmap_zapper_wiimote");