From 12017b379755a4fed73ced8a680e528169c6dfd8 Mon Sep 17 00:00:00 2001 From: Grant <27168728+grantendo@users.noreply.github.com> Date: Tue, 13 Oct 2026 09:39:02 -0500 Subject: [PATCH 1/5] Add custom boot entries from bootOptions.cfg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reads up to 4 entries ("Name,0x<64-bit title id>") from bootOptions.cfg next to autoboot.cfg and adds the installed ones to the boot menu. The title id decides the launch path: 0x0001... titles launch on vWii via mocha and CMPTLaunchTitle, 0x0005... titles via _SYSLaunchTitleWithStdArgsInNoSplash after account selection. A custom autoboot choice is saved by title id, so renaming an entry keeps it. If the saved title is no longer installed, the menu opens without overwriting the choice. Builds on wiiu-env/AutobootModule#25 by Romulo Leitão (razor85), which introduced bootOptions.cfg and the custom entries, and follows the review there: full title ids, no vWii/Wii U string field, and fgets/strtoull instead of streams. The installed-title check now looks for title.tmd, which every installed title has. Co-authored-by: Romulo Leitão --- README.md | 12 +++++ source/BootUtils.cpp | 63 ++++++++++++++++++++------ source/BootUtils.h | 14 +++++- source/MenuUtils.cpp | 104 ++++++++++++++++++++++++++++++++++++++++--- source/MenuUtils.h | 19 ++++++-- source/main.cpp | 27 +++++++++-- 6 files changed, 213 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 3b6600e..027f967 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,18 @@ Press Y on the autoboot menu to set autobooting to this titles. To revert it, fo - Boot into Wii U Menu, Homebrew Channel, vWii System Menu or vWii Homebrew Channel. - Full support of Quick Boot Menu of the Gamepad when coldbooting - Set a autoboot title +- Add your own vWii or Wii U titles to the menu + +## Custom boot entries +Create `bootOptions.cfg` next to `autoboot.cfg` (in the `[ENVIRONMENT]` folder) with one entry per line: a name, a comma, and the title's full 64-bit title id. + +``` +# vWii titles start with 00010001, Wii U titles with 00050000 +My vWii Channel,0x0001000152494654 +Mii Maker,0x000500101004A200 +``` + +The title id decides how the entry is launched: vWii titles through the vWii, Wii U titles directly. Entries whose title is not installed are left out of the menu. Up to 4 entries are shown. A custom entry can be set as the autoboot title like any other. ## Buildflags diff --git a/source/BootUtils.cpp b/source/BootUtils.cpp index 635800f..c3c5eec 100644 --- a/source/BootUtils.cpp +++ b/source/BootUtils.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -116,9 +117,16 @@ void bootvWiiMenu() { launchvWiiTitle(0); } -uint64_t getVWiiHBLTitleId() { - // fall back to booting the vWii system menu if anything fails - uint64_t titleId = 0; +bool isVWiiTitle(uint64_t titleId) { + return (titleId >> 48) == 0x0001; +} + +bool isWiiUTitle(uint64_t titleId) { + return (titleId >> 48) == 0x0005; +} + +bool vWiiTitleExists(uint64_t titleId) { + bool exists = false; FSAInit(); auto client = FSAAddClient(nullptr); @@ -126,16 +134,12 @@ uint64_t getVWiiHBLTitleId() { if (Mocha_UnlockFSClientEx(client) == MOCHA_RESULT_SUCCESS) { // mount the slccmpt if (FSAMount(client, "/dev/slccmpt01", "/vol/storage_abm_slccmpt01", FSA_MOUNT_FLAG_GLOBAL_MOUNT, nullptr, 0) >= 0) { + // every installed title has a TMD; content file names depend on the title + char path[0x80]; + snprintf(path, sizeof(path), "/vol/storage_abm_slccmpt01/title/%08x/%08x/content/title.tmd", + (uint32_t) (titleId >> 32), (uint32_t) titleId); FSStat stat; - - // test if the OHBC or HBC is installed - if (FSAGetStat(client, "/vol/storage_abm_slccmpt01/title/00010001/4f484243/content/00000000.app", &stat) >= 0) { - titleId = 0x000100014F484243L; // 'OHBC' - } else if (FSAGetStat(client, "/vol/storage_abm_slccmpt01/title/00010001/4c554c5a/content/00000000.app", &stat) >= 0) { - titleId = 0x000100014C554C5AL; // 'LULZ' - } else { - DEBUG_FUNCTION_LINE("Cannot find HBC"); - } + exists = FSAGetStat(client, path, &stat) >= 0; FSAUnmount(client, "/vol/storage_abm_slccmpt01", FSA_UNMOUNT_FLAG_FORCE); } else { DEBUG_FUNCTION_LINE_ERR("Failed to mount slccmpt01"); @@ -147,7 +151,29 @@ uint64_t getVWiiHBLTitleId() { } else { DEBUG_FUNCTION_LINE_ERR("Failed to add FSAClient"); } - return titleId; + return exists; +} + +bool titleExists(uint64_t titleId) { + if (isVWiiTitle(titleId)) { + return vWiiTitleExists(titleId); + } + if (isWiiUTitle(titleId)) { + return SYSCheckTitleExists(titleId); + } + return false; +} + +uint64_t getVWiiHBLTitleId() { + // test if the OHBC or HBC is installed, fall back to booting the vWii system menu if anything fails + if (vWiiTitleExists(0x000100014F484243L)) { + return 0x000100014F484243L; // 'OHBC' + } + if (vWiiTitleExists(0x000100014C554C5AL)) { + return 0x000100014C554C5AL; // 'LULZ' + } + DEBUG_FUNCTION_LINE("Cannot find HBC"); + return 0; } void bootHomebrewChannel() { @@ -155,3 +181,14 @@ void bootHomebrewChannel() { DEBUG_FUNCTION_LINE("Launching vWii title %016llx", titleId); launchvWiiTitle(titleId); } + +void bootCustomTitle(uint64_t titleId) { + if (isVWiiTitle(titleId)) { + DEBUG_FUNCTION_LINE("Launching vWii title %016llx", titleId); + launchvWiiTitle(titleId); + } else { + handleAccountSelection(); + DEBUG_FUNCTION_LINE("Launching Wii U title %016llx", titleId); + _SYSLaunchTitleWithStdArgsInNoSplash(titleId, nullptr); + } +} diff --git a/source/BootUtils.h b/source/BootUtils.h index 6ac2121..a6da460 100644 --- a/source/BootUtils.h +++ b/source/BootUtils.h @@ -10,4 +10,16 @@ void bootvWiiMenu(); void bootHomebrewChannel(); -uint64_t getVWiiHBLTitleId(); \ No newline at end of file +uint64_t getVWiiHBLTitleId(); + +// vWii titles start with 0x0001, Wii U titles with 0x0005. +bool isVWiiTitle(uint64_t titleId); + +bool isWiiUTitle(uint64_t titleId); + +bool vWiiTitleExists(uint64_t titleId); + +bool titleExists(uint64_t titleId); + +// Launches a vWii or Wii U title; the title id decides which. +void bootCustomTitle(uint64_t titleId); diff --git a/source/MenuUtils.cpp b/source/MenuUtils.cpp index 832f10d..7f0c5ee 100644 --- a/source/MenuUtils.cpp +++ b/source/MenuUtils.cpp @@ -1,5 +1,6 @@ #include "MenuUtils.h" #include "ACTAccountInfo.h" +#include "BootUtils.h" #include "DrawUtils.h" #include "InputUtils.h" #include "PairUtils.h" @@ -11,6 +12,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -30,13 +34,95 @@ const char *autoboot_config_strings[] = { "vwii_homebrew_channel", }; -int32_t readAutobootOption(std::string &configPath) { +#define CUSTOM_AUTOBOOT_PREFIX "title_" + +static void trimInPlace(char *str) { + char *start = str; + while (*start && isspace((unsigned char) *start)) { + start++; + } + char *end = start + strlen(start); + while (end > start && isspace((unsigned char) end[-1])) { + end--; + } + *end = '\0'; + memmove(str, start, end - start + 1); +} + +std::vector readCustomBootOptions(const std::string &path) { + std::vector result; + FILE *f = fopen(path.c_str(), "r"); + if (!f) { + return result; + } + + // One entry per line: "Name,0x0001000152494654". The title id decides how it is launched. + char line[256]; + while (fgets(line, sizeof(line), f)) { + trimInPlace(line); + if (line[0] == '\0' || line[0] == '#') { + continue; + } + + char *comma = strrchr(line, ','); + if (!comma) { + DEBUG_FUNCTION_LINE_WARN("bootOptions.cfg: no comma in \"%s\"", line); + continue; + } + *comma = '\0'; + + char *idStr = comma + 1; + trimInPlace(idStr); + char *idEnd = nullptr; + uint64_t titleId = strtoull(idStr, &idEnd, 16); + if (idEnd == idStr || *idEnd != '\0' || !(isVWiiTitle(titleId) || isWiiUTitle(titleId))) { + DEBUG_FUNCTION_LINE_WARN("bootOptions.cfg: \"%s\" is not a full vWii or Wii U title id", idStr); + continue; + } + + trimInPlace(line); + if (line[0] == '\0') { + DEBUG_FUNCTION_LINE_WARN("bootOptions.cfg: entry for %016llx has no name", titleId); + continue; + } + + bool duplicate = false; + for (auto &option : result) { + duplicate |= option.titleId == titleId; + } + if (duplicate) { + DEBUG_FUNCTION_LINE_WARN("bootOptions.cfg: %016llx is listed twice", titleId); + continue; + } + + if (result.size() >= MAX_CUSTOM_BOOT_OPTIONS) { + DEBUG_FUNCTION_LINE_WARN("bootOptions.cfg: only the first %d entries are used", MAX_CUSTOM_BOOT_OPTIONS); + break; + } + result.push_back({line, titleId}); + } + fclose(f); + return result; +} + +int32_t readAutobootOption(std::string &configPath, const std::vector &customOptions) { FILE *f = fopen(configPath.c_str(), "r"); if (f) { char buf[128]{}; fgets(buf, sizeof(buf), f); fclose(f); + // Custom entries are saved by title id, so renaming one keeps it selected. + if (strncmp(CUSTOM_AUTOBOOT_PREFIX, buf, strlen(CUSTOM_AUTOBOOT_PREFIX)) == 0) { + uint64_t titleId = strtoull(buf + strlen(CUSTOM_AUTOBOOT_PREFIX), nullptr, 16); + for (uint32_t i = 0; i < customOptions.size(); i++) { + if (customOptions[i].titleId == titleId) { + return BOOT_OPTION_CUSTOM_BASE + i; + } + } + return -1; + } + for (uint32_t i = 0; i < sizeof(autoboot_config_strings) / sizeof(char *); i++) { if (strncmp(autoboot_config_strings[i], buf, strlen(autoboot_config_strings[i])) == 0) { return i; @@ -46,10 +132,17 @@ int32_t readAutobootOption(std::string &configPath) { return -1; } -void writeAutobootOption(std::string &configPath, int32_t autobootOption) { +void writeAutobootOption(std::string &configPath, int32_t autobootOption, const std::vector &customOptions) { FILE *f = fopen(configPath.c_str(), "w"); if (f) { - if (autobootOption >= 0) { + if (autobootOption >= BOOT_OPTION_CUSTOM_BASE) { + uint32_t index = autobootOption - BOOT_OPTION_CUSTOM_BASE; + if (index < customOptions.size()) { + fprintf(f, CUSTOM_AUTOBOOT_PREFIX "%016llx", customOptions[index].titleId); + } else { + fputs("none", f); + } + } else if (autobootOption >= 0) { fputs(autoboot_config_strings[autobootOption], f); } else { fputs("none", f); @@ -108,7 +201,8 @@ void drawMenuScreen(const std::map &menu, uint32_t select DrawUtils::endDraw(); } -int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput, const std::map &menu) { +int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput, const std::map &menu, + const std::vector &customOptions) { auto screenBuffer = DrawUtils::InitOSScreen(); if (!screenBuffer) { OSFatal("AutobootModule: Failed to alloc memory for screen"); @@ -217,7 +311,7 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput, c } if (autoboot != autobootOptionInput) { - writeAutobootOption(configPath, autoboot); + writeAutobootOption(configPath, autoboot, customOptions); } return selected; diff --git a/source/MenuUtils.h b/source/MenuUtils.h index a99b2d1..ae47b1c 100644 --- a/source/MenuUtils.h +++ b/source/MenuUtils.h @@ -28,11 +28,24 @@ enum { BOOT_OPTION_VWII_HOMEBREW_CHANNEL, }; -int32_t readAutobootOption(std::string &configPath); +// Entries from bootOptions.cfg use BOOT_OPTION_CUSTOM_BASE + their index in the file. +#define BOOT_OPTION_CUSTOM_BASE 0x100 +// The menu has no scrolling; with the built-in options this still fits on screen. +#define MAX_CUSTOM_BOOT_OPTIONS 4 + +struct CustomBootOption { + std::string name; + uint64_t titleId; +}; + +std::vector readCustomBootOptions(const std::string &path); + +int32_t readAutobootOption(std::string &configPath, const std::vector &customOptions); -void writeAutobootOption(std::string &configPath, int32_t autobootOption); +void writeAutobootOption(std::string &configPath, int32_t autobootOption, const std::vector &customOptions); -int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput, const std::map &menu); +int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput, const std::map &menu, + const std::vector &customOptions); nn::act::SlotNo handleAccountSelectScreen(const std::vector> &data); diff --git a/source/main.cpp b/source/main.cpp index 70e4110..ba2cf3b 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -87,9 +87,11 @@ int32_t main(int32_t argc, char **argv) { bool showvHBL = getVWiiHBLTitleId() != 0; bool showHBL = false; - std::string configPath = "fs:/vol/external01/wiiu/autoboot.cfg"; + std::string configPath = "fs:/vol/external01/wiiu/autoboot.cfg"; + std::string bootOptionsPath = "fs:/vol/external01/wiiu/bootOptions.cfg"; if (argc >= 1) { - configPath = std::string(argv[0]) + "/autoboot.cfg"; + configPath = std::string(argv[0]) + "/autoboot.cfg"; + bootOptionsPath = std::string(argv[0]) + "/bootOptions.cfg"; auto hblInstallerPath = std::string(argv[0]) + "/modules/setup/50_hbl_installer.rpx"; struct stat st {}; @@ -98,7 +100,8 @@ int32_t main(int32_t argc, char **argv) { } } - int32_t bootSelection = readAutobootOption(configPath); + auto customOptions = readCustomBootOptions(bootOptionsPath); + int32_t bootSelection = readAutobootOption(configPath, customOptions); std::map menu; menu[BOOT_OPTION_WII_U_MENU] = "Wii U Menu"; @@ -109,15 +112,27 @@ int32_t main(int32_t argc, char **argv) { if (showvHBL) { menu[BOOT_OPTION_VWII_HOMEBREW_CHANNEL] = "vWii Homebrew Channel"; } + for (uint32_t i = 0; i < customOptions.size(); i++) { + // Only offer titles that are installed, so a stale entry can never be launched. + if (titleExists(customOptions[i].titleId)) { + menu[BOOT_OPTION_CUSTOM_BASE + i] = customOptions[i].name; + } else { + DEBUG_FUNCTION_LINE_WARN("bootOptions.cfg: %016llx (%s) is not installed", customOptions[i].titleId, customOptions[i].name.c_str()); + } + } if ((bootSelection == -1) || (bootSelection == BOOT_OPTION_HOMEBREW_LAUNCHER && !showHBL) || (bootSelection == BOOT_OPTION_VWII_HOMEBREW_CHANNEL && !showvHBL) || + (bootSelection >= BOOT_OPTION_CUSTOM_BASE && menu.count(bootSelection) == 0) || (buttons.hold & VPAD_BUTTON_PLUS)) { if (!AXIsInit()) { AXInit(); } - bootSelection = handleMenuScreen(configPath, bootSelection, menu); + // A saved custom entry whose title is gone stays saved (it comes back once the title + // is reinstalled) instead of being preselected or overwritten by the menu. + int32_t menuInput = (bootSelection >= BOOT_OPTION_CUSTOM_BASE && menu.count(bootSelection) == 0) ? -1 : bootSelection; + bootSelection = handleMenuScreen(configPath, menuInput, menu, customOptions); hadMenu = true; } @@ -144,6 +159,10 @@ int32_t main(int32_t argc, char **argv) { bootHomebrewChannel(); break; default: + if (bootSelection >= BOOT_OPTION_CUSTOM_BASE && menu.count(bootSelection) != 0) { + bootCustomTitle(customOptions[bootSelection - BOOT_OPTION_CUSTOM_BASE].titleId); + break; + } bootWiiUMenu(); break; } From b33e9db4140b9b8ee8b08b5487d40f1528004b77 Mon Sep 17 00:00:00 2001 From: Grant <27168728+grantendo@users.noreply.github.com> Date: Tue, 13 Oct 2026 09:59:33 -0500 Subject: [PATCH 2/5] Write the custom autoboot entry with snprintf, apply clang-format fprintf pulled in about 4.8 KB of formatting code that snprintf, already linked, covers. The branch now builds 4.4 KB larger than main. Formatted with clang-format 13.0.1, which leaves main unchanged. --- source/BootUtils.cpp | 2 +- source/MenuUtils.cpp | 6 ++++-- source/main.cpp | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/BootUtils.cpp b/source/BootUtils.cpp index c3c5eec..5444bb0 100644 --- a/source/BootUtils.cpp +++ b/source/BootUtils.cpp @@ -4,6 +4,7 @@ #include "logger.h" #include #include +#include #include #include #include @@ -13,7 +14,6 @@ #include #include #include -#include #include #include #include diff --git a/source/MenuUtils.cpp b/source/MenuUtils.cpp index 7f0c5ee..61f2a16 100644 --- a/source/MenuUtils.cpp +++ b/source/MenuUtils.cpp @@ -8,11 +8,11 @@ #include "main.h" #include "utils.h" #include "version.h" +#include #include #include #include #include -#include #include #include #include @@ -138,7 +138,9 @@ void writeAutobootOption(std::string &configPath, int32_t autobootOption, const if (autobootOption >= BOOT_OPTION_CUSTOM_BASE) { uint32_t index = autobootOption - BOOT_OPTION_CUSTOM_BASE; if (index < customOptions.size()) { - fprintf(f, CUSTOM_AUTOBOOT_PREFIX "%016llx", customOptions[index].titleId); + char buf[sizeof(CUSTOM_AUTOBOOT_PREFIX) + 16]; + snprintf(buf, sizeof(buf), CUSTOM_AUTOBOOT_PREFIX "%016llx", customOptions[index].titleId); + fputs(buf, f); } else { fputs("none", f); } diff --git a/source/main.cpp b/source/main.cpp index ba2cf3b..f59330a 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -85,8 +85,8 @@ int32_t main(int32_t argc, char **argv) { DEBUG_FUNCTION_LINE_ERR("Failed to create FSA Client"); } - bool showvHBL = getVWiiHBLTitleId() != 0; - bool showHBL = false; + bool showvHBL = getVWiiHBLTitleId() != 0; + bool showHBL = false; std::string configPath = "fs:/vol/external01/wiiu/autoboot.cfg"; std::string bootOptionsPath = "fs:/vol/external01/wiiu/bootOptions.cfg"; if (argc >= 1) { @@ -133,7 +133,7 @@ int32_t main(int32_t argc, char **argv) { // is reinstalled) instead of being preselected or overwritten by the menu. int32_t menuInput = (bootSelection >= BOOT_OPTION_CUSTOM_BASE && menu.count(bootSelection) == 0) ? -1 : bootSelection; bootSelection = handleMenuScreen(configPath, menuInput, menu, customOptions); - hadMenu = true; + hadMenu = true; } if (bootSelection >= 0) { From 5dd32698d9008433b43b43fec8569fd9941ad25e Mon Sep 17 00:00:00 2001 From: Grant <27168728+grantendo@users.noreply.github.com> Date: Mon, 16 Nov 2026 14:26:10 -0600 Subject: [PATCH 3/5] Let X clear a saved custom entry whose title isn't installed The menu gets -1 for such an entry, so pressing X left the choice unchanged and nothing was written: the old title came back as the autoboot title once it was reinstalled. X and Y now always save. Also skip mbstowcs's result when it reports a byte it can't convert ((size_t) -1), now that entry names come from a file. --- source/DrawUtils.cpp | 4 ++-- source/MenuUtils.cpp | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/source/DrawUtils.cpp b/source/DrawUtils.cpp index 2732435..37ab515 100644 --- a/source/DrawUtils.cpp +++ b/source/DrawUtils.cpp @@ -301,7 +301,7 @@ void DrawUtils::print(uint32_t x, uint32_t y, const char *string, bool alignRigh auto *buffer = new wchar_t[strlen(string) + 1]; size_t num = mbstowcs(buffer, string, strlen(string)); - if (num > 0) { + if (num > 0 && num != (size_t) -1) { // (size_t) -1: a byte mbstowcs can't convert buffer[num] = 0; } else { wchar_t *tmp = buffer; @@ -374,7 +374,7 @@ uint32_t DrawUtils::getTextWidth(const char *string) { auto *buffer = new wchar_t[strlen(string) + 1]; size_t num = mbstowcs(buffer, string, strlen(string)); - if (num > 0) { + if (num > 0 && num != (size_t) -1) { buffer[num] = 0; } else { wchar_t *tmp = buffer; diff --git a/source/MenuUtils.cpp b/source/MenuUtils.cpp index 61f2a16..b541107 100644 --- a/source/MenuUtils.cpp +++ b/source/MenuUtils.cpp @@ -220,6 +220,9 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput, c int32_t selectedIndex = autobootOptionInput > 0 ? autobootOptionInput : 0; int autobootIndex = autobootOptionInput; + // Set by X or Y: the saved choice is written even if it matches the input, so X can clear + // a saved custom entry whose title isn't installed (the menu gets -1 for it). + bool autobootChanged = false; // "Convert" id to index int32_t offset = 0; @@ -271,9 +274,11 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput, c } else if (input.trigger & VPAD_BUTTON_A) { break; } else if (input.trigger & (VPAD_BUTTON_X | VPAD_BUTTON_MINUS)) { - autobootIndex = -1; + autobootIndex = -1; + autobootChanged = true; } else if (input.trigger & (VPAD_BUTTON_Y | VPAD_BUTTON_PLUS)) { - autobootIndex = selectedIndex; + autobootIndex = selectedIndex; + autobootChanged = true; } else if ((input.hold & (VPAD_BUTTON_PLUS | VPAD_BUTTON_MINUS)) == (VPAD_BUTTON_PLUS | VPAD_BUTTON_MINUS)) { if (holdUpdateBlockedForFrames++ > 50) { if (gUpdatesBlocked) { @@ -312,7 +317,7 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput, c autoboot = std::next(menu.begin(), autobootIndex)->first; } - if (autoboot != autobootOptionInput) { + if (autobootChanged || autoboot != autobootOptionInput) { writeAutobootOption(configPath, autoboot, customOptions); } From 6bb19fba09a90b52866fb87b181c73c7af8af492 Mon Sep 17 00:00:00 2001 From: Grant <27168728+grantendo@users.noreply.github.com> Date: Mon, 16 Nov 2026 15:21:28 -0600 Subject: [PATCH 4/5] Keep the menu to 7 rows and leave out system applets The menu doesn't scroll: with all four built-in entries and four custom ones, the eighth row covered the update status line. Custom entries that don't fit are left out with a log message. System applets (title ids 00050030..., like the Internet Browser) need their own launch calls, so bootOptions.cfg skips them. --- README.md | 2 +- source/MenuUtils.cpp | 6 ++++++ source/MenuUtils.h | 4 +++- source/main.cpp | 8 +++++--- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 027f967..9f46186 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ My vWii Channel,0x0001000152494654 Mii Maker,0x000500101004A200 ``` -The title id decides how the entry is launched: vWii titles through the vWii, Wii U titles directly. Entries whose title is not installed are left out of the menu. Up to 4 entries are shown. A custom entry can be set as the autoboot title like any other. +The title id decides how the entry is launched: vWii titles through the vWii, Wii U titles directly. Entries whose title is not installed are left out of the menu. Up to 4 entries are shown, as many as fit: the menu has room for 7 rows in all. System applets (title ids starting with 00050030, like the Internet Browser) can't be custom entries. A custom entry can be set as the autoboot title like any other. ## Buildflags diff --git a/source/MenuUtils.cpp b/source/MenuUtils.cpp index b541107..7b9bfef 100644 --- a/source/MenuUtils.cpp +++ b/source/MenuUtils.cpp @@ -80,6 +80,12 @@ std::vector readCustomBootOptions(const std::string &path) { continue; } + // System applets (the browser, the eShop, ...) need their own launch calls. + if ((titleId >> 32) == 0x00050030) { + DEBUG_FUNCTION_LINE_WARN("bootOptions.cfg: %016llx is a system applet, which can't be a custom entry", titleId); + continue; + } + trimInPlace(line); if (line[0] == '\0') { DEBUG_FUNCTION_LINE_WARN("bootOptions.cfg: entry for %016llx has no name", titleId); diff --git a/source/MenuUtils.h b/source/MenuUtils.h index ae47b1c..9c71dc9 100644 --- a/source/MenuUtils.h +++ b/source/MenuUtils.h @@ -30,8 +30,10 @@ enum { // Entries from bootOptions.cfg use BOOT_OPTION_CUSTOM_BASE + their index in the file. #define BOOT_OPTION_CUSTOM_BASE 0x100 -// The menu has no scrolling; with the built-in options this still fits on screen. +// At most this many custom entries, fewer if the menu runs out of rows. #define MAX_CUSTOM_BOOT_OPTIONS 4 +// The menu doesn't scroll, and an eighth row would cover the update status line. +#define MAX_MENU_ROWS 7 struct CustomBootOption { std::string name; diff --git a/source/main.cpp b/source/main.cpp index f59330a..b1f70db 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -114,10 +114,12 @@ int32_t main(int32_t argc, char **argv) { } for (uint32_t i = 0; i < customOptions.size(); i++) { // Only offer titles that are installed, so a stale entry can never be launched. - if (titleExists(customOptions[i].titleId)) { - menu[BOOT_OPTION_CUSTOM_BASE + i] = customOptions[i].name; - } else { + if (!titleExists(customOptions[i].titleId)) { DEBUG_FUNCTION_LINE_WARN("bootOptions.cfg: %016llx (%s) is not installed", customOptions[i].titleId, customOptions[i].name.c_str()); + } else if (menu.size() >= MAX_MENU_ROWS) { + DEBUG_FUNCTION_LINE_WARN("bootOptions.cfg: no room in the menu for %016llx (%s)", customOptions[i].titleId, customOptions[i].name.c_str()); + } else { + menu[BOOT_OPTION_CUSTOM_BASE + i] = customOptions[i].name; } } From 548c986cf783081e3e268fe52fe17c41e3683cb8 Mon Sep 17 00:00:00 2001 From: Grant <27168728+grantendo@users.noreply.github.com> Date: Mon, 16 Nov 2026 15:40:45 -0600 Subject: [PATCH 5/5] Keep any saved entry the menu doesn't show, not just custom ones A saved Homebrew Launcher or vWii Homebrew Channel that is missing was passed to the menu unchanged, which then read its id as a row number: with a custom entry in that row, A started the custom title and saved it as the autoboot entry. Every saved entry the menu doesn't show now opens the menu with nothing preselected and stays saved, as a custom entry whose title is gone already did. --- source/main.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/main.cpp b/source/main.cpp index b1f70db..e2c805a 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -131,9 +131,10 @@ int32_t main(int32_t argc, char **argv) { if (!AXIsInit()) { AXInit(); } - // A saved custom entry whose title is gone stays saved (it comes back once the title - // is reinstalled) instead of being preselected or overwritten by the menu. - int32_t menuInput = (bootSelection >= BOOT_OPTION_CUSTOM_BASE && menu.count(bootSelection) == 0) ? -1 : bootSelection; + // A saved entry the menu doesn't show (a custom title that's gone, or a missing Homebrew + // Launcher or vWii Homebrew Channel) stays saved and comes back once it's available again, + // instead of being preselected or overwritten by the menu. + int32_t menuInput = (bootSelection >= 0 && menu.count(bootSelection) == 0) ? -1 : bootSelection; bootSelection = handleMenuScreen(configPath, menuInput, menu, customOptions); hadMenu = true; }