1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-24 03:06:17 +00:00
Atmosphere/stratosphere/dmnt/source/dmnt_cheat_service.hpp

106 lines
4.8 KiB
C++
Raw Normal View History

2019-02-27 10:50:53 +00:00
/*
2019-04-08 03:00:49 +01:00
* Copyright (c) 2018-2019 Atmosphère-NX
2019-02-27 10:50:53 +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/>.
*/
2019-06-20 06:20:44 +01:00
2019-02-27 10:50:53 +00:00
#pragma once
#include <switch.h>
#include <stratosphere.hpp>
#include "dmnt_cheat_types.hpp"
class DmntCheatService final : public IServiceObject {
private:
enum class CommandId {
/* Meta */
HasCheatProcess = 65000,
GetCheatProcessEvent = 65001,
GetCheatProcessMetadata = 65002,
ForceOpenCheatProcess = 65003,
2019-06-20 06:20:44 +01:00
/* Interact with Memory */
GetCheatProcessMappingCount = 65100,
GetCheatProcessMappings = 65101,
ReadCheatProcessMemory = 65102,
WriteCheatProcessMemory = 65103,
QueryCheatProcessMemory = 65104,
2019-06-20 06:20:44 +01:00
/* Interact with Cheats */
GetCheatCount = 65200,
GetCheats = 65201,
GetCheatById = 65202,
ToggleCheat = 65203,
AddCheat = 65204,
RemoveCheat = 65205,
2019-02-27 10:50:53 +00:00
/* Interact with Frozen Addresses */
GetFrozenAddressCount = 65300,
GetFrozenAddresses = 65301,
GetFrozenAddress = 65302,
EnableFrozenAddress = 65303,
DisableFrozenAddress = 65304,
};
2019-02-27 10:50:53 +00:00
private:
void HasCheatProcess(Out<bool> out);
void GetCheatProcessEvent(Out<CopiedHandle> out_event);
Result GetCheatProcessMetadata(Out<CheatProcessMetadata> out_metadata);
Result ForceOpenCheatProcess();
2019-06-20 06:20:44 +01:00
2019-02-27 10:50:53 +00:00
Result GetCheatProcessMappingCount(Out<u64> out_count);
Result GetCheatProcessMappings(OutBuffer<MemoryInfo> mappings, Out<u64> out_count, u64 offset);
Result ReadCheatProcessMemory(OutBuffer<u8> buffer, u64 address, u64 out_size);
Result WriteCheatProcessMemory(InBuffer<u8> buffer, u64 address, u64 in_size);
Result QueryCheatProcessMemory(Out<MemoryInfo> mapping, u64 address);
2019-06-20 06:20:44 +01:00
2019-02-27 10:50:53 +00:00
Result GetCheatCount(Out<u64> out_count);
Result GetCheats(OutBuffer<CheatEntry> cheats, Out<u64> out_count, u64 offset);
Result GetCheatById(OutBuffer<CheatEntry> cheat, u32 cheat_id);
Result ToggleCheat(u32 cheat_id);
Result AddCheat(InBuffer<CheatDefinition> cheat, Out<u32> out_cheat_id, bool enabled);
2019-02-27 10:50:53 +00:00
Result RemoveCheat(u32 cheat_id);
2019-06-20 06:20:44 +01:00
2019-02-27 10:50:53 +00:00
Result GetFrozenAddressCount(Out<u64> out_count);
2019-03-05 06:13:43 +00:00
Result GetFrozenAddresses(OutBuffer<FrozenAddressEntry> addresses, Out<u64> out_count, u64 offset);
Result GetFrozenAddress(Out<FrozenAddressEntry> entry, u64 address);
Result EnableFrozenAddress(Out<u64> out_value, u64 address, u64 width);
2019-03-05 06:13:43 +00:00
Result DisableFrozenAddress(u64 address);
2019-02-27 10:50:53 +00:00
public:
DEFINE_SERVICE_DISPATCH_TABLE {
MAKE_SERVICE_COMMAND_META(DmntCheatService, HasCheatProcess),
MAKE_SERVICE_COMMAND_META(DmntCheatService, GetCheatProcessEvent),
MAKE_SERVICE_COMMAND_META(DmntCheatService, GetCheatProcessMetadata),
MAKE_SERVICE_COMMAND_META(DmntCheatService, ForceOpenCheatProcess),
2019-02-27 10:50:53 +00:00
MAKE_SERVICE_COMMAND_META(DmntCheatService, GetCheatProcessMappingCount),
MAKE_SERVICE_COMMAND_META(DmntCheatService, GetCheatProcessMappings),
MAKE_SERVICE_COMMAND_META(DmntCheatService, ReadCheatProcessMemory),
MAKE_SERVICE_COMMAND_META(DmntCheatService, WriteCheatProcessMemory),
MAKE_SERVICE_COMMAND_META(DmntCheatService, QueryCheatProcessMemory),
2019-02-27 10:50:53 +00:00
MAKE_SERVICE_COMMAND_META(DmntCheatService, GetCheatCount),
MAKE_SERVICE_COMMAND_META(DmntCheatService, GetCheats),
MAKE_SERVICE_COMMAND_META(DmntCheatService, GetCheatById),
MAKE_SERVICE_COMMAND_META(DmntCheatService, ToggleCheat),
MAKE_SERVICE_COMMAND_META(DmntCheatService, AddCheat),
MAKE_SERVICE_COMMAND_META(DmntCheatService, RemoveCheat),
2019-02-27 10:50:53 +00:00
MAKE_SERVICE_COMMAND_META(DmntCheatService, GetFrozenAddressCount),
MAKE_SERVICE_COMMAND_META(DmntCheatService, GetFrozenAddresses),
MAKE_SERVICE_COMMAND_META(DmntCheatService, GetFrozenAddress),
MAKE_SERVICE_COMMAND_META(DmntCheatService, EnableFrozenAddress),
MAKE_SERVICE_COMMAND_META(DmntCheatService, DisableFrozenAddress),
2019-02-27 10:50:53 +00:00
};
};