diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/memory/cheat_engine.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/core/memory/cheat_engine.cpp b/src/core/memory/cheat_engine.cpp index ffdbacc18..8742dd164 100644 --- a/src/core/memory/cheat_engine.cpp +++ b/src/core/memory/cheat_engine.cpp @@ -39,16 +39,21 @@ StandardVmCallbacks::StandardVmCallbacks(System& system_, const CheatProcessMeta StandardVmCallbacks::~StandardVmCallbacks() = default; void StandardVmCallbacks::MemoryRead(VAddr address, void* data, u64 size) { - system.Memory().ReadBlock(SanitizeAddress(address), data, size); + system.ApplicationMemory().ReadBlock(SanitizeAddress(address), data, size); } void StandardVmCallbacks::MemoryWrite(VAddr address, const void* data, u64 size) { - system.Memory().WriteBlock(SanitizeAddress(address), data, size); + system.ApplicationMemory().WriteBlock(SanitizeAddress(address), data, size); } u64 StandardVmCallbacks::HidKeysDown() { - const auto applet_resource = - system.ServiceManager().GetService<Service::HID::Hid>("hid")->GetAppletResource(); + const auto hid = system.ServiceManager().GetService<Service::HID::Hid>("hid"); + if (hid == nullptr) { + LOG_WARNING(CheatEngine, "Attempted to read input state, but hid is not initialized!"); + return 0; + } + + const auto applet_resource = hid->GetAppletResource(); if (applet_resource == nullptr) { LOG_WARNING(CheatEngine, "Attempted to read input state, but applet resource is not initialized!"); @@ -191,22 +196,22 @@ void CheatEngine::Initialize() { }); core_timing.ScheduleLoopingEvent(CHEAT_ENGINE_NS, CHEAT_ENGINE_NS, event); - metadata.process_id = system.CurrentProcess()->GetProcessID(); - metadata.title_id = system.GetCurrentProcessProgramID(); + metadata.process_id = system.ApplicationProcess()->GetProcessId(); + metadata.title_id = system.GetApplicationProcessProgramID(); - const auto& page_table = system.CurrentProcess()->PageTable(); + const auto& page_table = system.ApplicationProcess()->PageTable(); metadata.heap_extents = { - .base = page_table.GetHeapRegionStart(), + .base = GetInteger(page_table.GetHeapRegionStart()), .size = page_table.GetHeapRegionSize(), }; metadata.address_space_extents = { - .base = page_table.GetAddressSpaceStart(), + .base = GetInteger(page_table.GetAddressSpaceStart()), .size = page_table.GetAddressSpaceSize(), }; metadata.alias_extents = { - .base = page_table.GetAliasCodeRegionStart(), + .base = GetInteger(page_table.GetAliasCodeRegionStart()), .size = page_table.GetAliasCodeRegionSize(), }; |