From a277b62fe4328dddaced9a97d324c6e5478d16a0 Mon Sep 17 00:00:00 2001 From: xbzk Date: Sun, 20 Sep 2026 04:40:14 +0200 Subject: [PATCH] [fs] revert #4319 savedata_factory changes (#4462) - [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. ------------------- This one reverts part of the PR 4319 which was aimed to allow child titles to inherit bundle settings. The fix seems good so far, but by applying it to save folders caused a trap: Now child's save folders move to bundle folder, hence saves will vanish, and the android/qt save tools are still pointing to old folders. Since the save part was only a compliance fix, instead of fiddle in master i'd rather revert this part now, then only touch this again if any bug show up. No worries. I'll be right here waiting. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4462 Reviewed-by: lizzie Reviewed-by: MaranBr --- src/core/file_sys/savedata_factory.cpp | 22 ++++++++-------------- src/core/file_sys/savedata_factory.h | 1 - 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp index 72f022cb41..c756734a43 100644 --- a/src/core/file_sys/savedata_factory.cpp +++ b/src/core/file_sys/savedata_factory.cpp @@ -9,7 +9,6 @@ #include "common/logging.h" #include "common/uuid.h" #include "core/core.h" -#include "core/file_sys/registered_cache.h" #include "core/file_sys/savedata_factory.h" #include "core/file_sys/vfs/vfs.h" @@ -62,24 +61,17 @@ SaveDataFactory::SaveDataFactory(Core::System& system_, ProgramId program_id_, SaveDataFactory::~SaveDataFactory() = default; -std::string SaveDataFactory::GetSaveDataPath(SaveDataSpaceId space, SaveDataType type, u64 title_id, u128 user_id, u64 save_id) const { - if (type == SaveDataType::Account || type == SaveDataType::Device) { - const auto requested_id = title_id != 0 ? title_id : program_id; - const auto parent_id = system.GetContentProvider().GetParentApplicationId(requested_id); - title_id = parent_id.value_or(requested_id); - } - return GetFullPath(program_id, dir, space, type, title_id, user_id, save_id); -} - VirtualDir SaveDataFactory::Create(SaveDataSpaceId space, const SaveDataAttribute& meta) const { - const auto save_directory = GetSaveDataPath(space, meta.type, meta.program_id, meta.user_id, meta.system_save_data_id); + const auto save_directory = GetFullPath(program_id, dir, space, meta.type, meta.program_id, + meta.user_id, meta.system_save_data_id); return dir->CreateDirectoryRelative(save_directory); } VirtualDir SaveDataFactory::Open(SaveDataSpaceId space, const SaveDataAttribute& meta) const { - const auto save_directory = GetSaveDataPath(space, meta.type, meta.program_id, meta.user_id, meta.system_save_data_id); + const auto save_directory = GetFullPath(program_id, dir, space, meta.type, meta.program_id, + meta.user_id, meta.system_save_data_id); auto out = dir->GetDirectoryRelative(save_directory); @@ -162,7 +154,8 @@ std::string SaveDataFactory::GetUserGameSaveDataRoot(u128 user_id, bool future) SaveDataSize SaveDataFactory::ReadSaveDataSize(SaveDataType type, u64 title_id, u128 user_id) const { - const auto path = GetSaveDataPath(SaveDataSpaceId::User, type, title_id, user_id, 0); + const auto path = + GetFullPath(program_id, dir, SaveDataSpaceId::User, type, title_id, user_id, 0); const auto relative_dir = GetOrCreateDirectoryRelative(dir, path); const auto size_file = relative_dir->GetFile(GetSaveDataSizeFileName()); @@ -180,7 +173,8 @@ SaveDataSize SaveDataFactory::ReadSaveDataSize(SaveDataType type, u64 title_id, void SaveDataFactory::WriteSaveDataSize(SaveDataType type, u64 title_id, u128 user_id, SaveDataSize new_value) const { - const auto path = GetSaveDataPath(SaveDataSpaceId::User, type, title_id, user_id, 0); + const auto path = + GetFullPath(program_id, dir, SaveDataSpaceId::User, type, title_id, user_id, 0); const auto relative_dir = GetOrCreateDirectoryRelative(dir, path); const auto size_file = relative_dir->CreateFile(GetSaveDataSizeFileName()); diff --git a/src/core/file_sys/savedata_factory.h b/src/core/file_sys/savedata_factory.h index 36c09ce2ac..c7899f023d 100644 --- a/src/core/file_sys/savedata_factory.h +++ b/src/core/file_sys/savedata_factory.h @@ -50,7 +50,6 @@ public: void SetAutoCreate(bool state); private: - std::string GetSaveDataPath(SaveDataSpaceId space, SaveDataType type, u64 title_id, u128 user_id, u64 save_id) const; Core::System& system; ProgramId program_id; VirtualDir dir;