From 54cd5fb8ebf11b71c676b72a32811873caef20de Mon Sep 17 00:00:00 2001 From: Maufeat Date: Sat, 29 Aug 2026 01:04:02 +0200 Subject: [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 Reviewed-by: CamilleLaVey Reviewed-by: MaranBr --- src/core/hle/kernel/kernel.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'src/core/hle/kernel/kernel.cpp') diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index d25ac37df4..a739e7020c 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -349,9 +349,18 @@ struct KernelCore::Impl { object_name_global_data.emplace(kernel); } - void MakeApplicationProcess(KernelCore& kernel, KProcess* process) { + void SetApplicationProcess(KernelCore& kernel, KProcess* process) { + if (application_process == process) + return; + + KProcess* const previous = application_process; application_process = process; - application_process->Open(kernel); + + if (application_process != nullptr) + application_process->Open(kernel); + + if (previous != nullptr) + previous->Close(kernel); } /// Sets the host thread ID for the caller. @@ -879,8 +888,8 @@ void KernelCore::RemoveProcess(KProcess* process) { } } -void KernelCore::MakeApplicationProcess(KProcess* process) { - impl->MakeApplicationProcess(*this, process); +void KernelCore::SetApplicationProcess(KProcess* process) { + impl->SetApplicationProcess(*this, process); } KProcess* KernelCore::ApplicationProcess() { @@ -891,6 +900,14 @@ const KProcess* KernelCore::ApplicationProcess() const { return impl->application_process; } +KScopedAutoObject KernelCore::GetProcessByProcessId(u64 process_id) { + std::scoped_lock lk{impl->process_list_lock}; + for (auto* const process : impl->process_list) + if (process != nullptr && process->GetProcessId() == process_id) + return {*this, process}; + return {*this, nullptr}; +} + std::list> KernelCore::GetProcessList() { std::list> processes; std::scoped_lock lk{impl->process_list_lock}; -- cgit v1.2.3