2019-06-29 09:20:36 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2019 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <stratosphere.hpp>
|
|
|
|
|
2019-10-24 09:30:10 +00:00
|
|
|
namespace ams::pm::shell {
|
2019-06-29 09:20:36 +00:00
|
|
|
|
2019-10-15 05:49:06 +00:00
|
|
|
class ShellServiceBase : public sf::IServiceObject {
|
2019-06-29 09:20:36 +00:00
|
|
|
protected:
|
|
|
|
/* Actual command implementations. */
|
2019-10-15 05:49:06 +00:00
|
|
|
virtual Result LaunchTitle(sf::Out<os::ProcessId> out_process_id, const ncm::TitleLocation &loc, u32 flags);
|
|
|
|
virtual Result TerminateProcess(os::ProcessId process_id);
|
2019-06-29 09:20:36 +00:00
|
|
|
virtual Result TerminateTitle(ncm::TitleId title_id);
|
2019-10-15 05:49:06 +00: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 09:20:36 +00:00
|
|
|
virtual void NotifyBootFinished();
|
2019-10-15 05:49:06 +00:00
|
|
|
virtual Result GetApplicationProcessIdForShell(sf::Out<os::ProcessId> out);
|
2019-06-29 09:20:36 +00:00
|
|
|
virtual Result BoostSystemMemoryResourceLimit(u64 boost_size);
|
2019-07-03 04:27:53 +00:00
|
|
|
virtual Result BoostApplicationThreadResourceLimit();
|
2019-10-15 05:49:06 +00:00
|
|
|
virtual void GetBootFinishedEventHandle(sf::OutCopyHandle out);
|
2019-06-29 09:20:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* This represents modern ShellService (5.0.0+). */
|
|
|
|
class ShellService final : public ShellServiceBase {
|
|
|
|
private:
|
|
|
|
enum class CommandId {
|
2019-07-03 04:27:53 +00:00
|
|
|
LaunchTitle = 0,
|
|
|
|
TerminateProcess = 1,
|
|
|
|
TerminateTitle = 2,
|
|
|
|
GetProcessEventHandle = 3,
|
|
|
|
GetProcessEventInfo = 4,
|
|
|
|
NotifyBootFinished = 5,
|
|
|
|
GetApplicationProcessIdForShell = 6,
|
|
|
|
BoostSystemMemoryResourceLimit = 7,
|
|
|
|
BoostApplicationThreadResourceLimit = 8,
|
|
|
|
GetBootFinishedEventHandle = 9,
|
2019-06-29 09:20:36 +00:00
|
|
|
};
|
|
|
|
public:
|
|
|
|
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
|
|
/* 5.0.0-* */
|
2019-10-15 05:49:06 +00:00
|
|
|
MAKE_SERVICE_COMMAND_META(LaunchTitle),
|
|
|
|
MAKE_SERVICE_COMMAND_META(TerminateProcess),
|
|
|
|
MAKE_SERVICE_COMMAND_META(TerminateTitle),
|
|
|
|
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 09:20:36 +00:00
|
|
|
|
|
|
|
/* 7.0.0-* */
|
2019-10-15 05:49:06 +00:00
|
|
|
MAKE_SERVICE_COMMAND_META(BoostApplicationThreadResourceLimit, hos::Version_700),
|
2019-06-29 09:20:36 +00:00
|
|
|
|
|
|
|
/* 8.0.0-* */
|
2019-10-15 05:49:06 +00:00
|
|
|
MAKE_SERVICE_COMMAND_META(GetBootFinishedEventHandle, hos::Version_800),
|
2019-06-29 09:20:36 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
/* This represents deprecated ShellService (1.0.0-4.1.0). */
|
|
|
|
class ShellServiceDeprecated final : public ShellServiceBase {
|
|
|
|
private:
|
|
|
|
enum class CommandId {
|
|
|
|
LaunchTitle = 0,
|
|
|
|
TerminateProcess = 1,
|
|
|
|
TerminateTitle = 2,
|
|
|
|
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 */
|
2019-10-15 05:49:06 +00:00
|
|
|
MAKE_SERVICE_COMMAND_META(LaunchTitle),
|
|
|
|
MAKE_SERVICE_COMMAND_META(TerminateProcess),
|
|
|
|
MAKE_SERVICE_COMMAND_META(TerminateTitle),
|
|
|
|
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 09:20:36 +00:00
|
|
|
|
|
|
|
/* 4.0.0-4.1.0 */
|
2019-10-15 05:49:06 +00:00
|
|
|
MAKE_SERVICE_COMMAND_META(BoostSystemMemoryResourceLimit, hos::Version_400),
|
2019-06-29 09:20:36 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|