mirror of
https://github.com/XorTroll/uLaunch
synced 2024-11-26 13:50:25 +00:00
Allow homebrew launching in main menu with suspended title
This commit is contained in:
parent
da97db20e3
commit
d3a43edb8a
6 changed files with 25 additions and 40 deletions
|
@ -6,8 +6,6 @@ namespace db
|
|||
{
|
||||
static constexpr u64 HomeMenuSaveDataId = 0x8000000000001010;
|
||||
|
||||
#define DB_INSIDE_BASE_DIR(path) std::string(Q_BASE_DB_DIR "/") + path
|
||||
|
||||
struct PassBlock
|
||||
{
|
||||
AccountUid uid;
|
||||
|
|
|
@ -82,33 +82,7 @@ inline constexpr ResultWith<Args...> SuccessResultWith(Args &&...args)
|
|||
|
||||
inline void Panic(std::string msg)
|
||||
{
|
||||
/*
|
||||
consoleInit(NULL);
|
||||
CONSOLE_OUT("")
|
||||
CONSOLE_OUT("uLaunch - main menu panic")
|
||||
CONSOLE_OUT("Panic error: " << msg)
|
||||
CONSOLE_OUT("")
|
||||
CONSOLE_OUT("Press any key to shutdown the console...")
|
||||
|
||||
while(true)
|
||||
{
|
||||
hidScanInput();
|
||||
if(hidKeysDown(CONTROLLER_P1_AUTO))
|
||||
{
|
||||
consoleExit(NULL);
|
||||
bpcInitialize();
|
||||
bpcShutdownSystem();
|
||||
bpcExit();
|
||||
while(true);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
consoleExit(NULL);
|
||||
*/
|
||||
|
||||
// TODO: non-console panic...?
|
||||
}
|
||||
|
||||
#define Q_R_TRY(expr) { auto _tmp_rc = (expr); if(R_FAILED(_tmp_rc)) { Panic("'" #expr "' failed: " + util::FormatResultDisplay(_tmp_rc)); } }
|
||||
#define Q_R_TRY(expr) { auto _tmp_rc = (expr); if(R_FAILED(_tmp_rc)) { fatalThrow(_tmp_rc); } }
|
|
@ -60,10 +60,12 @@ namespace db
|
|||
std::string pwd;
|
||||
auto filename = GetUserPasswordFilePath(password.uid);
|
||||
if(fs::ExistsFile(filename)) return RES_VALUE(Db, PasswordAlreadyExists);
|
||||
|
||||
if(!fs::WriteFile(filename, &password, sizeof(password), true)) return RES_VALUE(Db, PasswordWriteFail);
|
||||
db::Commit();
|
||||
return 0;
|
||||
if(fs::WriteFile(filename, &password, sizeof(password), true))
|
||||
{
|
||||
db::Commit();
|
||||
return 0;
|
||||
}
|
||||
return RES_VALUE(Db, PasswordWriteFail);
|
||||
}
|
||||
|
||||
Result RemoveUserPassword(AccountUid uid)
|
||||
|
@ -71,6 +73,7 @@ namespace db
|
|||
auto passfile = GetUserPasswordFilePath(uid);
|
||||
if(!fs::ExistsFile(passfile)) return RES_VALUE(Db, PasswordNotFound);
|
||||
fs::DeleteFile(passfile);
|
||||
db::Commit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -391,9 +391,13 @@ namespace ui
|
|||
}
|
||||
if(titlelaunch)
|
||||
{
|
||||
titlelaunch = false;
|
||||
this->HandleCloseSuspended();
|
||||
titlelaunch = !qapp->IsSuspended();
|
||||
// Homebrew launching code already does this checks later - doing this check only with installed titles
|
||||
if((cfg::TitleType)title.title_type == cfg::TitleType::Installed)
|
||||
{
|
||||
titlelaunch = false;
|
||||
this->HandleCloseSuspended();
|
||||
titlelaunch = !qapp->IsSuspended();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(titlelaunch)
|
||||
|
@ -1113,11 +1117,17 @@ namespace ui
|
|||
|
||||
if(msg != os::GeneralChannelMessage::Invalid)
|
||||
{
|
||||
// Fade out on all cases
|
||||
qapp->FadeOut();
|
||||
os::SystemAppletMessage smsg = {};
|
||||
smsg.magic = os::SAMSMagic;
|
||||
smsg.message = (u32)msg;
|
||||
|
||||
os::PushSystemAppletMessage(smsg);
|
||||
svcSleepThread(1'500'000'000L);
|
||||
|
||||
// When we get back after sleep we will do a cool fade in, whereas wuth the other options the console will be already off/rebooted
|
||||
qapp->FadeIn();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
2
Makefile
2
Makefile
|
@ -29,8 +29,6 @@ dev: setdev all
|
|||
|
||||
clean:
|
||||
@rm -rf $(CURDIR)/SdOut
|
||||
@$(MAKE) clean -C master-libnx/
|
||||
@$(MAKE) clean -C libstratosphere/
|
||||
@$(MAKE) clean -C SystemAppletQDaemon/
|
||||
@$(MAKE) clean -C LibraryAppletQMenu/
|
||||
@$(MAKE) clean -C LibraryAppletQHbTarget/
|
||||
|
|
|
@ -445,11 +445,12 @@ namespace qdaemon
|
|||
|
||||
fs::CreateDirectory(Q_BASE_DB_DIR);
|
||||
db::Commit();
|
||||
fs::CreateDirectory(Q_BASE_DB_DIR "/user");
|
||||
db::Commit();
|
||||
|
||||
fs::CreateDirectory(Q_BASE_SD_DIR);
|
||||
fs::CreateDirectory(Q_ENTRIES_PATH);
|
||||
fs::CreateDirectory(Q_THEMES_PATH);
|
||||
fs::CreateDirectory(Q_BASE_DB_DIR "/user");
|
||||
db::Commit();
|
||||
fs::CreateDirectory(Q_BASE_SD_DIR "/title");
|
||||
fs::CreateDirectory(Q_BASE_SD_DIR "/user");
|
||||
fs::CreateDirectory(Q_BASE_SD_DIR "/nro");
|
||||
|
@ -483,6 +484,7 @@ namespace qdaemon
|
|||
{
|
||||
db::Mount();
|
||||
fs::DeleteDirectory(Q_BASE_DB_DIR);
|
||||
db::Commit();
|
||||
fs::CreateDirectory(Q_BASE_DB_DIR);
|
||||
db::Commit();
|
||||
db::Unmount();
|
||||
|
|
Loading…
Reference in a new issue