From 37850eeee57adfb5318aff7cd19bf9ba334ab738 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Thu, 30 May 2019 19:36:18 -0400 Subject: core: Update RegisterCheatList for new VM --- src/core/core.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/core/core.cpp') diff --git a/src/core/core.cpp b/src/core/core.cpp index f22244cf7..67ec8d4b9 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -37,6 +37,7 @@ #include "core/hle/service/service.h" #include "core/hle/service/sm/sm.h" #include "core/loader/loader.h" +#include "core/memory/cheat_engine.h" #include "core/perf_stats.h" #include "core/reporter.h" #include "core/settings.h" @@ -329,7 +330,7 @@ struct System::Impl { CpuCoreManager cpu_core_manager; bool is_powered_on = false; - std::unique_ptr cheat_engine; + std::unique_ptr cheat_engine; std::unique_ptr memory_freezer; /// Frontend applets @@ -544,13 +545,6 @@ Tegra::DebugContext* System::GetGPUDebugContext() const { return impl->debug_context.get(); } -void System::RegisterCheatList(const std::vector& list, - const std::string& build_id, VAddr code_region_start, - VAddr code_region_end) { - impl->cheat_engine = std::make_unique(*this, list, build_id, - code_region_start, code_region_end); -} - void System::SetFilesystem(std::shared_ptr vfs) { impl->virtual_filesystem = std::move(vfs); } @@ -559,6 +553,13 @@ std::shared_ptr System::GetFilesystem() const { return impl->virtual_filesystem; } +void System::RegisterCheatList(const std::vector& list, + const std::array& build_id, VAddr main_region_begin, + u64 main_region_size) { + impl->cheat_engine = std::make_unique(*this, list, build_id); + impl->cheat_engine->SetMainMemoryParameters(main_region_begin, main_region_size); +} + void System::SetAppletFrontendSet(Service::AM::Applets::AppletFrontendSet&& set) { impl->applet_manager.SetAppletFrontendSet(std::move(set)); } -- cgit v1.2.3 From 3e729c13cc70af6fb8fef6e38bd5deba7a8a0d6e Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Thu, 30 May 2019 19:37:18 -0400 Subject: core: Initialize cheats after load to avoid VMManager crash This used to occur due to the VMManager being nullptr at the time cheats were registered (during load, but before it was done). This is bypassed by not accessing the VMManager for offset data until load is complete, --- src/core/core.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/core/core.cpp') diff --git a/src/core/core.cpp b/src/core/core.cpp index 67ec8d4b9..fc7039421 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -205,6 +205,11 @@ struct System::Impl { gpu_core->Start(); cpu_core_manager.StartThreads(); + // Initialize cheat engine + if (cheat_engine) { + cheat_engine->Initialize(); + } + // All threads are started, begin main process execution, now that we're in the clear. main_process->Run(load_parameters->main_thread_priority, load_parameters->main_thread_stack_size); -- cgit v1.2.3 From 682174b1123c5721b12eaf8472da46251fea3b1d Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Sat, 21 Sep 2019 18:13:10 -0400 Subject: dmnt_cheat_vm: Make Cheat VM compliant to code style --- src/core/core.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/core/core.cpp') diff --git a/src/core/core.cpp b/src/core/core.cpp index fc7039421..76bb2bae9 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -17,6 +17,7 @@ #include "core/file_sys/bis_factory.h" #include "core/file_sys/card_image.h" #include "core/file_sys/mode.h" +#include "core/file_sys/patch_manager.h" #include "core/file_sys/registered_cache.h" #include "core/file_sys/romfs_factory.h" #include "core/file_sys/savedata_factory.h" @@ -43,8 +44,6 @@ #include "core/settings.h" #include "core/telemetry_session.h" #include "core/tools/freezer.h" -#include "file_sys/cheat_engine.h" -#include "file_sys/patch_manager.h" #include "video_core/debug_utils/debug_utils.h" #include "video_core/renderer_base.h" #include "video_core/video_core.h" -- cgit v1.2.3