diff options
author | german77 <juangerman-13@hotmail.com> | 2024-02-05 21:19:26 +0100 |
---|---|---|
committer | german77 <juangerman-13@hotmail.com> | 2024-02-05 21:38:26 +0100 |
commit | c52d7cc694047eea48714e8046bb150592d67e56 (patch) | |
tree | c0ba889dba8bf0b3ba73098d1c4a31c6857a8902 | |
parent | Merge pull request #12905 from liamwhite/hwc-release (diff) | |
download | yuzu-c52d7cc694047eea48714e8046bb150592d67e56.tar yuzu-c52d7cc694047eea48714e8046bb150592d67e56.tar.gz yuzu-c52d7cc694047eea48714e8046bb150592d67e56.tar.bz2 yuzu-c52d7cc694047eea48714e8046bb150592d67e56.tar.lz yuzu-c52d7cc694047eea48714e8046bb150592d67e56.tar.xz yuzu-c52d7cc694047eea48714e8046bb150592d67e56.tar.zst yuzu-c52d7cc694047eea48714e8046bb150592d67e56.zip |
-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 @@ #include "core/hle/kernel/k_page_table.h" #include "core/hle/kernel/k_process.h" #include "core/hle/kernel/k_process_page_table.h" +#include "core/hle/kernel/svc_types.h" #include "core/hle/service/hid/hid_server.h" #include "core/hle/service/sm/sm.h" #include "core/memory.h" @@ -84,6 +85,20 @@ u64 StandardVmCallbacks::HidKeysDown() { return static_cast<u64>(press_state & HID::NpadButton::All); } +void StandardVmCallbacks::PauseProcess() { + if (system.ApplicationProcess()->IsSuspended()) { + return; + } + system.ApplicationProcess()->SetActivity(Kernel::Svc::ProcessActivity::Paused); +} + +void StandardVmCallbacks::ResumeProcess() { + if (!system.ApplicationProcess()->IsSuspended()) { + return; + } + system.ApplicationProcess()->SetActivity(Kernel::Svc::ProcessActivity::Runnable); +} + void StandardVmCallbacks::DebugLog(u8 id, u64 value) { LOG_INFO(CheatEngine, "Cheat triggered DebugLog: ID '{:01X}' Value '{:016X}'", id, value); } 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: void MemoryReadUnsafe(VAddr address, void* data, u64 size) override; void MemoryWriteUnsafe(VAddr address, const void* data, u64 size) override; u64 HidKeysDown() override; + void PauseProcess() override; + void ResumeProcess() override; void DebugLog(u8 id, u64 value) override; void CommandLog(std::string_view data) override; 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) { static_registers[rw_static_reg->static_idx] = registers[rw_static_reg->idx]; } } else if (std::holds_alternative<PauseProcessOpcode>(cur_opcode.opcode)) { - // TODO: Pause cheat process + callbacks->PauseProcess(); } else if (std::holds_alternative<ResumeProcessOpcode>(cur_opcode.opcode)) { - // TODO: Resume cheat process + callbacks->ResumeProcess(); } else if (auto debug_log = std::get_if<DebugLogOpcode>(&cur_opcode.opcode)) { // Read value from memory. 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: virtual u64 HidKeysDown() = 0; + virtual void PauseProcess() = 0; + virtual void ResumeProcess() = 0; + virtual void DebugLog(u8 id, u64 value) = 0; virtual void CommandLog(std::string_view data) = 0; }; |