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/file_sys/registered_cache.cpp | 35 +++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'src/core/file_sys/registered_cache.cpp') diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index 9e9db0ed4d..83f5e265dd 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp @@ -567,20 +567,45 @@ VirtualFile RegisteredCache::GetFileAtID(NcaID id) const { } static std::optional CheckMapForContentRecord(const ankerl::unordered_dense::map& map, u64 title_id, ContentRecordType type) { - const auto cmnt_iter = map.find(title_id); + auto cmnt_iter = map.find(title_id); + u8 id_offset = 0; + if (cmnt_iter == map.cend()) { - return std::nullopt; + const auto program_index = title_id & AOC_TITLE_ID_MASK; + if (program_index == 0) { + return std::nullopt; + } + + cmnt_iter = map.find(title_id & ~AOC_TITLE_ID_MASK); + if (cmnt_iter == map.cend()) { + return std::nullopt; + } + + id_offset = static_cast(program_index); } const auto& cnmt = cmnt_iter->second; const auto& content_records = cnmt.GetContentRecords(); const auto iter = std::find_if(content_records.cbegin(), content_records.cend(), - [type](const ContentRecord& rec) { return rec.type == type; }); - if (iter == content_records.cend()) { + [type, id_offset](const ContentRecord& rec) { + return rec.type == type && rec.id_offset == id_offset; + }); + if (iter != content_records.cend()) { + return std::make_optional(iter->nca_id); + } + + if (id_offset != 0) { + return std::nullopt; + } + + const auto fallback_iter = + std::find_if(content_records.cbegin(), content_records.cend(), + [type](const ContentRecord& rec) { return rec.type == type; }); + if (fallback_iter == content_records.cend()) { return std::nullopt; } - return std::make_optional(iter->nca_id); + return std::make_optional(fallback_iter->nca_id); } std::optional RegisteredCache::GetNcaIDFromMetadata(u64 title_id, -- cgit v1.2.3