aboutsummaryrefslogtreecommitdiff
path: root/src/core/memory
diff options
context:
space:
mode:
authorMaufeat <sahyno1996@gmail.com>2026-08-29 01:04:02 +0200
committercrueter <crueter@eden-emu.dev>2026-08-29 01:04:02 +0200
commit54cd5fb8ebf11b71c676b72a32811873caef20de (patch)
tree20fef6adb49da98d3d87ae152853229bf762a3bb /src/core/memory
parent119291dc77fbe8e4a23eaafa8420c1c8577d1b59 (diff)
[core, hle, video_core, memory] Improve multi-process, display layers, dynamic shader cache and rework overlay (#4238)
- [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- - Dynamic shader cache reloading capability for qlaunch - Multi-process improvements (thanks to @frank1734), instead of just using the main application we now respect caller process (also did it for HID devices while I was at it) - Layer stack masks & shared buffer screenshot for video core, added different masks (screenshot, recording, etc.) this was discovered as an issue due to how in qlaunch the transition was not right between applications. May not be perfect but also fixes screenshots while using qlaunch - Reworked overlay display management (input and visibility) - instead of random numbers as I've previously did, I decided to add an AppletZIndex enum for better readability. Also split capability of input by touch and gamepad. - etc. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4238 Reviewed-by: Samuel <lizzie@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Diffstat (limited to 'src/core/memory')
-rw-r--r--src/core/memory/cheat_engine.cpp37
-rw-r--r--src/core/memory/cheat_engine.h11
2 files changed, 39 insertions, 9 deletions
diff --git a/src/core/memory/cheat_engine.cpp b/src/core/memory/cheat_engine.cpp
index 8e23a54a0d..e14147f5c9 100644
--- a/src/core/memory/cheat_engine.cpp
+++ b/src/core/memory/cheat_engine.cpp
@@ -51,24 +51,41 @@ StandardVmCallbacks::StandardVmCallbacks(System& system_, const CheatProcessMeta
StandardVmCallbacks::~StandardVmCallbacks() = default;
+Kernel::KProcess* StandardVmCallbacks::GetProcess() const {
+ if (cached_process != nullptr && cached_process_id == metadata.process_id) {
+ return cached_process;
+ }
+
+ auto process = system.Kernel().GetProcessByProcessId(metadata.process_id);
+ cached_process = process.IsNull() ? nullptr : process.GetPointerUnsafe();
+ cached_process_id = metadata.process_id;
+ return cached_process;
+}
+
void StandardVmCallbacks::MemoryReadUnsafe(VAddr address, void* data, u64 size) {
+ auto* const process = this->GetProcess();
+
// Return zero on invalid address
- if (!IsAddressInRange(address) || !system.ApplicationMemory().IsValidVirtualAddress(address)) {
+ if (process == nullptr || !IsAddressInRange(address) ||
+ !process->GetMemory().IsValidVirtualAddress(address)) {
std::memset(data, 0, size);
return;
}
- system.ApplicationMemory().ReadBlock(address, data, size);
+ process->GetMemory().ReadBlock(address, data, size);
}
void StandardVmCallbacks::MemoryWriteUnsafe(VAddr address, const void* data, u64 size) {
+ auto* const process = this->GetProcess();
+
// Skip invalid memory write address
- if (!IsAddressInRange(address) || !system.ApplicationMemory().IsValidVirtualAddress(address)) {
+ if (process == nullptr || !IsAddressInRange(address) ||
+ !process->GetMemory().IsValidVirtualAddress(address)) {
return;
}
- if (system.ApplicationMemory().WriteBlock(address, data, size)) {
- Core::InvalidateInstructionCacheRange(system.ApplicationProcess(), address, size);
+ if (process->GetMemory().WriteBlock(address, data, size)) {
+ Core::InvalidateInstructionCacheRange(process, address, size);
}
}
@@ -91,14 +108,16 @@ u64 StandardVmCallbacks::HidKeysDown() {
}
void StandardVmCallbacks::PauseProcess() {
- if (!system.ApplicationProcess()->IsSuspended()) {
- system.ApplicationProcess()->SetActivity(system.Kernel(), Kernel::Svc::ProcessActivity::Paused);
+ auto* const process = this->GetProcess();
+ if (process != nullptr && !process->IsSuspended()) {
+ process->SetActivity(system.Kernel(), Kernel::Svc::ProcessActivity::Paused);
}
}
void StandardVmCallbacks::ResumeProcess() {
- if (system.ApplicationProcess()->IsSuspended()) {
- system.ApplicationProcess()->SetActivity(system.Kernel(), Kernel::Svc::ProcessActivity::Runnable);
+ auto* const process = this->GetProcess();
+ if (process != nullptr && process->IsSuspended()) {
+ process->SetActivity(system.Kernel(), Kernel::Svc::ProcessActivity::Runnable);
}
}
diff --git a/src/core/memory/cheat_engine.h b/src/core/memory/cheat_engine.h
index f52f2be7c3..abd3abc93f 100644
--- a/src/core/memory/cheat_engine.h
+++ b/src/core/memory/cheat_engine.h
@@ -1,3 +1,6 @@
+// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
+// SPDX-License-Identifier: GPL-3.0-or-later
+
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -15,6 +18,10 @@ namespace Core {
class System;
}
+namespace Kernel {
+class KProcess;
+}
+
namespace Core::Timing {
class CoreTiming;
struct EventType;
@@ -38,8 +45,12 @@ public:
private:
bool IsAddressInRange(VAddr address) const;
+ Kernel::KProcess* GetProcess() const;
+
const CheatProcessMetadata& metadata;
Core::System& system;
+ mutable Kernel::KProcess* cached_process{};
+ mutable u64 cached_process_id{};
};
// Intermediary class that parses a text file or other disk format for storing cheats into a