From 10e1ab3e3c99a253a0a73210b0b58caa229a4d68 Mon Sep 17 00:00:00 2001 From: XorTroll Date: Thu, 23 Sep 2021 19:59:15 +0200 Subject: [PATCH] Reduce uMenu's heap, fix application exiting --- Atmosphere-libs | 2 +- Plutonium | 2 +- uDaemon/source/Main.cpp | 2 +- uLaunch/source/am/am_Application.cpp | 10 +++++++++- uMenu/source/Main.cpp | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Atmosphere-libs b/Atmosphere-libs index eb667fea..dc52a322 160000 --- a/Atmosphere-libs +++ b/Atmosphere-libs @@ -1 +1 @@ -Subproject commit eb667fea5142fd35caf539289603748dd6f4f87e +Subproject commit dc52a32285c62fbb68e701393ec3b4efdc452343 diff --git a/Plutonium b/Plutonium index 4879af5a..fe5a9b96 160000 --- a/Plutonium +++ b/Plutonium @@ -1 +1 @@ -Subproject commit 4879af5a4df5c3af99f620b30e6da0bddd376a6d +Subproject commit fe5a9b96e52b70eceea493def38418fe021d2e74 diff --git a/uDaemon/source/Main.cpp b/uDaemon/source/Main.cpp index c82ba4ea..67ccab96 100644 --- a/uDaemon/source/Main.cpp +++ b/uDaemon/source/Main.cpp @@ -107,7 +107,7 @@ void __appInit() { void __appExit() { // qlaunch should not terminate, so this is considered an invalid system state // am would fatal otherwise - fatalThrow(0xDEADBABE); + UL_ASSERT(0xDEADBABE); } namespace { diff --git a/uLaunch/source/am/am_Application.cpp b/uLaunch/source/am/am_Application.cpp index 34f6e198..9ddcc777 100644 --- a/uLaunch/source/am/am_Application.cpp +++ b/uLaunch/source/am/am_Application.cpp @@ -12,22 +12,30 @@ namespace am { extern bool g_DaemonHasFocus; bool ApplicationIsActive() { - if(g_ApplicationHolder.StateChangedEvent.revent == INVALID_HANDLE) { + if(!eventActive(&g_ApplicationHolder.StateChangedEvent)) { return false; } if(!serviceIsActive(&g_ApplicationHolder.s)) { return false; } + return !appletApplicationCheckFinished(&g_ApplicationHolder); } void ApplicationTerminate() { appletApplicationRequestExit(&g_ApplicationHolder); + + // Wait until it's actually exited + while(ApplicationIsActive()) { + svcSleepThread(10'000'000); + } + g_DaemonHasFocus = true; } Result ApplicationStart(u64 app_id, bool system, AccountUid user_id, void *data, size_t size) { appletApplicationClose(&g_ApplicationHolder); + if(system) { R_TRY(appletCreateSystemApplication(&g_ApplicationHolder, app_id)); } diff --git a/uMenu/source/Main.cpp b/uMenu/source/Main.cpp index 7e1da3fa..9f0cd5f1 100644 --- a/uMenu/source/Main.cpp +++ b/uMenu/source/Main.cpp @@ -21,7 +21,7 @@ extern "C" { u32 __nx_applet_type = AppletType_LibraryApplet; // Explicitly declare we're a library applet (need to do so for non-hbloader homebrew) TimeServiceType __nx_time_service_type = TimeServiceType_System; u32 __nx_fs_num_sessions = 1; - size_t __nx_heap_size = 0xC000000; + size_t __nx_heap_size = 0xB000000; }