2018-10-24 22:05:07 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018 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 <switch.h>
|
2018-10-30 00:30:39 +00:00
|
|
|
#include <stratosphere.hpp>
|
2018-10-24 22:05:07 +01:00
|
|
|
#include "fsmitm_utils.hpp"
|
|
|
|
|
2018-10-30 00:30:39 +00:00
|
|
|
enum SetSysCmd : u32 {
|
|
|
|
SetSysCmd_GetFirmwareVersion = 3,
|
|
|
|
SetSysCmd_GetFirmwareVersion2 = 4,
|
2018-10-24 22:05:07 +01:00
|
|
|
};
|
|
|
|
|
2018-10-30 00:30:39 +00:00
|
|
|
class SetSysMitmService : public IMitmServiceObject {
|
2018-10-24 22:05:07 +01:00
|
|
|
public:
|
2018-10-30 00:30:39 +00:00
|
|
|
SetSysMitmService(std::shared_ptr<Service> s) : IMitmServiceObject(s) {
|
2018-10-24 22:05:07 +01:00
|
|
|
/* ... */
|
|
|
|
}
|
|
|
|
|
2018-10-30 00:30:39 +00:00
|
|
|
static bool ShouldMitm(u64 pid, u64 tid) {
|
2018-10-24 22:05:07 +01:00
|
|
|
/* Only MitM qlaunch, maintenance. */
|
|
|
|
return tid == 0x0100000000001000ULL || tid == 0x0100000000001015ULL;
|
|
|
|
}
|
|
|
|
|
2018-10-30 00:30:39 +00:00
|
|
|
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
|
|
|
|
|
2018-10-24 22:05:07 +01:00
|
|
|
protected:
|
|
|
|
/* Overridden commands. */
|
2018-10-30 00:30:39 +00:00
|
|
|
Result GetFirmwareVersion(OutPointerWithServerSize<SetSysFirmwareVersion, 0x1> out);
|
|
|
|
Result GetFirmwareVersion2(OutPointerWithServerSize<SetSysFirmwareVersion, 0x1> out);
|
|
|
|
public:
|
|
|
|
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
|
|
MakeServiceCommandMeta<SetSysCmd_GetFirmwareVersion, &SetSysMitmService::GetFirmwareVersion>(),
|
|
|
|
MakeServiceCommandMeta<SetSysCmd_GetFirmwareVersion2, &SetSysMitmService::GetFirmwareVersion2>(),
|
|
|
|
};
|
2018-10-24 22:05:07 +01:00
|
|
|
};
|