From 6e02c4b7a1df8517f52d17920f50f276fba29f6b Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 28 Apr 2024 02:12:42 +0200 Subject: [PATCH] config menu: Init KPAD if needed --- source/utils/config/ConfigUtils.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/utils/config/ConfigUtils.cpp b/source/utils/config/ConfigUtils.cpp index 7837644..6824eb7 100644 --- a/source/utils/config/ConfigUtils.cpp +++ b/source/utils/config/ConfigUtils.cpp @@ -214,6 +214,7 @@ void ConfigUtils::openConfigMenu() { bool skipScreen0Free = false; bool skipScreen1Free = false; + bool doShutdownKPAD = false; if (!screenbuffer0 || !screenbuffer1) { if (screenbuffer0 == nullptr) { @@ -259,8 +260,19 @@ void ConfigUtils::openConfigMenu() { // disable the home button menu to prevent opening it when exiting OSEnableHomeButtonMenu(false); + KPADStatus status; + KPADError err; + if (KPADReadEx(WPAD_CHAN_0, &status, 0, &err) == 0 && err == KPAD_ERROR_UNINITIALIZED) { + doShutdownKPAD = true; + KPADInit(); + } + displayMenu(); + if (doShutdownKPAD) { + KPADShutdown(); + } + OSEnableHomeButtonMenu(wasHomeButtonMenuEnabled); DrawUtils::deinitFont();