Add some error handling, fix opening the wii u menu. Default load into wii u menu instead of HBL

This commit is contained in:
Maschell 2021-12-27 17:24:42 +01:00
parent 1223bbc29d
commit 2daa9d437f

View File

@ -49,6 +49,38 @@ bool getQuickBoot() {
// load app launch param // load app launch param
CCRSysCaffeineGetAppLaunchParam(&data); CCRSysCaffeineGetAppLaunchParam(&data);
// get launch info for id
nn::sl::LaunchInfo info;
auto result = database->GetLaunchInfoById(&info, data.titleId);
delete database;
delete fileStream;
FSDelClient(fsClient, FS_ERROR_FLAG_NONE);
nn::sl::Finalize();
if(!result.IsSuccess()) {
DEBUG_FUNCTION_LINE("GetLaunchInfoById failed.");
return false;
}
if( info.titleId == 0x0005001010040000L ||
info.titleId == 0x0005001010040100L ||
info.titleId == 0x0005001010040200L) {
DEBUG_FUNCTION_LINE("Skip quick booting into the Wii U Menu");
return false;
}
if(!SYSCheckTitleExists(info.titleId)) {
DEBUG_FUNCTION_LINE("Title %016lLX doesn't exist", info.titleId);
return false;
}
MCPTitleListType titleInfo;
int32_t handle = MCP_Open();
auto err = MCP_GetTitleInfo(handle, info.titleId, &titleInfo);
MCP_Close(handle);
if(err == 0) {
nn::act::Initialize(); nn::act::Initialize();
for(int i = 0; i < 13; i++){ for(int i = 0; i < 13; i++){
char uuid[16]; char uuid[16];
@ -63,31 +95,14 @@ bool getQuickBoot() {
} }
nn::act::Finalize(); nn::act::Finalize();
// get launch info for id
nn::sl::LaunchInfo info;
database->GetLaunchInfoById(&info, data.titleId);
// info.titleId
OSReport("Quick boot into: %016llX\n", info.titleId);
delete database;
delete fileStream;
FSDelClient(fsClient, FS_ERROR_FLAG_NONE);
nn::sl::Finalize();
MCPTitleListType titleInfo;
int32_t handle = MCP_Open();
MCP_GetTitleInfo(handle, info.titleId, &titleInfo);
MCP_Close(handle);
ACPAssignTitlePatch(&titleInfo); ACPAssignTitlePatch(&titleInfo);
_SYSLaunchTitleWithStdArgsInNoSplash(info.titleId, nullptr); _SYSLaunchTitleWithStdArgsInNoSplash(info.titleId, nullptr);
return true; return true;
}
return false;
} else { } else {
OSReport("No quick boot\n"); DEBUG_FUNCTION_LINE("No quick boot");
} }
return false; return false;
} }
@ -120,8 +135,19 @@ int main(int argc, char **argv) {
InstallHBL(); InstallHBL();
if(!getQuickBoot()) { if(getQuickBoot()) {
bootHomebrewLauncher(); return 0;
}
nn::act::Initialize();
nn::act::SlotNo slot = nn::act::GetSlotNo();
nn::act::SlotNo defaultSlot = nn::act::GetDefaultAccount();
nn::act::Finalize();
if (defaultSlot) { //normal menu boot
SYSLaunchMenu();
} else { //show mii select
_SYSLaunchMenuWithCheckingAccount(slot);
} }
return 0; return 0;