Hide vWii Homebrew Channel from list when not installed

This commit is contained in:
Maschell 2022-08-25 18:39:06 +02:00
parent c0f6e1744a
commit 106c485fb1
3 changed files with 24 additions and 7 deletions

View File

@ -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 {

View File

@ -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<std::shared_ptr<AccountInfo>> &data);

View File

@ -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 <sys/stat.h>
#include <vpad/input.h>
#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: