Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
12017b3
Add custom boot entries from bootOptions.cfg
grantendo Oct 13, 2026
b33e9db
Write the custom autoboot entry with snprintf, apply clang-format
grantendo Oct 13, 2026
9a0dbff
Force TV-only screen type for vWii launch
patapovich Aug 29, 2026
895a19e
Disable DRC control for vWii launch
patapovich Aug 29, 2026
9ba8254
Wait for the compat subsystem before launching vWii titles
patapovich Aug 29, 2026
6a5cb85
Give the GamePad pipe a mode before a vWii launch without a GamePad
grantendo Oct 20, 2026
db5afe0
Launch vWii titles for the TV alone only when no GamePad is connected
grantendo Oct 20, 2026
dd815eb
Say "no GamePad connected" in the pipe-mode comment, as the GamePad c…
grantendo Oct 21, 2026
15513a1
Ask the GamePad over its radio link whether it is connected
grantendo Oct 31, 2026
5dd3269
Let X clear a saved custom entry whose title isn't installed
grantendo Nov 16, 2026
6bb19fb
Keep the menu to 7 rows and leave out system applets
grantendo Nov 16, 2026
548c986
Keep any saved entry the menu doesn't show, not just custom ones
grantendo Nov 16, 2026
ac671ed
Let bootOptions.cfg set the boot menu order
grantendo Oct 20, 2026
35dfedd
Start the cursor on the first entry when bootOptions.cfg sets the order
grantendo Oct 31, 2026
1c3487e
Read an @ line with a comma as a custom entry
grantendo Nov 16, 2026
c336628
Add a boot menu countdown to the autoboot entry
grantendo Oct 22, 2026
863de1b
Let the first button only stop the countdown
grantendo Nov 17, 2026
96dfc2a
Merge branch 'pr-gamepad-off' into fork-release
grantendo Nov 17, 2026
a6a09dc
Mark this build as the grantendo fork
grantendo Nov 16, 2026
057dca6
No countdown when START (+) forces the menu open
grantendo Nov 17, 2026
d77a93c
Also check START as the menu opens, after the update warning
grantendo Nov 17, 2026
c09f1ac
Let a press as the menu opens stop the countdown
grantendo Nov 17, 2026
036989a
Name the upstream PRs in the fork notice
grantendo Nov 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 51 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
[![CI-Release](https://github.com/wiiu-env/AutobootModule/actions/workflows/ci.yml/badge.svg)](https://github.com/wiiu-env/AutobootModule/actions/workflows/ci.yml)
# AutobootModule
# AutobootModule (grantendo fork)

> **This is not an official Aroma build.** It's a fork of [wiiu-env/AutobootModule](https://github.com/wiiu-env/AutobootModule) v0.3.2 with four changes that aren't in the official build yet. The menu shows "v0.3.2 (grantendo fork)" in its top-right corner. Problems with this build belong here, not in wiiu-env's issues.

What it adds:
- **vWii titles start with no GamePad connected** (wiiu-env/AutobootModule#67), opened upstream as wiiu-env/AutobootModule#70. Based on [@patapovich](https://github.com/patapovich)'s wiiu-env/AutobootModule#69 (his commits keep his name), plus a GamePad check over its radio link and a GamePad pipe fix that let the launch go through.
- **Custom boot entries** from `bootOptions.cfg`, opened upstream as wiiu-env/AutobootModule#71, following [@razor85](https://github.com/razor85)'s wiiu-env/AutobootModule#25.
- **Menu order** from `bootOptions.cfg`, opened upstream as wiiu-env/AutobootModule#72.
- **Menu countdown** to the autoboot entry, to be offered upstream after the menu order.

Details for each are below.

**Install:** replace `wiiu/environments/aroma/modules/setup/99_autoboot.rpx` on the SD card with the one from the release. Keep that file name.

**When you update Aroma:** the Aroma Updater sees an unknown `99_autoboot.rpx` and asks whether to overwrite it. Press **B** to keep this one. Pressing **A** puts the official module back (that's also how to undo this fork).

---

## About the original
This is a bootmenu targetted to be loaded with the [EnvironmentLoader](https://github.com/wiiu-env/EnvironmentLoader). It allows you to boot into the Wii U Menu, Homebrew Channel, vWii System Menu or vWii Homebrew Channel.

## Usage
Expand All @@ -13,6 +30,35 @@ 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, 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.

### Menu order

The menu normally shows the built-in entries first and custom entries after them. To choose the order, name built-in entries in `bootOptions.cfg` with an `@` line; entries then appear in the order of the lines:

```
My vWii Channel,0x0001000152494654
@wiiu_menu
@vwii_homebrew_channel
@vwii_system_menu
```

The names are the ones `autoboot.cfg` uses: `@wiiu_menu`, `@homebrew_launcher`, `@vwii_system_menu` and `@vwii_homebrew_channel`. Built-in entries without a line follow the listed ones in the usual order, so none can disappear by accident, and an entry that isn't available (the Homebrew Launcher without its installer, the vWii Homebrew Channel without HBC) is still left out. Without `@` lines the menu keeps the usual order. With `@` lines and no autoboot entry, the cursor starts on the first entry instead of the Wii U Menu.

### Menu countdown

A line `countdown=5` in `bootOptions.cfg` (1 to 30 seconds) shows the menu at every boot even when an autoboot entry is set, with "Starting <entry> in 5..." above the bottom bar. When the countdown ends, the autoboot entry starts; pressing any button first stops the countdown and leaves the menu open as usual. Holding START (+) at boot opens the menu without a countdown. Without an autoboot entry there is nothing to count down to, and the menu waits as before. Useful when no GamePad or Wii Remote is in reach at boot.

## Buildflags

Expand Down Expand Up @@ -51,3 +97,6 @@ docker run -it --rm -v ${PWD}:/project autobootmodule-builder make clean
- GaryOderNichts
- Maschell
- Crementif
- patapovich (no-GamePad vWii launch, wiiu-env/AutobootModule#69)
- razor85 (custom boot entries, wiiu-env/AutobootModule#25)
- grantendo (this fork)
137 changes: 119 additions & 18 deletions source/BootUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,26 @@
#include "MenuUtils.h"
#include "logger.h"
#include <codecvt>
#include <coreinit/dynload.h>
#include <coreinit/filesystem_fsa.h>
#include <coreinit/thread.h>
#include <coreinit/time.h>
#include <cstdio>
#include <filesystem>
#include <locale>
#include <malloc.h>
#include <memory>
#include <mocha/mocha.h>
#include <nn/act.h>
#include <nn/cmpt/cmpt.h>
#include <nsysccr/cdc.h>
#include <padscore/kpad.h>
#include <sndcore2/core.h>
#include <string>
#include <sysapp/launch.h>
#include <sysapp/title.h>
#include <vector>
#include <vpad/input.h>

void handleAccountSelection();

Expand Down Expand Up @@ -85,22 +91,81 @@ void handleAccountSelection() {
nn::act::Finalize();
}

// Exported by nn_cmpt.rpl but not declared in wut's cmpt.h; the Wii U Menu
// calls this before launching vWii titles to signal GamePad support.
extern "C" int32_t CMPTAcctSetDrcCtrlEnabled(int32_t enabled);

// With no GamePad connected, nn_cmpt refuses vWii launches (-512): its switch of the
// TV to Wii mode (AVMSetDCWiiCompat) also reprograms the GamePad's display pipe
// from avm.rpl's GamePad settings, and with no GamePad those say "off" (what
// GX2SetDRCBuffer with GX2_DRC_RENDER_MODE_DISABLE stores), which dc.rpl rejects
// (DCGetBufferRequirement = -2). Give the GamePad pipe a normal 854x480 mode
// first, with the call GX2SetDRCBuffer makes for GX2_DRC_RENDER_MODE_SINGLE and
// double buffering: AVMSetDRCBufferAttr(bufferingMode, mode, pitch).
static void setDrcModeForWiiMode() {
OSDynLoad_Module avm = nullptr;
void *setDrcBufferAttr = nullptr;
if (OSDynLoad_Acquire("avm.rpl", &avm) != OS_DYNLOAD_OK ||
OSDynLoad_FindExport(avm, OS_DYNLOAD_EXPORT_FUNC, "AVMSetDRCBufferAttr", &setDrcBufferAttr) != OS_DYNLOAD_OK) {
DEBUG_FUNCTION_LINE_ERR("AVMSetDRCBufferAttr not found");
return;
}
[[maybe_unused]] int32_t result = ((int32_t(*)(int32_t, int32_t, int32_t)) setDrcBufferAttr)(2, 1, 896);
DEBUG_FUNCTION_LINE("AVMSetDRCBufferAttr(2, 1, 896) = %d", result);
}

// Whether a GamePad is connected: it answers a ping over its radio link. Not VPADRead, which
// a plugin can make succeed with no GamePad there (the DRC Read Result Spoofer does).
// Asked for up to half a second, as a GamePad switched on with the console may still be
// connecting when autoboot gets here.
static bool isGamePadConnected() {
for (int i = 0; i < 10; i++) {
if (CCRCDCDevicePing(CCR_CDC_DESTINATION_DRC0) == 0) {
return true;
}
OSSleepTicks(OSMillisecondsToTicks(50));
}
return false;
}

static void launchvWiiTitle(uint64_t titleId) {
// we need to init kpad for cmpt
KPADInit();

// Try to find a screen type that works
CMPTAcctSetScreenType(CMPT_SCREEN_TYPE_BOTH);
if (CMPTCheckScreenState() < 0) {
CMPTAcctSetScreenType(CMPT_SCREEN_TYPE_DRC);
// With a GamePad connected, launch as before: the vWii can show on both screens. Without
// one, the launch hangs on a black screen or is refused, see
// https://github.com/wiiu-env/AutobootModule/issues/67, so launch for the TV alone.
const bool gamePadConnected = isGamePadConnected();
if (gamePadConnected) {
// Try to find a screen type that works
CMPTAcctSetScreenType(CMPT_SCREEN_TYPE_BOTH);
if (CMPTCheckScreenState() < 0) {
CMPTAcctSetScreenType(CMPT_SCREEN_TYPE_TV);
CMPTAcctSetScreenType(CMPT_SCREEN_TYPE_DRC);
if (CMPTCheckScreenState() < 0) {
CMPTAcctSetScreenType(CMPT_SCREEN_TYPE_TV);
}
}
} else {
DEBUG_FUNCTION_LINE("No GamePad connected: launching the vWii for the TV only");
// GamePad control off and the TV as the only screen
CMPTAcctSetDrcCtrlEnabled(0);
CMPTAcctSetScreenType(CMPT_SCREEN_TYPE_TV);

// On autoboot this code runs much earlier than a manual selection from
// the boot menu, and launching before the compat subsystem is ready
// results in a black screen. Wait for it, but launch anyway after 5s.
for (int i = 0; i < 50 && CMPTCheckScreenState() < 0; i++) {
OSSleepTicks(OSMillisecondsToTicks(100));
}
}

uint32_t dataSize = 0;
CMPTGetDataSize(&dataSize);

if (!gamePadConnected) {
setDrcModeForWiiMode();
}

void *dataBuffer = memalign(0x40, dataSize);

if (titleId == 0) {
Expand All @@ -116,26 +181,29 @@ 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);
if (client > 0) {
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");
Expand All @@ -147,11 +215,44 @@ 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() {
uint64_t titleId = getVWiiHBLTitleId();
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);
}
}
14 changes: 13 additions & 1 deletion source/BootUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,16 @@ void bootvWiiMenu();

void bootHomebrewChannel();

uint64_t getVWiiHBLTitleId();
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);
4 changes: 2 additions & 2 deletions source/DrawUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Loading
Loading