properly start some stuff?

This commit is contained in:
lizzie 2026-05-21 16:58:18 +00:00
parent a8d6b4fe60
commit 6b94984041
2 changed files with 15 additions and 9 deletions

View file

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

View file

@ -49,8 +49,9 @@ AppletIdentityInfo GetCallerIdentity(Applet& applet) {
ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_, ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_,
std::shared_ptr<Applet> applet) std::shared_ptr<Applet> applet)
: ServiceFramework{system_, "ILibraryAppletSelfAccessor"}, m_applet{std::move(applet)}, : ServiceFramework{system_, "ILibraryAppletSelfAccessor"}, m_applet{std::move(applet)}
m_broker{m_applet->caller_applet_broker} { , m_broker{m_applet->caller_applet_broker}
{
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, D<&ILibraryAppletSelfAccessor::PopInData>, "PopInData"}, {0, D<&ILibraryAppletSelfAccessor::PopInData>, "PopInData"},
@ -102,7 +103,7 @@ Result ILibraryAppletSelfAccessor::PopInData(Out<SharedPointer<IStorage>> out_st
} }
// uLauncher emulation // uLauncher emulation
static Result UloaderCreateApplication(Core::System& system, u64 program_id) { static Result UloaderCreateApplication(Core::System& system, u64 program_id, std::shared_ptr<Applet> caller_applet) {
// Get the program NCA from storage. // Get the program NCA from storage.
auto& storage = system.GetContentProviderUnion(); auto& storage = system.GetContentProviderUnion();
FileSys::VirtualFile nca_raw = storage.GetEntryRaw(program_id, FileSys::ContentRecordType::Program); FileSys::VirtualFile nca_raw = storage.GetEntryRaw(program_id, FileSys::ContentRecordType::Program);
@ -118,6 +119,12 @@ static Result UloaderCreateApplication(Core::System& system, u64 program_id) {
applet->applet_id = AppletId::Application; applet->applet_id = AppletId::Application;
applet->type = AppletType::Application; applet->type = AppletType::Application;
applet->library_applet_mode = LibraryAppletMode::AllForeground; applet->library_applet_mode = LibraryAppletMode::AllForeground;
applet->caller_applet = caller_applet;
applet->caller_applet_broker = std::make_shared<AppletDataBroker>(system);
applet->frontend = caller_applet->frontend;
caller_applet->child_applets.push_back(applet);
system.GetAppletManager().GetWindowSystem()->TrackApplet(applet, true); system.GetAppletManager().GetWindowSystem()->TrackApplet(applet, true);
R_SUCCEED(); R_SUCCEED();
} }
@ -176,7 +183,7 @@ Result ILibraryAppletSelfAccessor::PushOutData(SharedPointer<IStorage> storage)
u64 args_value{}; u64 args_value{};
std::memcpy(std::addressof(args_value), req_data.data() + sizeof(req_cmd), sizeof(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); LOG_WARNING(Service_AM, "program_id={:016x}", args_value);
UloaderCreateApplication(system, args_value); UloaderCreateApplication(system, args_value, m_applet);
break; break;
} }
case SystemMessage::ResumeApplication: case SystemMessage::ResumeApplication:
@ -202,8 +209,8 @@ Result ILibraryAppletSelfAccessor::PushOutData(SharedPointer<IStorage> storage)
case SystemMessage::NotifyWarnedAboutOutdatedTheme: case SystemMessage::NotifyWarnedAboutOutdatedTheme:
break; break;
case SystemMessage::TerminateMenu: case SystemMessage::TerminateMenu:
m_applet->process->Terminate(); system.GetUserChannel() = m_applet->user_channel_launch_parameter;
system.GetAppletManager().GetWindowSystem()->RequestApplicationToGetForeground(); system.ExecuteProgram(0);
break; break;
case SystemMessage::OpenControllerKeyRemapping: case SystemMessage::OpenControllerKeyRemapping:
break; break;