/*
* 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 .
*/
#pragma once
#include
#include
#include "pm_registration.hpp"
enum DmntCmd {
Dmnt_Cmd_GetUnknownStub = 0,
Dmnt_Cmd_GetDebugProcessIds = 1,
Dmnt_Cmd_LaunchDebugProcess = 2,
Dmnt_Cmd_GetTitleProcessId = 3,
Dmnt_Cmd_EnableDebugForTitleId = 4,
Dmnt_Cmd_GetApplicationProcessId = 5,
Dmnt_Cmd_EnableDebugForApplication = 6,
Dmnt_Cmd_5X_GetDebugProcessIds = 0,
Dmnt_Cmd_5X_LaunchDebugProcess = 1,
Dmnt_Cmd_5X_GetTitleProcessId = 2,
Dmnt_Cmd_5X_EnableDebugForTitleId = 3,
Dmnt_Cmd_5X_GetApplicationProcessId = 4,
Dmnt_Cmd_5X_EnableDebugForApplication = 5,
Dmnt_Cmd_6X_DisableDebug = 6,
Dmnt_Cmd_AtmosphereGetProcessInfo = 65000,
Dmnt_Cmd_AtmosphereGetCurrentLimitInfo = 65001,
};
class DebugMonitorService final : public IServiceObject {
private:
/* Actual commands. */
Result GetUnknownStub(Out count, OutBuffer out_buf, u64 in_unk);
Result GetDebugProcessIds(Out count, OutBuffer out_pids);
Result LaunchDebugProcess(u64 pid);
Result GetTitleProcessId(Out pid, u64 tid);
Result EnableDebugForTitleId(Out event, u64 tid);
Result GetApplicationProcessId(Out pid);
Result EnableDebugForApplication(Out event);
Result DisableDebug(u32 which);
/* Atmosphere commands. */
Result AtmosphereGetProcessInfo(Out proc_hand, Out tid_sid, u64 pid);
Result AtmosphereGetCurrentLimitInfo(Out cur_val, Out lim_val, u32 category, u32 resource);
public:
DEFINE_SERVICE_DISPATCH_TABLE {
/* 1.0.0-4.1.0 */
MakeServiceCommandMeta(),
MakeServiceCommandMeta(),
MakeServiceCommandMeta(),
MakeServiceCommandMeta(),
MakeServiceCommandMeta(),
MakeServiceCommandMeta(),
MakeServiceCommandMeta(),
/* 5.0.0-* */
MakeServiceCommandMeta(),
MakeServiceCommandMeta(),
MakeServiceCommandMeta(),
MakeServiceCommandMeta(),
MakeServiceCommandMeta(),
MakeServiceCommandMeta(),
/* 6.0.0-* */
MakeServiceCommandMeta(),
/* Atmosphere extensions. */
MakeServiceCommandMeta(),
MakeServiceCommandMeta(),
};
};