diff --git a/source/BootUtils.cpp b/source/BootUtils.cpp index 191a884..566217c 100644 --- a/source/BootUtils.cpp +++ b/source/BootUtils.cpp @@ -148,8 +148,46 @@ uint64_t getVWiiHBLTitleId() { return titleId; } +uint64_t getVWiiNintendontTitleId() { + // fall back to booting the vWii system menu if anything fails + uint64_t titleId = 0; + + 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_slccmpt01", FSA_MOUNT_FLAG_GLOBAL_MOUNT, nullptr, 0) >= 0) { + FSStat stat; + + // test if the OHBC or HBC is installed + if (FSAGetStat(client, "/vol/storage_slccmpt01/title/00010001/57574e44/content/00000000.app", &stat) >= 0) { + titleId = 0x0001000157574E44L; // 'Nintendont' + } else { + DEBUG_FUNCTION_LINE("Cannot find Nintendont"); + } + FSAUnmount(client, "/vol/storage_slccmpt01", static_cast(2)); + } else { + DEBUG_FUNCTION_LINE_ERR("Failed to mount slccmpt01"); + } + } else { + DEBUG_FUNCTION_LINE_ERR("Failed to unlock FSClient"); + } + FSADelClient(client); + } else { + DEBUG_FUNCTION_LINE_ERR("Failed to add FSAClient"); + } + return titleId; +} + void bootHomebrewChannel() { uint64_t titleId = getVWiiHBLTitleId(); DEBUG_FUNCTION_LINE("Launching vWii title %016llx", titleId); launchvWiiTitle(titleId); } + +void bootNintendont() { + uint64_t titleId = getVWiiNintendontTitleId(); + DEBUG_FUNCTION_LINE("Launching vWii title %016llx", titleId); + launchvWiiTitle(titleId); +} diff --git a/source/BootUtils.h b/source/BootUtils.h index 6ac2121..c4f295d 100644 --- a/source/BootUtils.h +++ b/source/BootUtils.h @@ -10,4 +10,8 @@ void bootvWiiMenu(); void bootHomebrewChannel(); -uint64_t getVWiiHBLTitleId(); \ No newline at end of file +void bootNintendont(); + +uint64_t getVWiiHBLTitleId(); + +uint64_t getVWiiNintendontTitleId(); \ No newline at end of file diff --git a/source/MenuUtils.cpp b/source/MenuUtils.cpp index 06cf9c7..87338f5 100644 --- a/source/MenuUtils.cpp +++ b/source/MenuUtils.cpp @@ -22,6 +22,7 @@ const char *autoboot_config_strings[] = { "homebrew_launcher", "vwii_system_menu", "vwii_homebrew_channel", + "vwii_nintendont", }; template diff --git a/source/MenuUtils.h b/source/MenuUtils.h index 1129674..5664db3 100644 --- a/source/MenuUtils.h +++ b/source/MenuUtils.h @@ -25,6 +25,7 @@ enum { BOOT_OPTION_HOMEBREW_LAUNCHER, BOOT_OPTION_VWII_SYSTEM_MENU, BOOT_OPTION_VWII_HOMEBREW_CHANNEL, + BOOT_OPTION_VWII_NINTENDONT, }; int32_t readAutobootOption(std::string &configPath); diff --git a/source/main.cpp b/source/main.cpp index dfdec30..ca77cbf 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -71,6 +71,7 @@ int32_t main(int32_t argc, char **argv) { } bool showvHBL = getVWiiHBLTitleId() != 0; + bool showNintendont = getVWiiNintendontTitleId() != 0; bool showHBL = false; std::string configPath = "fs:/vol/external01/wiiu/autoboot.cfg"; if (argc >= 1) { @@ -94,10 +95,14 @@ int32_t main(int32_t argc, char **argv) { if (showvHBL) { menu[BOOT_OPTION_VWII_HOMEBREW_CHANNEL] = "vWii Homebrew Channel"; } + if (showNintendont) { + menu[BOOT_OPTION_VWII_NINTENDONT] = "vWii Nintendont"; + } if ((bootSelection == -1) || (bootSelection == BOOT_OPTION_HOMEBREW_LAUNCHER && !showHBL) || (bootSelection == BOOT_OPTION_VWII_HOMEBREW_CHANNEL && !showvHBL) || + (bootSelection == BOOT_OPTION_VWII_NINTENDONT && !showNintendont) || (vpad.hold & VPAD_BUTTON_PLUS)) { bootSelection = handleMenuScreen(configPath, bootSelection, menu); } @@ -124,6 +129,13 @@ int32_t main(int32_t argc, char **argv) { } bootHomebrewChannel(); break; + case BOOT_OPTION_VWII_NINTENDONT: + if (!showNintendont) { + bootvWiiMenu(); + break; + } + bootNintendont(); + break; default: bootWiiUMenu(); break;