Fix opening the config menu with the classic controller

This commit is contained in:
Maschell 2022-09-19 15:57:29 +02:00
parent 5da5c0e117
commit c89db187b6

View File

@ -86,15 +86,21 @@ DECL_FUNCTION(void, WPADRead, WPADChan chan, WPADStatusProController *data) {
real_WPADRead(chan, data); real_WPADRead(chan, data);
if (!configMenuOpened && data[0].err == 0) { if (!configMenuOpened && data[0].err == 0) {
if (data[0].extensionType == WPAD_EXT_CORE || data[0].extensionType == WPAD_EXT_NUNCHUK) { if (data[0].extensionType != 0xFF) {
// button data is in the first 2 bytes for wiimotes if (data[0].extensionType == WPAD_EXT_CORE || data[0].extensionType == WPAD_EXT_NUNCHUK) {
if (((uint16_t *) data)[0] == (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_MINUS)) { // button data is in the first 2 bytes for wiimotes
wantsToOpenConfigMenu = true; if (((uint16_t *) data)[0] == (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_MINUS)) {
} wantsToOpenConfigMenu = true;
} else { }
// TODO does this work for classic controllers? } else if (data[0].extensionType == WPAD_EXT_CLASSIC) {
if (data[0].buttons == (WPAD_CLASSIC_BUTTON_L | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_MINUS)) { // TODO: figure out the real struct..
wantsToOpenConfigMenu = true; if ((((uint32_t *) data)[10] & 0xFFFF) == (WPAD_CLASSIC_BUTTON_L | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_MINUS)) {
wantsToOpenConfigMenu = true;
}
} else if (data[0].extensionType == WPAD_EXT_PRO_CONTROLLER) {
if (data[0].buttons == (WPAD_PRO_TRIGGER_L | WPAD_PRO_BUTTON_DOWN | WPAD_PRO_BUTTON_MINUS)) {
wantsToOpenConfigMenu = true;
}
} }
} }
} }