diff --git a/source/BootUtils.cpp b/source/BootUtils.cpp index eacdb77..bf8ad4b 100644 --- a/source/BootUtils.cpp +++ b/source/BootUtils.cpp @@ -1,6 +1,5 @@ #include "BootUtils.h" #include "ACTAccountInfo.h" -#include "DrawUtils.h" #include "MenuUtils.h" #include "logger.h" #include @@ -12,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -74,6 +74,9 @@ void handleAccountSelection() { } if (accountInfoList.size() > 0) { + if (!AXIsInit()) { + AXInit(); + } auto slot = handleAccountSelectScreen(accountInfoList); DEBUG_FUNCTION_LINE("Load slot %d", slot); diff --git a/source/MenuUtils.cpp b/source/MenuUtils.cpp index 7a9220f..cf30865 100644 --- a/source/MenuUtils.cpp +++ b/source/MenuUtils.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -528,6 +529,9 @@ bool handleDiscInsertScreen(uint64_t expectedTitleId, uint64_t *titleIdToLaunch) return true; } + if (!AXIsInit()) { + AXInit(); + } // When an unexpected disc was inserted we need to eject it first. bool allowDisc = !wrongDiscInserted; diff --git a/source/main.cpp b/source/main.cpp index 5d9ca95..435ff0b 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -36,8 +36,6 @@ bool gUpdatesBlocked = false; int32_t main(int32_t argc, char **argv) { initLogging(); DEBUG_FUNCTION_LINE("Hello from Autoboot Module"); - AXInit(); - AXQuit(); InputUtils::Init(); @@ -79,6 +77,9 @@ int32_t main(int32_t argc, char **argv) { if (FSAOpenDir(client, "/vol/storage_mlc01/sys/update", &dirHandle) >= 0) { FSACloseDir(client, dirHandle); gUpdatesBlocked = false; + if (!AXIsInit()) { + AXInit(); + } handleUpdateWarningScreen(); } else { FSAStat st{}; @@ -127,6 +128,9 @@ int32_t main(int32_t argc, char **argv) { (bootSelection == BOOT_OPTION_HOMEBREW_LAUNCHER && !showHBL) || (bootSelection == BOOT_OPTION_VWII_HOMEBREW_CHANNEL && !showvHBL) || (buttons.hold & VPAD_BUTTON_PLUS)) { + if (!AXIsInit()) { + AXInit(); + } bootSelection = handleMenuScreen(configPath, bootSelection, menu); } @@ -163,6 +167,10 @@ int32_t main(int32_t argc, char **argv) { InputUtils::DeInit(); Mocha_DeInitLibrary(); deinitLogging(); + if (AXIsInit()) { + AXQuit(); + } + return 0; }