2019-06-29 10:20:36 +01:00
|
|
|
/*
|
2021-10-04 20:59:10 +01:00
|
|
|
* Copyright (c) Atmosphère-NX
|
2019-06-29 10:20:36 +01:00
|
|
|
*
|
|
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2020-05-11 23:02:10 +01:00
|
|
|
#include <stratosphere.hpp>
|
2019-06-29 10:20:36 +01:00
|
|
|
#include "pm_shell_service.hpp"
|
|
|
|
#include "impl/pm_process_manager.hpp"
|
|
|
|
|
2020-07-08 01:07:23 +01:00
|
|
|
namespace ams::pm {
|
2019-06-29 10:20:36 +01:00
|
|
|
|
|
|
|
/* Overrides for libstratosphere pm::shell commands. */
|
2020-07-08 01:07:23 +01:00
|
|
|
namespace shell {
|
|
|
|
|
|
|
|
Result LaunchProgram(os::ProcessId *out_process_id, const ncm::ProgramLocation &loc, u32 launch_flags) {
|
2022-03-22 06:52:16 +00:00
|
|
|
R_RETURN(impl::LaunchProgram(out_process_id, loc, launch_flags));
|
2020-07-08 01:07:23 +01:00
|
|
|
}
|
|
|
|
|
2019-06-29 10:20:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Service command implementations. */
|
2020-07-08 01:07:23 +01:00
|
|
|
Result ShellService::LaunchProgram(sf::Out<os::ProcessId> out_process_id, const ncm::ProgramLocation &loc, u32 flags) {
|
2022-03-22 06:52:16 +00:00
|
|
|
R_RETURN(pm::shell::LaunchProgram(out_process_id.GetPointer(), loc, flags));
|
2019-06-29 10:20:36 +01:00
|
|
|
}
|
|
|
|
|
2020-07-08 01:07:23 +01:00
|
|
|
Result ShellService::TerminateProcess(os::ProcessId process_id) {
|
2022-03-22 06:52:16 +00:00
|
|
|
R_RETURN(impl::TerminateProcess(process_id));
|
2019-06-29 10:20:36 +01:00
|
|
|
}
|
|
|
|
|
2020-07-08 01:07:23 +01:00
|
|
|
Result ShellService::TerminateProgram(ncm::ProgramId program_id) {
|
2022-03-22 06:52:16 +00:00
|
|
|
R_RETURN(impl::TerminateProgram(program_id));
|
2019-06-29 10:20:36 +01:00
|
|
|
}
|
|
|
|
|
2020-07-08 01:07:23 +01:00
|
|
|
void ShellService::GetProcessEventHandle(sf::OutCopyHandle out) {
|
2021-10-05 08:11:36 +01:00
|
|
|
os::NativeHandle event_handle;
|
|
|
|
R_ABORT_UNLESS(impl::GetProcessEventHandle(std::addressof(event_handle)));
|
|
|
|
|
|
|
|
out.SetValue(event_handle, false);
|
2019-06-29 10:20:36 +01:00
|
|
|
}
|
|
|
|
|
2020-07-08 01:07:23 +01:00
|
|
|
void ShellService::GetProcessEventInfo(sf::Out<ProcessEventInfo> out) {
|
2020-02-23 07:05:14 +00:00
|
|
|
R_ABORT_UNLESS(impl::GetProcessEventInfo(out.GetPointer()));
|
2019-06-29 10:20:36 +01:00
|
|
|
}
|
|
|
|
|
2020-07-08 01:07:23 +01:00
|
|
|
Result ShellService::CleanupProcess(os::ProcessId process_id) {
|
2022-03-22 06:52:16 +00:00
|
|
|
R_RETURN(impl::CleanupProcess(process_id));
|
2019-06-29 10:20:36 +01:00
|
|
|
}
|
|
|
|
|
2020-07-08 01:07:23 +01:00
|
|
|
Result ShellService::ClearExceptionOccurred(os::ProcessId process_id) {
|
2022-03-22 06:52:16 +00:00
|
|
|
R_RETURN(impl::ClearExceptionOccurred(process_id));
|
2019-06-29 10:20:36 +01:00
|
|
|
}
|
|
|
|
|
2020-07-08 01:07:23 +01:00
|
|
|
void ShellService::NotifyBootFinished() {
|
2020-02-23 07:05:14 +00:00
|
|
|
R_ABORT_UNLESS(impl::NotifyBootFinished());
|
2019-06-29 10:20:36 +01:00
|
|
|
}
|
|
|
|
|
2020-07-08 01:07:23 +01:00
|
|
|
Result ShellService::GetApplicationProcessIdForShell(sf::Out<os::ProcessId> out) {
|
2022-03-22 06:52:16 +00:00
|
|
|
R_RETURN(impl::GetApplicationProcessId(out.GetPointer()));
|
2019-06-29 10:20:36 +01:00
|
|
|
}
|
|
|
|
|
2020-07-08 01:07:23 +01:00
|
|
|
Result ShellService::BoostSystemMemoryResourceLimit(u64 boost_size) {
|
2022-03-22 06:52:16 +00:00
|
|
|
R_RETURN(impl::BoostSystemMemoryResourceLimit(boost_size));
|
2019-06-29 10:20:36 +01:00
|
|
|
}
|
|
|
|
|
2020-07-08 01:07:23 +01:00
|
|
|
Result ShellService::BoostApplicationThreadResourceLimit() {
|
2022-03-22 06:52:16 +00:00
|
|
|
R_RETURN(impl::BoostApplicationThreadResourceLimit());
|
2019-06-29 10:20:36 +01:00
|
|
|
}
|
|
|
|
|
2020-07-08 01:07:23 +01:00
|
|
|
void ShellService::GetBootFinishedEventHandle(sf::OutCopyHandle out) {
|
2021-10-05 08:11:36 +01:00
|
|
|
os::NativeHandle event_handle;
|
|
|
|
R_ABORT_UNLESS(impl::GetBootFinishedEventHandle(std::addressof(event_handle)));
|
|
|
|
|
|
|
|
out.SetValue(event_handle, false);
|
2019-06-29 10:20:36 +01:00
|
|
|
}
|
|
|
|
|
2022-03-22 06:52:16 +00:00
|
|
|
Result ShellService::BoostSystemThreadResourceLimit() {
|
|
|
|
R_RETURN(impl::BoostSystemThreadResourceLimit());
|
|
|
|
}
|
|
|
|
|
2019-06-29 10:20:36 +01:00
|
|
|
}
|