/* * 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 . */ #pragma once #include #include #include "dmnt_cheat_types.hpp" enum DmntCheatCmd { /* Meta */ DmntCheat_Cmd_HasCheatProcess = 65000, DmntCheat_Cmd_GetCheatProcessEvent = 65001, DmntCheat_Cmd_GetCheatProcessMetadata = 65002, DmntCheat_Cmd_ForceOpenCheatProcess = 65003, /* Interact with Memory */ DmntCheat_Cmd_GetCheatProcessMappingCount = 65100, DmntCheat_Cmd_GetCheatProcessMappings = 65101, DmntCheat_Cmd_ReadCheatProcessMemory = 65102, DmntCheat_Cmd_WriteCheatProcessMemory = 65103, DmntCheat_Cmd_QueryCheatProcessMemory = 65104, /* Interact with Cheats */ DmntCheat_Cmd_GetCheatCount = 65200, DmntCheat_Cmd_GetCheats = 65201, DmntCheat_Cmd_GetCheatById = 65202, DmntCheat_Cmd_ToggleCheat = 65203, DmntCheat_Cmd_AddCheat = 65204, DmntCheat_Cmd_RemoveCheat = 65205, /* Interact with Frozen Addresses */ DmntCheat_Cmd_GetFrozenAddressCount = 65300, DmntCheat_Cmd_GetFrozenAddresses = 65301, DmntCheat_Cmd_ToggleAddressFrozen = 65302, }; class DmntCheatService final : public IServiceObject { private: void HasCheatProcess(Out out); void GetCheatProcessEvent(Out out_event); Result GetCheatProcessMetadata(Out out_metadata); Result ForceOpenCheatProcess(); Result GetCheatProcessMappingCount(Out out_count); Result GetCheatProcessMappings(OutBuffer mappings, Out out_count, u64 offset); Result ReadCheatProcessMemory(OutBuffer buffer, u64 address, u64 out_size); Result WriteCheatProcessMemory(InBuffer buffer, u64 address, u64 in_size); Result QueryCheatProcessMemory(Out mapping, u64 address); Result GetCheatCount(Out out_count); Result GetCheats(OutBuffer cheats, Out out_count, u64 offset); Result GetCheatById(OutBuffer cheat, u32 cheat_id); Result ToggleCheat(u32 cheat_id); Result AddCheat(InBuffer cheat, Out out_cheat_id, bool enabled); Result RemoveCheat(u32 cheat_id); Result GetFrozenAddressCount(Out out_count); Result GetFrozenAddresses(OutBuffer addresses, Out out_count, u64 offset); Result ToggleAddressFrozen(uintptr_t address); public: DEFINE_SERVICE_DISPATCH_TABLE { MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), }; };