From ac37de10fc63a93838be270ec09e0e4c6df460ce Mon Sep 17 00:00:00 2001 From: Hamish Milne Date: Mon, 6 Apr 2020 20:26:41 +0100 Subject: [PATCH] Reconnect cheat_engine during load --- src/core/cheats/cheats.cpp | 4 ++++ src/core/cheats/cheats.h | 1 + src/core/savestate.cpp | 1 + 3 files changed, 6 insertions(+) diff --git a/src/core/cheats/cheats.cpp b/src/core/cheats/cheats.cpp index 8b4a30ca63..9053b5ca68 100644 --- a/src/core/cheats/cheats.cpp +++ b/src/core/cheats/cheats.cpp @@ -18,6 +18,10 @@ constexpr u64 run_interval_ticks = BASE_CLOCK_RATE_ARM11 / 60; CheatEngine::CheatEngine(Core::System& system_) : system(system_) { LoadCheatFile(); + Connect(); +} + +void CheatEngine::Connect() { event = system.CoreTiming().RegisterEvent( "CheatCore::run_event", [this](u64 thread_id, s64 cycle_late) { RunCallback(thread_id, cycle_late); }); diff --git a/src/core/cheats/cheats.h b/src/core/cheats/cheats.h index a8d3730383..1dfed7ab81 100644 --- a/src/core/cheats/cheats.h +++ b/src/core/cheats/cheats.h @@ -26,6 +26,7 @@ class CheatEngine { public: explicit CheatEngine(Core::System& system); ~CheatEngine(); + void Connect(); std::vector> GetCheats() const; void AddCheat(const std::shared_ptr& cheat); void RemoveCheat(int index); diff --git a/src/core/savestate.cpp b/src/core/savestate.cpp index ae5ba11a81..6a87569c79 100644 --- a/src/core/savestate.cpp +++ b/src/core/savestate.cpp @@ -167,6 +167,7 @@ void System::LoadState(u32 slot) { auto system_mode = this->app_loader->LoadKernelSystemMode(); auto n3ds_mode = this->app_loader->LoadKernelN3dsMode(); Init(*m_emu_window, *system_mode.first, *n3ds_mode.first); + cheat_engine->Connect(); try {