Skip to content
New issue

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

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

Already on GitHub? # to your account

Explicit support for Motion Plus controllers #81

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 4 additions & 3 deletions source/patcher/hooks_patcher_static.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,13 @@ DECL_FUNCTION(void, WPADRead, WPADChan chan, WPADStatusProController *data) {

if (!sConfigMenuOpened && data[0].err == 0) {
if (data[0].extensionType != 0xFF) {
if (data[0].extensionType == WPAD_EXT_CORE || data[0].extensionType == WPAD_EXT_NUNCHUK) {
if (data[0].extensionType == WPAD_EXT_CORE || data[0].extensionType == WPAD_EXT_NUNCHUK ||
data[0].extensionType == WPAD_EXT_MPLUS || data[0].extensionType == WPAD_EXT_MPLUS_NUNCHUK) {
// button data is in the first 2 bytes for wiimotes
if (((uint16_t *) data)[0] == (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_MINUS)) {
sWantsToOpenConfigMenu = true;
}
} else if (data[0].extensionType == WPAD_EXT_CLASSIC) {
} else if (data[0].extensionType == WPAD_EXT_CLASSIC || data[0].extensionType == WPAD_EXT_MPLUS_CLASSIC) {
// TODO: figure out the real struct..
if ((((uint32_t *) data)[10] & 0xFFFF) == (WPAD_CLASSIC_BUTTON_L | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_MINUS)) {
sWantsToOpenConfigMenu = true;
Expand Down Expand Up @@ -219,4 +220,4 @@ function_replacement_data_t method_hooks_static[] __attribute__((section(".data"

};

uint32_t method_hooks_static_size __attribute__((section(".data"))) = sizeof(method_hooks_static) / sizeof(function_replacement_data_t);
uint32_t method_hooks_static_size __attribute__((section(".data"))) = sizeof(method_hooks_static) / sizeof(function_replacement_data_t);
5 changes: 3 additions & 2 deletions source/utils/input/WPADInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ class WPADInput : public Input {
return false;
}

if (kpad.extensionType == WPAD_EXT_CORE || kpad.extensionType == WPAD_EXT_NUNCHUK) {
if (kpad.extensionType == WPAD_EXT_CORE || kpad.extensionType == WPAD_EXT_NUNCHUK ||
kpad.extensionType == WPAD_EXT_MPLUS || kpad.extensionType == WPAD_EXT_MPLUS_NUNCHUK) {
data.buttons_r = remapWiiMoteButtons(kpad.release);
data.buttons_h = remapWiiMoteButtons(kpad.hold);
data.buttons_d = remapWiiMoteButtons(kpad.trigger);
Expand Down Expand Up @@ -184,4 +185,4 @@ class WPADInput : public Input {
KPADStatus kpad = {};
KPADError kpadError = KPAD_ERROR_UNINITIALIZED;
KPADChan channel;
};
};