mirror of
https://github.com/wiiu-env/AutobootModule.git
synced 2024-11-22 02:49:16 +01:00
Fix quick starting into applets
This commit is contained in:
parent
2152acd7e1
commit
05cc2a99c7
2
Makefile
2
Makefile
@ -26,7 +26,7 @@ INCLUDES := source include
|
||||
#-------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#-------------------------------------------------------------------------------
|
||||
CFLAGS := -g -Wall -O3 -ffunction-sections -fno-exceptions \
|
||||
CFLAGS := -g -Wall -O2 -ffunction-sections -fno-exceptions \
|
||||
$(MACHDEP)
|
||||
|
||||
CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__
|
||||
|
150
source/main.cpp
150
source/main.cpp
@ -2,6 +2,8 @@
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <coreinit/thread.h>
|
||||
#include <coreinit/foreground.h>
|
||||
#include <coreinit/screen.h>
|
||||
#include <coreinit/filesystem.h>
|
||||
#include <coreinit/memdefaultheap.h>
|
||||
@ -10,6 +12,7 @@
|
||||
#include <sysapp/launch.h>
|
||||
#include <sysapp/title.h>
|
||||
#include <padscore/kpad.h>
|
||||
#include <proc_ui/procui.h>
|
||||
#include <nn/acp.h>
|
||||
#include <nn/act.h>
|
||||
#include <nn/cmpt.h>
|
||||
@ -34,6 +37,48 @@
|
||||
#define COLOR_BORDER Color(204, 204, 204, 255)
|
||||
#define COLOR_BORDER_HIGHLIGHTED Color(0x3478e4ff)
|
||||
|
||||
void bootWiiUMenu();
|
||||
|
||||
void StartAppletAndExit() {
|
||||
DEBUG_FUNCTION_LINE("Wait for applet");
|
||||
ProcUIInit(OSSavesDone_ReadyToRelease);
|
||||
|
||||
bool doProcUi = true;
|
||||
bool launchWiiUMenuOnNextForeground = false;
|
||||
while (true) {
|
||||
switch (ProcUIProcessMessages(true)) {
|
||||
case PROCUI_STATUS_EXITING: {
|
||||
doProcUi = false;
|
||||
break;
|
||||
}
|
||||
case PROCUI_STATUS_RELEASE_FOREGROUND: {
|
||||
ProcUIDrawDoneRelease();
|
||||
launchWiiUMenuOnNextForeground = true;
|
||||
break;
|
||||
}
|
||||
case PROCUI_STATUS_IN_FOREGROUND: {
|
||||
if (launchWiiUMenuOnNextForeground) {
|
||||
bootWiiUMenu();
|
||||
launchWiiUMenuOnNextForeground = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PROCUI_STATUS_IN_BACKGROUND: {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
OSSleepTicks(OSMillisecondsToTicks(1));
|
||||
if (!doProcUi) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
ProcUIShutdown();
|
||||
DEBUG_FUNCTION_LINE("Exit to Wii U Menu");
|
||||
_Exit(0);
|
||||
}
|
||||
|
||||
enum {
|
||||
BOOT_OPTION_WII_U_MENU,
|
||||
BOOT_OPTION_HOMEBREW_LAUNCHER,
|
||||
@ -86,6 +131,26 @@ void writeAutobootOption(int32_t autobootOption) {
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" int32_t SYSSwitchToBrowser(void *);
|
||||
extern "C" int32_t SYSSwitchToEShop(void *);
|
||||
extern "C" int32_t _SYSSwitchTo(uint32_t pfid);
|
||||
|
||||
void loadConsoleAccount(const char *data_uuid) {
|
||||
nn::act::Initialize();
|
||||
for (int32_t i = 0; i < 13; i++) {
|
||||
char uuid[16];
|
||||
auto result = nn::act::GetUuidEx(uuid, i);
|
||||
if (result.IsSuccess()) {
|
||||
if (memcmp(uuid, data_uuid, 8) == 0) {
|
||||
DEBUG_FUNCTION_LINE("Load Console account %d", i);
|
||||
nn::act::LoadConsoleAccount(i, 0, nullptr, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
nn::act::Finalize();
|
||||
}
|
||||
|
||||
bool getQuickBoot() {
|
||||
auto bootCheck = CCRSysCaffeineBootCheck();
|
||||
if (bootCheck == 0) {
|
||||
@ -125,12 +190,82 @@ bool getQuickBoot() {
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_FUNCTION_LINE("Trying to autoboot for titleId %016llX", info.titleId);
|
||||
|
||||
if (info.titleId == 0x0005001010040000L ||
|
||||
info.titleId == 0x0005001010040100L ||
|
||||
info.titleId == 0x0005001010040200L) {
|
||||
DEBUG_FUNCTION_LINE("Skip quick booting into the Wii U Menu");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (info.titleId == 0x000500301001220AL ||
|
||||
info.titleId == 0x000500301001210AL ||
|
||||
info.titleId == 0x000500301001200AL) {
|
||||
DEBUG_FUNCTION_LINE("Launching the browser");
|
||||
loadConsoleAccount(data.uuid);
|
||||
SYSSwitchToBrowser(nullptr);
|
||||
|
||||
StartAppletAndExit();
|
||||
|
||||
return true;
|
||||
}
|
||||
if (info.titleId == 0x000500301001400AL ||
|
||||
info.titleId == 0x000500301001410AL ||
|
||||
info.titleId == 0x000500301001420AL) {
|
||||
DEBUG_FUNCTION_LINE("Launching the Eshop");
|
||||
loadConsoleAccount(data.uuid);
|
||||
SYSSwitchToEShop(nullptr);
|
||||
|
||||
StartAppletAndExit();
|
||||
|
||||
return true;
|
||||
}
|
||||
if (info.titleId == 0x000500301001800AL ||
|
||||
info.titleId == 0x000500301001810AL ||
|
||||
info.titleId == 0x000500301001820AL) {
|
||||
DEBUG_FUNCTION_LINE("Launching the Download Management");
|
||||
loadConsoleAccount(data.uuid);
|
||||
_SYSSwitchTo(12);
|
||||
|
||||
StartAppletAndExit();
|
||||
|
||||
return true;
|
||||
}
|
||||
if (info.titleId == 0x000500301001600AL ||
|
||||
info.titleId == 0x000500301001610AL ||
|
||||
info.titleId == 0x000500301001620AL) {
|
||||
DEBUG_FUNCTION_LINE("Launching Miiverse");
|
||||
loadConsoleAccount(data.uuid);
|
||||
_SYSSwitchTo(9);
|
||||
|
||||
StartAppletAndExit();
|
||||
|
||||
return true;
|
||||
}
|
||||
if (info.titleId == 0x000500301001500AL ||
|
||||
info.titleId == 0x000500301001510AL ||
|
||||
info.titleId == 0x000500301001520AL) {
|
||||
DEBUG_FUNCTION_LINE("Launching Friendlist");
|
||||
loadConsoleAccount(data.uuid);
|
||||
_SYSSwitchTo(11);
|
||||
|
||||
StartAppletAndExit();
|
||||
|
||||
return true;
|
||||
}
|
||||
if (info.titleId == 0x000500301001300AL ||
|
||||
info.titleId == 0x000500301001310AL ||
|
||||
info.titleId == 0x000500301001320AL) {
|
||||
DEBUG_FUNCTION_LINE("Launching TVii");
|
||||
loadConsoleAccount(data.uuid);
|
||||
_SYSSwitchTo(3);
|
||||
|
||||
StartAppletAndExit();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!SYSCheckTitleExists(info.titleId)) {
|
||||
DEBUG_FUNCTION_LINE("Title %016llX doesn't exist", info.titleId);
|
||||
return false;
|
||||
@ -141,20 +276,7 @@ bool getQuickBoot() {
|
||||
auto err = MCP_GetTitleInfo(handle, info.titleId, &titleInfo);
|
||||
MCP_Close(handle);
|
||||
if (err == 0) {
|
||||
nn::act::Initialize();
|
||||
for (int32_t i = 0; i < 13; i++) {
|
||||
char uuid[16];
|
||||
result = nn::act::GetUuidEx(uuid, i);
|
||||
if (result.IsSuccess()) {
|
||||
if (memcmp(uuid, data.uuid, 8) == 0) {
|
||||
DEBUG_FUNCTION_LINE("Load Console account %d", i);
|
||||
nn::act::LoadConsoleAccount(i, 0, 0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
nn::act::Finalize();
|
||||
|
||||
loadConsoleAccount(data.uuid);
|
||||
ACPAssignTitlePatch(&titleInfo);
|
||||
_SYSLaunchTitleWithStdArgsInNoSplash(info.titleId, nullptr);
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user