Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DRC (Wii U GamePad) support (FIX94, emukidid) #1

Merged
merged 1 commit into from
Dec 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions libgui/FocusManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Focus::Focus()
{
for (int i=0; i<4; i++) {
previousButtonsWii[i] = 0;
previousButtonsDRC[i] = 0;
previousButtonsGC[i] = 0;
}
}
Expand Down Expand Up @@ -71,6 +72,7 @@ void Focus::updateFocus()
previousButtonsGC[i] = PAD_ButtonsHeld(i);
#ifdef HW_RVL
previousButtonsWii[i] = WPAD_ButtonsHeld(i);
previousButtonsDRC[i] = (i == 0 ? WiiDRC_ButtonsHeld() : 0);
#endif
}
clearInput = false;
Expand Down Expand Up @@ -213,6 +215,38 @@ void Focus::updateFocus()
else primaryFocusOwner = currentFrame->updateFocus(focusDirection,buttonsDown);
break;
}

else if (i == 0 && WiiDRC_Inited() && WiiDRC_Connected() && (WiiDRC_ButtonsHeld() ^ previousButtonsDRC[i]))
{
u32 currentButtonsDownDRC = (WiiDRC_ButtonsHeld() ^ previousButtonsDRC[i]) & WiiDRC_ButtonsHeld();
previousButtonsDRC[i] = WiiDRC_ButtonsHeld();
switch (currentButtonsDownDRC) {
case WIIDRC_BUTTON_LEFT:
focusDirection = DIRECTION_LEFT;
break;
case WIIDRC_BUTTON_RIGHT:
focusDirection = DIRECTION_RIGHT;
break;
case WIIDRC_BUTTON_DOWN:
focusDirection = DIRECTION_DOWN;
break;
case WIIDRC_BUTTON_UP:
focusDirection = DIRECTION_UP;
break;
default:
focusDirection = DIRECTION_NONE;
}
if (currentButtonsDownDRC & (WIIDRC_BUTTON_A)) buttonsDown |= ACTION_SELECT;
if (currentButtonsDownDRC & (WIIDRC_BUTTON_B)) buttonsDown |= ACTION_BACK;
if (freezeAction)
{
focusDirection = DIRECTION_NONE;
buttonsDown = 0;
}
if (primaryFocusOwner) primaryFocusOwner = primaryFocusOwner->updateFocus(focusDirection,buttonsDown);
else primaryFocusOwner = currentFrame->updateFocus(focusDirection,buttonsDown);
break;
}
#endif
}
}
Expand Down