diff --git a/libraries/libstratosphere/include/stratosphere/pgl.hpp b/libraries/libstratosphere/include/stratosphere/pgl.hpp index c1ac74f9d..556e1e5f2 100644 --- a/libraries/libstratosphere/include/stratosphere/pgl.hpp +++ b/libraries/libstratosphere/include/stratosphere/pgl.hpp @@ -19,4 +19,5 @@ #include #include #include -#include +#include +#include diff --git a/libraries/libstratosphere/include/stratosphere/pgl/srv/pgl_srv_api.hpp b/libraries/libstratosphere/include/stratosphere/pgl/srv/pgl_srv_api.hpp new file mode 100644 index 000000000..ab49b14af --- /dev/null +++ b/libraries/libstratosphere/include/stratosphere/pgl/srv/pgl_srv_api.hpp @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2018-2020 Atmosphère-NX + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once +#include +#include +#include + +namespace ams::pgl::srv { + + void Initialize(ShellInterface *interface, MemoryResource *mr); + +} diff --git a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_interface.hpp b/libraries/libstratosphere/include/stratosphere/pgl/srv/pgl_srv_shell_interface.hpp similarity index 95% rename from libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_interface.hpp rename to libraries/libstratosphere/include/stratosphere/pgl/srv/pgl_srv_shell_interface.hpp index 6a9889117..40f74f3ba 100644 --- a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_interface.hpp +++ b/libraries/libstratosphere/include/stratosphere/pgl/srv/pgl_srv_shell_interface.hpp @@ -14,7 +14,9 @@ * along with this program. If not, see . */ #pragma once -#include +#include +#include +#include namespace ams::pgl::srv { diff --git a/libraries/libstratosphere/include/stratosphere/pm/pm_shell_api.hpp b/libraries/libstratosphere/include/stratosphere/pm/pm_shell_api.hpp index cba0e47c4..4dd79409c 100644 --- a/libraries/libstratosphere/include/stratosphere/pm/pm_shell_api.hpp +++ b/libraries/libstratosphere/include/stratosphere/pm/pm_shell_api.hpp @@ -27,5 +27,6 @@ namespace ams::pm::shell { Result TerminateProcess(os::ProcessId process_id); Result GetApplicationProcessIdForShell(os::ProcessId *out); Result BoostSystemMemoryResourceLimit(u64 size); + Result EnableApplicationExtraThread(); } diff --git a/libraries/libstratosphere/source/pgl/srv/pgl_srv_api.cpp b/libraries/libstratosphere/source/pgl/srv/pgl_srv_api.cpp new file mode 100644 index 000000000..330d11550 --- /dev/null +++ b/libraries/libstratosphere/source/pgl/srv/pgl_srv_api.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2018-2020 Atmosphère-NX + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include +#include "pgl_srv_shell.hpp" + +namespace ams::pgl::srv { + + void Initialize(ShellInterface *interface, MemoryResource *mr) { + /* Set the memory resource for the interface. */ + interface->Initialize(mr); + + /* Enable extra application threads, if we should. */ + u8 enable_application_extra_thread; + const size_t sz = settings::fwdbg::GetSettingsItemValue(std::addressof(enable_application_extra_thread), sizeof(enable_application_extra_thread), "application_extra_thread", "enable_application_extra_thread"); + if (sz == sizeof(enable_application_extra_thread) && enable_application_extra_thread != 0) { + /* NOTE: Nintendo does not check that this succeeds. */ + pm::shell::EnableApplicationExtraThread(); + } + + /* Start the Process Tracking thread. */ + pgl::srv::InitializeProcessControlTask(); + } + + +} \ No newline at end of file diff --git a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_interface.cpp b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_interface.cpp index f485cf345..12c8bf044 100644 --- a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_interface.cpp +++ b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_interface.cpp @@ -14,7 +14,6 @@ * along with this program. If not, see . */ #include -#include "pgl_srv_shell_interface.hpp" #include "pgl_srv_shell.hpp" namespace ams::pgl::srv { diff --git a/libraries/libstratosphere/source/pm/pm_shell_api.cpp b/libraries/libstratosphere/source/pm/pm_shell_api.cpp index 16a1adf2c..cee379611 100644 --- a/libraries/libstratosphere/source/pm/pm_shell_api.cpp +++ b/libraries/libstratosphere/source/pm/pm_shell_api.cpp @@ -37,4 +37,8 @@ namespace ams::pm::shell { return ::pmshellBoostSystemMemoryResourceLimit(size); } + Result EnableApplicationExtraThread() { + return ::pmshellEnableApplicationExtraThread(); + } + }