Reconnect cheat_engine during load

This commit is contained in:
Hamish Milne 2020-04-06 20:26:41 +01:00
parent b5f394dd12
commit ac37de10fc
3 changed files with 6 additions and 0 deletions

View file

@ -18,6 +18,10 @@ constexpr u64 run_interval_ticks = BASE_CLOCK_RATE_ARM11 / 60;
CheatEngine::CheatEngine(Core::System& system_) : system(system_) { CheatEngine::CheatEngine(Core::System& system_) : system(system_) {
LoadCheatFile(); LoadCheatFile();
Connect();
}
void CheatEngine::Connect() {
event = system.CoreTiming().RegisterEvent( event = system.CoreTiming().RegisterEvent(
"CheatCore::run_event", "CheatCore::run_event",
[this](u64 thread_id, s64 cycle_late) { RunCallback(thread_id, cycle_late); }); [this](u64 thread_id, s64 cycle_late) { RunCallback(thread_id, cycle_late); });

View file

@ -26,6 +26,7 @@ class CheatEngine {
public: public:
explicit CheatEngine(Core::System& system); explicit CheatEngine(Core::System& system);
~CheatEngine(); ~CheatEngine();
void Connect();
std::vector<std::shared_ptr<CheatBase>> GetCheats() const; std::vector<std::shared_ptr<CheatBase>> GetCheats() const;
void AddCheat(const std::shared_ptr<CheatBase>& cheat); void AddCheat(const std::shared_ptr<CheatBase>& cheat);
void RemoveCheat(int index); void RemoveCheat(int index);

View file

@ -167,6 +167,7 @@ void System::LoadState(u32 slot) {
auto system_mode = this->app_loader->LoadKernelSystemMode(); auto system_mode = this->app_loader->LoadKernelSystemMode();
auto n3ds_mode = this->app_loader->LoadKernelN3dsMode(); auto n3ds_mode = this->app_loader->LoadKernelN3dsMode();
Init(*m_emu_window, *system_mode.first, *n3ds_mode.first); Init(*m_emu_window, *system_mode.first, *n3ds_mode.first);
cheat_engine->Connect();
try { try {