mirror of
https://github.com/wiiu-env/AutobootModule.git
synced 2024-11-16 16:29:14 +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();
|
||||
if (!screenBuffer) {
|
||||
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 (selected > 0) {
|
||||
selected--;
|
||||
if (!showHBL && selected == BOOT_OPTION_HOMEBREW_LAUNCHER) {
|
||||
selected--;
|
||||
}
|
||||
|
||||
redraw = true;
|
||||
}
|
||||
} else if (vpad.trigger & VPAD_BUTTON_DOWN) {
|
||||
if (selected < sizeof(menu_options) / sizeof(char *) - 1) {
|
||||
selected++;
|
||||
if (!showHBL && selected == BOOT_OPTION_HOMEBREW_LAUNCHER) {
|
||||
selected++;
|
||||
}
|
||||
redraw = true;
|
||||
}
|
||||
} else if (vpad.trigger & VPAD_BUTTON_A) {
|
||||
@ -115,6 +122,9 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput) {
|
||||
// draw buttons
|
||||
uint32_t index = 8 + 24 + 8 + 4;
|
||||
for (uint32_t i = 0; i < sizeof(menu_options) / sizeof(char *); i++) {
|
||||
if (!showHBL && i == BOOT_OPTION_HOMEBREW_LAUNCHER) {
|
||||
continue;
|
||||
}
|
||||
if (i == selected) {
|
||||
DrawUtils::drawRect(16, index, SCREEN_WIDTH - 16 * 2, 44, 4, COLOR_BORDER_HIGHLIGHTED);
|
||||
} else {
|
||||
|
@ -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);
|
||||
int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput, bool showHBL);
|
||||
|
||||
nn::act::SlotNo handleAccountSelectScreen(const std::vector<std::shared_ptr<AccountInfo>> &data);
|
@ -6,6 +6,7 @@
|
||||
#include <gx2/state.h>
|
||||
#include <malloc.h>
|
||||
#include <string>
|
||||
#include <sys/stat.h>
|
||||
#include <vpad/input.h>
|
||||
|
||||
#include "BootUtils.h"
|
||||
@ -37,10 +38,16 @@ int32_t main(int32_t argc, char **argv) {
|
||||
deinitLogging();
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool showHBL = false;
|
||||
std::string configPath = "fs:/vol/external01/wiiu/autoboot.cfg";
|
||||
if (argc >= 1) {
|
||||
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);
|
||||
@ -48,8 +55,8 @@ int32_t main(int32_t argc, char **argv) {
|
||||
VPADStatus vpad{};
|
||||
VPADRead(VPAD_CHAN_0, &vpad, 1, nullptr);
|
||||
|
||||
if ((bootSelection == -1) || (vpad.hold & VPAD_BUTTON_PLUS)) {
|
||||
bootSelection = handleMenuScreen(configPath, bootSelection);
|
||||
if ((bootSelection == -1) || (bootSelection == BOOT_OPTION_HOMEBREW_LAUNCHER && !showHBL) || (vpad.hold & VPAD_BUTTON_PLUS)) {
|
||||
bootSelection = handleMenuScreen(configPath, bootSelection, showHBL);
|
||||
}
|
||||
|
||||
if (bootSelection >= 0) {
|
||||
@ -58,6 +65,10 @@ int32_t main(int32_t argc, char **argv) {
|
||||
bootWiiUMenu();
|
||||
break;
|
||||
case BOOT_OPTION_HOMEBREW_LAUNCHER:
|
||||
if (!showHBL) {
|
||||
bootWiiUMenu();
|
||||
break;
|
||||
}
|
||||
bootHomebrewLauncher();
|
||||
break;
|
||||
case BOOT_OPTION_VWII_SYSTEM_MENU:
|
||||
|
Loading…
Reference in New Issue
Block a user