Skip to content

Commit

Permalink
config menu: Init KPAD if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Maschell committed Apr 28, 2024
1 parent 8071cea commit 6e02c4b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions source/utils/config/ConfigUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ void ConfigUtils::openConfigMenu() {

bool skipScreen0Free = false;
bool skipScreen1Free = false;
bool doShutdownKPAD = false;

if (!screenbuffer0 || !screenbuffer1) {
if (screenbuffer0 == nullptr) {
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 6e02c4b

Please sign in to comment.