diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/memory/cheat_engine.cpp | 15 | ||||
| -rw-r--r-- | src/core/memory/cheat_engine.h | 2 | ||||
| -rw-r--r-- | src/core/memory/dmnt_cheat_vm.cpp | 4 | ||||
| -rw-r--r-- | src/core/memory/dmnt_cheat_vm.h | 3 |
4 files changed, 22 insertions, 2 deletions
diff --git a/src/core/memory/cheat_engine.cpp b/src/core/memory/cheat_engine.cpp index 14d1a3840..f3b8243d5 100644 --- a/src/core/memory/cheat_engine.cpp +++ b/src/core/memory/cheat_engine.cpp | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include "core/hle/kernel/k_page_table.h" | 10 | #include "core/hle/kernel/k_page_table.h" |
| 11 | #include "core/hle/kernel/k_process.h" | 11 | #include "core/hle/kernel/k_process.h" |
| 12 | #include "core/hle/kernel/k_process_page_table.h" | 12 | #include "core/hle/kernel/k_process_page_table.h" |
| 13 | #include "core/hle/kernel/svc_types.h" | ||
| 13 | #include "core/hle/service/hid/hid_server.h" | 14 | #include "core/hle/service/hid/hid_server.h" |
| 14 | #include "core/hle/service/sm/sm.h" | 15 | #include "core/hle/service/sm/sm.h" |
| 15 | #include "core/memory.h" | 16 | #include "core/memory.h" |
| @@ -84,6 +85,20 @@ u64 StandardVmCallbacks::HidKeysDown() { | |||
| 84 | return static_cast<u64>(press_state & HID::NpadButton::All); | 85 | return static_cast<u64>(press_state & HID::NpadButton::All); |
| 85 | } | 86 | } |
| 86 | 87 | ||
| 88 | void StandardVmCallbacks::PauseProcess() { | ||
| 89 | if (system.ApplicationProcess()->IsSuspended()) { | ||
| 90 | return; | ||
| 91 | } | ||
| 92 | system.ApplicationProcess()->SetActivity(Kernel::Svc::ProcessActivity::Paused); | ||
| 93 | } | ||
| 94 | |||
| 95 | void StandardVmCallbacks::ResumeProcess() { | ||
| 96 | if (!system.ApplicationProcess()->IsSuspended()) { | ||
| 97 | return; | ||
| 98 | } | ||
| 99 | system.ApplicationProcess()->SetActivity(Kernel::Svc::ProcessActivity::Runnable); | ||
| 100 | } | ||
| 101 | |||
| 87 | void StandardVmCallbacks::DebugLog(u8 id, u64 value) { | 102 | void StandardVmCallbacks::DebugLog(u8 id, u64 value) { |
| 88 | LOG_INFO(CheatEngine, "Cheat triggered DebugLog: ID '{:01X}' Value '{:016X}'", id, value); | 103 | LOG_INFO(CheatEngine, "Cheat triggered DebugLog: ID '{:01X}' Value '{:016X}'", id, value); |
| 89 | } | 104 | } |
diff --git a/src/core/memory/cheat_engine.h b/src/core/memory/cheat_engine.h index 619cabaa2..f52f2be7c 100644 --- a/src/core/memory/cheat_engine.h +++ b/src/core/memory/cheat_engine.h | |||
| @@ -30,6 +30,8 @@ public: | |||
| 30 | void MemoryReadUnsafe(VAddr address, void* data, u64 size) override; | 30 | void MemoryReadUnsafe(VAddr address, void* data, u64 size) override; |
| 31 | void MemoryWriteUnsafe(VAddr address, const void* data, u64 size) override; | 31 | void MemoryWriteUnsafe(VAddr address, const void* data, u64 size) override; |
| 32 | u64 HidKeysDown() override; | 32 | u64 HidKeysDown() override; |
| 33 | void PauseProcess() override; | ||
| 34 | void ResumeProcess() override; | ||
| 33 | void DebugLog(u8 id, u64 value) override; | 35 | void DebugLog(u8 id, u64 value) override; |
| 34 | void CommandLog(std::string_view data) override; | 36 | void CommandLog(std::string_view data) override; |
| 35 | 37 | ||
diff --git a/src/core/memory/dmnt_cheat_vm.cpp b/src/core/memory/dmnt_cheat_vm.cpp index 8bc81e72d..f7097d01d 100644 --- a/src/core/memory/dmnt_cheat_vm.cpp +++ b/src/core/memory/dmnt_cheat_vm.cpp | |||
| @@ -1205,9 +1205,9 @@ void DmntCheatVm::Execute(const CheatProcessMetadata& metadata) { | |||
| 1205 | static_registers[rw_static_reg->static_idx] = registers[rw_static_reg->idx]; | 1205 | static_registers[rw_static_reg->static_idx] = registers[rw_static_reg->idx]; |
| 1206 | } | 1206 | } |
| 1207 | } else if (std::holds_alternative<PauseProcessOpcode>(cur_opcode.opcode)) { | 1207 | } else if (std::holds_alternative<PauseProcessOpcode>(cur_opcode.opcode)) { |
| 1208 | // TODO: Pause cheat process | 1208 | callbacks->PauseProcess(); |
| 1209 | } else if (std::holds_alternative<ResumeProcessOpcode>(cur_opcode.opcode)) { | 1209 | } else if (std::holds_alternative<ResumeProcessOpcode>(cur_opcode.opcode)) { |
| 1210 | // TODO: Resume cheat process | 1210 | callbacks->ResumeProcess(); |
| 1211 | } else if (auto debug_log = std::get_if<DebugLogOpcode>(&cur_opcode.opcode)) { | 1211 | } else if (auto debug_log = std::get_if<DebugLogOpcode>(&cur_opcode.opcode)) { |
| 1212 | // Read value from memory. | 1212 | // Read value from memory. |
| 1213 | u64 log_value = 0; | 1213 | u64 log_value = 0; |
diff --git a/src/core/memory/dmnt_cheat_vm.h b/src/core/memory/dmnt_cheat_vm.h index fed6a24ad..1c1ed1259 100644 --- a/src/core/memory/dmnt_cheat_vm.h +++ b/src/core/memory/dmnt_cheat_vm.h | |||
| @@ -271,6 +271,9 @@ public: | |||
| 271 | 271 | ||
| 272 | virtual u64 HidKeysDown() = 0; | 272 | virtual u64 HidKeysDown() = 0; |
| 273 | 273 | ||
| 274 | virtual void PauseProcess() = 0; | ||
| 275 | virtual void ResumeProcess() = 0; | ||
| 276 | |||
| 274 | virtual void DebugLog(u8 id, u64 value) = 0; | 277 | virtual void DebugLog(u8 id, u64 value) = 0; |
| 275 | virtual void CommandLog(std::string_view data) = 0; | 278 | virtual void CommandLog(std::string_view data) = 0; |
| 276 | }; | 279 | }; |