1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-25 11:46:05 +00:00
Atmosphere/stratosphere/pm/source/pm_shell_service.hpp

107 lines
4.9 KiB
C++
Raw Normal View History

2019-06-29 10:20:36 +01:00
/*
* Copyright (c) 2018-2020 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/>.
*/
#pragma once
#include <stratosphere.hpp>
namespace ams::pm::shell {
2019-06-29 10:20:36 +01:00
2019-10-15 06:49:06 +01:00
class ShellServiceBase : public sf::IServiceObject {
2019-06-29 10:20:36 +01:00
protected:
/* Actual command implementations. */
virtual Result LaunchProgram(sf::Out<os::ProcessId> out_process_id, const ncm::ProgramLocation &loc, u32 flags);
2019-10-15 06:49:06 +01:00
virtual Result TerminateProcess(os::ProcessId process_id);
virtual Result TerminateProgram(ncm::ProgramId program_id);
2019-10-15 06:49:06 +01:00
virtual void GetProcessEventHandle(sf::OutCopyHandle out);
virtual void GetProcessEventInfo(sf::Out<ProcessEventInfo> out);
virtual Result CleanupProcess(os::ProcessId process_id);
virtual Result ClearExceptionOccurred(os::ProcessId process_id);
2019-06-29 10:20:36 +01:00
virtual void NotifyBootFinished();
2019-10-15 06:49:06 +01:00
virtual Result GetApplicationProcessIdForShell(sf::Out<os::ProcessId> out);
2019-06-29 10:20:36 +01:00
virtual Result BoostSystemMemoryResourceLimit(u64 boost_size);
virtual Result BoostApplicationThreadResourceLimit();
2019-10-15 06:49:06 +01:00
virtual void GetBootFinishedEventHandle(sf::OutCopyHandle out);
2019-06-29 10:20:36 +01:00
};
/* This represents modern ShellService (5.0.0+). */
class ShellService final : public ShellServiceBase {
private:
enum class CommandId {
LaunchProgram = 0,
TerminateProcess = 1,
TerminateProgram = 2,
GetProcessEventHandle = 3,
GetProcessEventInfo = 4,
NotifyBootFinished = 5,
GetApplicationProcessIdForShell = 6,
BoostSystemMemoryResourceLimit = 7,
BoostApplicationThreadResourceLimit = 8,
GetBootFinishedEventHandle = 9,
2019-06-29 10:20:36 +01:00
};
public:
DEFINE_SERVICE_DISPATCH_TABLE {
/* 5.0.0-* */
MAKE_SERVICE_COMMAND_META(LaunchProgram),
2019-10-15 06:49:06 +01:00
MAKE_SERVICE_COMMAND_META(TerminateProcess),
MAKE_SERVICE_COMMAND_META(TerminateProgram),
2019-10-15 06:49:06 +01:00
MAKE_SERVICE_COMMAND_META(GetProcessEventHandle),
MAKE_SERVICE_COMMAND_META(GetProcessEventInfo),
MAKE_SERVICE_COMMAND_META(NotifyBootFinished),
MAKE_SERVICE_COMMAND_META(GetApplicationProcessIdForShell),
MAKE_SERVICE_COMMAND_META(BoostSystemMemoryResourceLimit),
2019-06-29 10:20:36 +01:00
/* 7.0.0-* */
2020-04-14 06:19:44 +01:00
MAKE_SERVICE_COMMAND_META(BoostApplicationThreadResourceLimit, hos::Version_7_0_0),
2019-06-29 10:20:36 +01:00
/* 8.0.0-* */
2020-04-14 06:19:44 +01:00
MAKE_SERVICE_COMMAND_META(GetBootFinishedEventHandle, hos::Version_8_0_0),
2019-06-29 10:20:36 +01:00
};
};
/* This represents deprecated ShellService (1.0.0-4.1.0). */
class ShellServiceDeprecated final : public ShellServiceBase {
private:
enum class CommandId {
LaunchProgram = 0,
2019-06-29 10:20:36 +01:00
TerminateProcess = 1,
TerminateProgram = 2,
2019-06-29 10:20:36 +01:00
GetProcessEventHandle = 3,
GetProcessEventInfo = 4,
CleanupProcess = 5,
ClearExceptionOccurred = 6,
NotifyBootFinished = 7,
GetApplicationProcessIdForShell = 8,
BoostSystemMemoryResourceLimit = 9,
};
public:
DEFINE_SERVICE_DISPATCH_TABLE {
/* 1.0.0-4.1.0 */
MAKE_SERVICE_COMMAND_META(LaunchProgram),
2019-10-15 06:49:06 +01:00
MAKE_SERVICE_COMMAND_META(TerminateProcess),
MAKE_SERVICE_COMMAND_META(TerminateProgram),
2019-10-15 06:49:06 +01:00
MAKE_SERVICE_COMMAND_META(GetProcessEventHandle),
MAKE_SERVICE_COMMAND_META(GetProcessEventInfo),
MAKE_SERVICE_COMMAND_META(CleanupProcess),
MAKE_SERVICE_COMMAND_META(ClearExceptionOccurred),
MAKE_SERVICE_COMMAND_META(NotifyBootFinished),
MAKE_SERVICE_COMMAND_META(GetApplicationProcessIdForShell),
2019-06-29 10:20:36 +01:00
/* 4.0.0-4.1.0 */
2020-04-14 06:19:44 +01:00
MAKE_SERVICE_COMMAND_META(BoostSystemMemoryResourceLimit, hos::Version_4_0_0),
2019-06-29 10:20:36 +01:00
};
};
}