From 3c38afad74c751a949de0bcca9a51cfc11797f68 Mon Sep 17 00:00:00 2001 From: xbzk Date: Fri, 18 Sep 2026 23:48:35 +0200 Subject: [fs] share parent resources with bundled programs (#4319) - [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. ------------------- Normal games are Applications; Bundled games are Application + Programs; We've been treating both as the same thing, calling both programs, and making programs unable to see settings and saves from application. References: https://switchbrew.org/wiki/Filesystem_services https://switchbrew.org/wiki/NCM_services#ApplicationId https://switchbrew.org/wiki/Super_Mario_3D_All-Stars Ryujinx.HLE/HOS/ApplicationLoader.cs:GetMultiProgramInfo UPDATE: The first version was a big rework to make AppId/ProgId concepts proper, and it was successful in most tests, but it caused a regression with applets, which are programs that breed straight from no application. In order to simplify things i've reverted all the rework, added a helper to identify whether a program has a parent Application and bounded it to it's proper stores. Although this is no big deal coz it doesn't have impact on emulation, it permeates to several routines, so it needs to be tested broadly. Applets, Normal games, Bundled games, Blobbed NSPs/XCIs, Mods, Updates, Saves, DLCs,. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4319 Reviewed-by: MaranBr Reviewed-by: lizzie --- src/core/file_sys/registered_cache.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (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 ce851e4d38..1f430434f7 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp @@ -5,6 +5,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include +#include #include #include #include @@ -348,6 +349,22 @@ std::vector ContentProvider::ListEntries() const { return ListEntriesFilter(std::nullopt, std::nullopt, std::nullopt); } +std::optional ContentProvider::GetParentApplicationId(u64 program_id) const { + const auto application_id = GetBaseTitleID(program_id); + const auto program_index = program_id - application_id; + if (program_index == 0 || program_index > std::numeric_limits::max()) { + return std::nullopt; + } + if (!ListEntriesFilter(TitleType::Application, ContentRecordType::Meta, program_id).empty()) { + return std::nullopt; + } + if ((!ListEntriesFilter(TitleType::Application, ContentRecordType::Meta, application_id).empty() && HasEntry(program_id, ContentRecordType::Program)) + || (!ListEntriesFilter(TitleType::Update, ContentRecordType::Meta, GetUpdateTitleID(application_id)).empty() && HasEntry(GetUpdateTitleID(program_id), ContentRecordType::Program))) { + return application_id; + } + return std::nullopt; +} + PlaceholderCache::PlaceholderCache(VirtualDir dir_) : dir(std::move(dir_)) {} bool PlaceholderCache::Create(const NcaID& id, u64 size) const { -- cgit v1.2.3