From 106c485fb1bf8ee8d893fbe596fabb4473df41d0 Mon Sep 17 00:00:00 2001 From: Maschell Date: Thu, 25 Aug 2022 18:39:06 +0200 Subject: [PATCH] Hide vWii Homebrew Channel from list when not installed --- source/MenuUtils.cpp | 11 ++++++++++- source/MenuUtils.h | 2 +- source/main.cpp | 18 +++++++++++++----- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/source/MenuUtils.cpp b/source/MenuUtils.cpp index 2cc2eb8..d3e779b 100644 --- a/source/MenuUtils.cpp +++ b/source/MenuUtils.cpp @@ -69,7 +69,7 @@ void writeAutobootOption(std::string &configPath, int32_t autobootOption) { } } -int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput, bool showHBL) { +int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput, bool showHBL, bool showvHBL) { auto screenBuffer = DrawUtils::InitOSScreen(); if (!screenBuffer) { OSFatal("Failed to alloc memory for screen"); @@ -94,6 +94,9 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput, b if (!showHBL && selected == BOOT_OPTION_HOMEBREW_LAUNCHER) { selected--; } + if (!showvHBL && selected == BOOT_OPTION_VWII_HOMEBREW_CHANNEL) { + selected--; + } redraw = true; } @@ -103,6 +106,9 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput, b if (!showHBL && selected == BOOT_OPTION_HOMEBREW_LAUNCHER) { selected++; } + if (!showvHBL && selected == BOOT_OPTION_VWII_HOMEBREW_CHANNEL) { + selected++; + } redraw = true; } } else if (vpad.trigger & VPAD_BUTTON_A) { @@ -125,6 +131,9 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput, b if (!showHBL && i == BOOT_OPTION_HOMEBREW_LAUNCHER) { continue; } + if (!showvHBL && i == BOOT_OPTION_VWII_HOMEBREW_CHANNEL) { + continue; + } if (i == selected) { DrawUtils::drawRect(16, index, SCREEN_WIDTH - 16 * 2, 44, 4, COLOR_BORDER_HIGHLIGHTED); } else { diff --git a/source/MenuUtils.h b/source/MenuUtils.h index 18b38e5..79c5b42 100644 --- a/source/MenuUtils.h +++ b/source/MenuUtils.h @@ -27,6 +27,6 @@ int32_t readAutobootOption(std::string &configPath); void writeAutobootOption(std::string &configPath, int32_t autobootOption); -int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput, bool showHBL); +int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput, bool showHBL, bool showvHBL); nn::act::SlotNo handleAccountSelectScreen(const std::vector> &data); \ No newline at end of file diff --git a/source/main.cpp b/source/main.cpp index bde7ef9..e582270 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,4 +1,6 @@ +#include "BootUtils.h" #include "DrawUtils.h" +#include "MenuUtils.h" #include "QuickStartUtils.h" #include "StorageUtils.h" #include "logger.h" @@ -10,9 +12,6 @@ #include #include -#include "BootUtils.h" -#include "MenuUtils.h" - void clearScreen() { auto buffer = DrawUtils::InitOSScreen(); if (!buffer) { @@ -44,6 +43,7 @@ int32_t main(int32_t argc, char **argv) { OSFatal("AutobootModule: Mocha_InitLibrary failed"); } + bool showvHBL = getVWiiHBLTitleId() != 0; bool showHBL = false; std::string configPath = "fs:/vol/external01/wiiu/autoboot.cfg"; if (argc >= 1) { @@ -61,8 +61,12 @@ int32_t main(int32_t argc, char **argv) { VPADStatus vpad{}; VPADRead(VPAD_CHAN_0, &vpad, 1, nullptr); - if ((bootSelection == -1) || (bootSelection == BOOT_OPTION_HOMEBREW_LAUNCHER && !showHBL) || (vpad.hold & VPAD_BUTTON_PLUS)) { - bootSelection = handleMenuScreen(configPath, bootSelection, showHBL); + + if ((bootSelection == -1) || + (bootSelection == BOOT_OPTION_HOMEBREW_LAUNCHER && !showHBL) || + (bootSelection == BOOT_OPTION_VWII_HOMEBREW_CHANNEL && !showvHBL) || + (vpad.hold & VPAD_BUTTON_PLUS)) { + bootSelection = handleMenuScreen(configPath, bootSelection, showHBL, showvHBL); } if (bootSelection >= 0) { @@ -81,6 +85,10 @@ int32_t main(int32_t argc, char **argv) { bootvWiiMenu(); break; case BOOT_OPTION_VWII_HOMEBREW_CHANNEL: + if (!showvHBL) { + bootvWiiMenu(); + break; + } bootHomebrewChannel(); break; default: