config menu: Init KPAD if needed

This commit is contained in:
Maschell 2024-04-28 02:12:42 +02:00
parent 8071ceabf4
commit 6e02c4b7a1

View File

@ -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();