finalize process when requested by uMenu

This commit is contained in:
lizzie 2026-05-21 05:52:31 +00:00
parent ea4d36ad06
commit a8d6b4fe60
5 changed files with 14 additions and 10 deletions

View file

@ -83,7 +83,9 @@ constexpr size_t SlabCountKDeviceAddressSpace = 300;
constexpr size_t SlabCountKSession = 1133;
constexpr size_t SlabCountKLightSession = 100;
constexpr size_t SlabCountKObjectName = 7;
constexpr size_t SlabCountKResourceLimit = 5;
// Slight divergence to allow for uLaunch to work properly
// TODO(lizzie): This should be 5, shouldn't it?
constexpr size_t SlabCountKResourceLimit = 5 + 8;
constexpr size_t SlabCountKDebug = Core::Hardware::NUM_CPU_CORES;
constexpr size_t SlabCountKIoPool = 1;
constexpr size_t SlabCountKIoRegion = 6;

View file

@ -407,7 +407,7 @@ void AppletManager::SetWindowSystem(WindowSystem* window_system) {
// Applet was started by frontend, so it is foreground.
applet->lifecycle_manager.SetFocusState(FocusState::InFocus);
if (applet->applet_id == AppletId::QLaunch) {
if (applet->applet_id == AppletId::QLaunch || applet->applet_id == AppletId::UlauncherUmenu) {
applet->lifecycle_manager.SetFocusHandlingMode(false);
applet->lifecycle_manager.SetOutOfFocusSuspendingEnabled(false);
m_window_system->TrackApplet(applet, false);

View file

@ -16,6 +16,7 @@
#include "core/hle/service/am/process_creation.h"
#include "core/hle/service/am/service/library_applet_self_accessor.h"
#include "core/hle/service/am/service/storage.h"
#include "core/hle/service/am/window_system.h"
#include "core/hle/service/cmif_serialization.h"
#include "core/hle/service/filesystem/filesystem.h"
#include "core/hle/service/glue/glue_manager.h"
@ -102,10 +103,9 @@ Result ILibraryAppletSelfAccessor::PopInData(Out<SharedPointer<IStorage>> out_st
// uLauncher emulation
static Result UloaderCreateApplication(Core::System& system, u64 program_id) {
FileSys::VirtualFile nca_raw{};
// Get the program NCA from storage.
auto& storage = system.GetContentProviderUnion();
nca_raw = storage.GetEntryRaw(program_id, FileSys::ContentRecordType::Program);
FileSys::VirtualFile nca_raw = storage.GetEntryRaw(program_id, FileSys::ContentRecordType::Program);
// Ensure we retrieved a program NCA.
R_UNLESS(nca_raw != nullptr, ResultUnknown);
std::vector<u8> control;
@ -118,7 +118,7 @@ static Result UloaderCreateApplication(Core::System& system, u64 program_id) {
applet->applet_id = AppletId::Application;
applet->type = AppletType::Application;
applet->library_applet_mode = LibraryAppletMode::AllForeground;
//window_system.TrackApplet(applet, true);
system.GetAppletManager().GetWindowSystem()->TrackApplet(applet, true);
R_SUCCEED();
}
@ -176,9 +176,8 @@ Result ILibraryAppletSelfAccessor::PushOutData(SharedPointer<IStorage> storage)
u64 args_value{};
std::memcpy(std::addressof(args_value), req_data.data() + sizeof(req_cmd), sizeof(args_value));
LOG_WARNING(Service_AM, "program_id={:016x}", args_value);
m_applet->process->Terminate();
UloaderCreateApplication(system, args_value);
R_SUCCEED();
break;
}
case SystemMessage::ResumeApplication:
case SystemMessage::TerminateApplication:
@ -203,6 +202,8 @@ Result ILibraryAppletSelfAccessor::PushOutData(SharedPointer<IStorage> storage)
case SystemMessage::NotifyWarnedAboutOutdatedTheme:
break;
case SystemMessage::TerminateMenu:
m_applet->process->Terminate();
system.GetAppletManager().GetWindowSystem()->RequestApplicationToGetForeground();
break;
case SystemMessage::OpenControllerKeyRemapping:
break;

View file

@ -59,7 +59,7 @@ void WindowSystem::Update() {
void WindowSystem::TrackApplet(std::shared_ptr<Applet> applet, bool is_application) {
std::scoped_lock lk{m_lock};
if (applet->applet_id == AppletId::QLaunch) {
if (applet->applet_id == AppletId::QLaunch || applet->applet_id == AppletId::UlauncherUmenu) {
ASSERT(m_home_menu == nullptr);
m_home_menu = applet.get();
} else if (applet->applet_id == AppletId::OverlayDisplay) {

View file

@ -595,8 +595,9 @@ MainWindow::MainWindow(bool has_broken_vulkan)
std::filesystem::path const sd_dir = Common::FS::GetEdenPathString(Common::FS::EdenPath::SDMCDir);
auto const path = (sd_dir / "ulaunch" / "bin" / "uMenu" / "main").string();
auto const program_id = 0x010000000000FFFF;
auto params = LibraryAppletParameters(program_id, Service::AM::AppletId::UlauncherUmenu);
params.launch_type = Service::AM::LaunchType::FrontendInitiated;
auto const applet_id = Service::AM::AppletId::UlauncherUmenu;
auto params = LibraryAppletParameters(program_id, applet_id);
QtCommon::system->GetFrontendAppletHolder().SetCurrentAppletId(applet_id);
BootGame(QString::fromStdString(path), params);
}
}