Atmosphere/stratosphere/ams_mitm/source/set_mitm/setsys_mitm_service.hpp

57 lines
2.2 KiB
C++
Raw Normal View History

2018-10-30 05:18:04 +00:00
/*
2019-04-08 02:00:49 +00:00
* Copyright (c) 2018-2019 Atmosphère-NX
2018-10-30 05:18:04 +00: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/>.
*/
2018-10-30 05:18:04 +00:00
#pragma once
#include <switch.h>
#include <stratosphere.hpp>
#include "setsys_shim.h"
class SetSysMitmService : public IMitmServiceObject {
private:
enum class CommandId {
GetFirmwareVersion = 3,
GetFirmwareVersion2 = 4,
GetSettingsItemValueSize = 37,
GetSettingsItemValue = 38,
};
2018-10-30 05:18:04 +00:00
public:
SetSysMitmService(std::shared_ptr<Service> s, u64 pid, ams::ncm::TitleId tid) : IMitmServiceObject(s, pid, tid) {
2018-10-30 05:18:04 +00:00
/* ... */
}
static bool ShouldMitm(u64 pid, ams::ncm::TitleId tid) {
/* Mitm everything. */
return true;
2018-10-30 05:18:04 +00:00
}
2018-10-30 05:18:04 +00:00
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
2018-10-30 05:18:04 +00:00
protected:
/* Overridden commands. */
Result GetFirmwareVersion(OutPointerWithServerSize<SetSysFirmwareVersion, 0x1> out);
Result GetFirmwareVersion2(OutPointerWithServerSize<SetSysFirmwareVersion, 0x1> out);
Result GetSettingsItemValueSize(Out<u64> out_size, InPointer<char> name, InPointer<char> key);
Result GetSettingsItemValue(Out<u64> out_size, OutBuffer<u8> out_value, InPointer<char> name, InPointer<char> key);
2018-10-30 05:18:04 +00:00
public:
DEFINE_SERVICE_DISPATCH_TABLE {
MAKE_SERVICE_COMMAND_META(SetSysMitmService, GetFirmwareVersion),
MAKE_SERVICE_COMMAND_META(SetSysMitmService, GetFirmwareVersion2),
MAKE_SERVICE_COMMAND_META(SetSysMitmService, GetSettingsItemValueSize),
MAKE_SERVICE_COMMAND_META(SetSysMitmService, GetSettingsItemValue),
2018-10-30 05:18:04 +00:00
};
};