From 0b87b978f2178443c41ca295a639b67a5ad2daa5 Mon Sep 17 00:00:00 2001 From: Maschell Date: Mon, 19 Sep 2022 15:09:13 +0200 Subject: [PATCH] Fix KPAD input in menu --- src/ConfigUtils.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ConfigUtils.cpp b/src/ConfigUtils.cpp index bf7977c..0c86d3d 100644 --- a/src/ConfigUtils.cpp +++ b/src/ConfigUtils.cpp @@ -191,6 +191,9 @@ void ConfigUtils::displayMenu() { int32_t curRegionIndex = region_map_to_index[curSelectedRegion]; int32_t curLangIndex = lang_map_to_index[curSelectedLanguage]; + KPADInit(); + WPADEnableURCC(true); + while (true) { buttonsTriggered = 0; buttonsReleased = 0; @@ -203,7 +206,7 @@ void ConfigUtils::displayMenu() { for (int i = 0; i < 4; i++) { if (KPADReadEx((KPADChan) i, &kpad_data, 1, &kpad_error) > 0) { - if (kpad_error == KPAD_ERROR_OK) { + if (kpad_error == KPAD_ERROR_OK || kpad_data.extensionType == 0xFF) { if (kpad_data.extensionType == WPAD_EXT_CORE || kpad_data.extensionType == WPAD_EXT_NUNCHUK) { buttonsTriggered |= remapWiiMoteButtons(kpad_data.trigger); buttonsReleased |= remapWiiMoteButtons(kpad_data.release); @@ -323,6 +326,10 @@ void ConfigUtils::displayMenu() { redraw = false; } } + KPADShutdown(); + // This disconnects any Pro Controllers... + //WPADEnableURCC(false); + DrawUtils::beginDraw(); DrawUtils::clear(COLOR_BLACK); DrawUtils::endDraw();