Add support for nintendont

This commit is contained in:
Romulo Leitão 2023-03-11 00:18:24 -03:00
parent 2d023be0a2
commit 35b6aa14c0
5 changed files with 57 additions and 1 deletions

View File

@ -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<FSAUnmountFlags>(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);
}

View File

@ -10,4 +10,8 @@ void bootvWiiMenu();
void bootHomebrewChannel();
uint64_t getVWiiHBLTitleId();
void bootNintendont();
uint64_t getVWiiHBLTitleId();
uint64_t getVWiiNintendontTitleId();

View File

@ -22,6 +22,7 @@ const char *autoboot_config_strings[] = {
"homebrew_launcher",
"vwii_system_menu",
"vwii_homebrew_channel",
"vwii_nintendont",
};
template<typename... Args>

View File

@ -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);

View File

@ -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;