cheats: Use global cheat engine (#7291)

* cheats: Use global cheat engine

* cheats: Prevent wasted double-load of cheat file.

* android: Fix for cheat engine updates.

---------

Co-authored-by: GPUCode <geoster3d@gmail.com>
This commit is contained in:
Steveice10
2024-01-01 12:49:08 -08:00
committed by GitHub
parent 5a7f615da1
commit 7dd9174d31
14 changed files with 120 additions and 125 deletions

View File

@ -72,7 +72,7 @@ Core::Timing& Global() {
return System::GetInstance().CoreTiming();
}
System::System() : movie{*this} {}
System::System() : movie{*this}, cheat_engine{*this} {}
System::~System() = default;
@ -320,7 +320,10 @@ System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::st
LOG_ERROR(Core, "Failed to find title id for ROM (Error {})",
static_cast<u32>(load_result));
}
cheat_engine = std::make_unique<Cheats::CheatEngine>(title_id, *this);
cheat_engine.LoadCheatFile(title_id);
cheat_engine.Connect();
perf_stats = std::make_unique<PerfStats>(title_id);
if (Settings::values.dump_textures) {
@ -502,11 +505,11 @@ const Memory::MemorySystem& System::Memory() const {
}
Cheats::CheatEngine& System::CheatEngine() {
return *cheat_engine;
return cheat_engine;
}
const Cheats::CheatEngine& System::CheatEngine() const {
return *cheat_engine;
return cheat_engine;
}
void System::RegisterVideoDumper(std::shared_ptr<VideoDumper::Backend> dumper) {
@ -560,7 +563,6 @@ void System::Shutdown(bool is_deserializing) {
if (!is_deserializing) {
GDBStub::Shutdown();
perf_stats.reset();
cheat_engine.reset();
app_loader.reset();
}
custom_tex_manager.reset();
@ -718,7 +720,7 @@ void System::serialize(Archive& ar, const unsigned int file_version) {
if (Archive::is_loading::value) {
timing->UnlockEventQueue();
memory->SetDSP(*dsp_core);
cheat_engine->Connect();
cheat_engine.Connect();
gpu->Sync();
// Re-register gpu callback, because gsp service changed after service_manager got