mirror of
https://github.com/wiiu-env/AutobootModule.git
synced 2024-11-17 00:29:15 +01:00
Hide the option to boot into HBL when the 50_hbl_installer.rpx is missing for the environment
This commit is contained in:
parent
9c9999829f
commit
dc0086ca75
@ -69,7 +69,7 @@ void writeAutobootOption(std::string &configPath, int32_t autobootOption) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput) {
|
int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput, bool showHBL) {
|
||||||
auto screenBuffer = DrawUtils::InitOSScreen();
|
auto screenBuffer = DrawUtils::InitOSScreen();
|
||||||
if (!screenBuffer) {
|
if (!screenBuffer) {
|
||||||
OSFatal("Failed to alloc memory for screen");
|
OSFatal("Failed to alloc memory for screen");
|
||||||
@ -91,11 +91,18 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput) {
|
|||||||
if (vpad.trigger & VPAD_BUTTON_UP) {
|
if (vpad.trigger & VPAD_BUTTON_UP) {
|
||||||
if (selected > 0) {
|
if (selected > 0) {
|
||||||
selected--;
|
selected--;
|
||||||
|
if (!showHBL && selected == BOOT_OPTION_HOMEBREW_LAUNCHER) {
|
||||||
|
selected--;
|
||||||
|
}
|
||||||
|
|
||||||
redraw = true;
|
redraw = true;
|
||||||
}
|
}
|
||||||
} else if (vpad.trigger & VPAD_BUTTON_DOWN) {
|
} else if (vpad.trigger & VPAD_BUTTON_DOWN) {
|
||||||
if (selected < sizeof(menu_options) / sizeof(char *) - 1) {
|
if (selected < sizeof(menu_options) / sizeof(char *) - 1) {
|
||||||
selected++;
|
selected++;
|
||||||
|
if (!showHBL && selected == BOOT_OPTION_HOMEBREW_LAUNCHER) {
|
||||||
|
selected++;
|
||||||
|
}
|
||||||
redraw = true;
|
redraw = true;
|
||||||
}
|
}
|
||||||
} else if (vpad.trigger & VPAD_BUTTON_A) {
|
} else if (vpad.trigger & VPAD_BUTTON_A) {
|
||||||
@ -115,6 +122,9 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput) {
|
|||||||
// draw buttons
|
// draw buttons
|
||||||
uint32_t index = 8 + 24 + 8 + 4;
|
uint32_t index = 8 + 24 + 8 + 4;
|
||||||
for (uint32_t i = 0; i < sizeof(menu_options) / sizeof(char *); i++) {
|
for (uint32_t i = 0; i < sizeof(menu_options) / sizeof(char *); i++) {
|
||||||
|
if (!showHBL && i == BOOT_OPTION_HOMEBREW_LAUNCHER) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (i == selected) {
|
if (i == selected) {
|
||||||
DrawUtils::drawRect(16, index, SCREEN_WIDTH - 16 * 2, 44, 4, COLOR_BORDER_HIGHLIGHTED);
|
DrawUtils::drawRect(16, index, SCREEN_WIDTH - 16 * 2, 44, 4, COLOR_BORDER_HIGHLIGHTED);
|
||||||
} else {
|
} else {
|
||||||
|
@ -27,6 +27,6 @@ int32_t readAutobootOption(std::string &configPath);
|
|||||||
|
|
||||||
void writeAutobootOption(std::string &configPath, int32_t autobootOption);
|
void writeAutobootOption(std::string &configPath, int32_t autobootOption);
|
||||||
|
|
||||||
int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput);
|
int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput, bool showHBL);
|
||||||
|
|
||||||
nn::act::SlotNo handleAccountSelectScreen(const std::vector<std::shared_ptr<AccountInfo>> &data);
|
nn::act::SlotNo handleAccountSelectScreen(const std::vector<std::shared_ptr<AccountInfo>> &data);
|
@ -6,6 +6,7 @@
|
|||||||
#include <gx2/state.h>
|
#include <gx2/state.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <vpad/input.h>
|
#include <vpad/input.h>
|
||||||
|
|
||||||
#include "BootUtils.h"
|
#include "BootUtils.h"
|
||||||
@ -37,10 +38,16 @@ int32_t main(int32_t argc, char **argv) {
|
|||||||
deinitLogging();
|
deinitLogging();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
bool showHBL = false;
|
||||||
std::string configPath = "fs:/vol/external01/wiiu/autoboot.cfg";
|
std::string configPath = "fs:/vol/external01/wiiu/autoboot.cfg";
|
||||||
if (argc >= 1) {
|
if (argc >= 1) {
|
||||||
configPath = std::string(argv[0]) + "/autoboot.cfg";
|
configPath = std::string(argv[0]) + "/autoboot.cfg";
|
||||||
|
|
||||||
|
auto hblInstallerPath = std::string(argv[0]) + "/modules/setup/50_hbl_installer.rpx";
|
||||||
|
struct stat st {};
|
||||||
|
if (stat(hblInstallerPath.c_str(), &st) >= 0) {
|
||||||
|
showHBL = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t bootSelection = readAutobootOption(configPath);
|
int32_t bootSelection = readAutobootOption(configPath);
|
||||||
@ -48,8 +55,8 @@ int32_t main(int32_t argc, char **argv) {
|
|||||||
VPADStatus vpad{};
|
VPADStatus vpad{};
|
||||||
VPADRead(VPAD_CHAN_0, &vpad, 1, nullptr);
|
VPADRead(VPAD_CHAN_0, &vpad, 1, nullptr);
|
||||||
|
|
||||||
if ((bootSelection == -1) || (vpad.hold & VPAD_BUTTON_PLUS)) {
|
if ((bootSelection == -1) || (bootSelection == BOOT_OPTION_HOMEBREW_LAUNCHER && !showHBL) || (vpad.hold & VPAD_BUTTON_PLUS)) {
|
||||||
bootSelection = handleMenuScreen(configPath, bootSelection);
|
bootSelection = handleMenuScreen(configPath, bootSelection, showHBL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bootSelection >= 0) {
|
if (bootSelection >= 0) {
|
||||||
@ -58,6 +65,10 @@ int32_t main(int32_t argc, char **argv) {
|
|||||||
bootWiiUMenu();
|
bootWiiUMenu();
|
||||||
break;
|
break;
|
||||||
case BOOT_OPTION_HOMEBREW_LAUNCHER:
|
case BOOT_OPTION_HOMEBREW_LAUNCHER:
|
||||||
|
if (!showHBL) {
|
||||||
|
bootWiiUMenu();
|
||||||
|
break;
|
||||||
|
}
|
||||||
bootHomebrewLauncher();
|
bootHomebrewLauncher();
|
||||||
break;
|
break;
|
||||||
case BOOT_OPTION_VWII_SYSTEM_MENU:
|
case BOOT_OPTION_VWII_SYSTEM_MENU:
|
||||||
|
Loading…
Reference in New Issue
Block a user