diff options
| author | cirakg <cirakg@cirakg.xyz> | 2026-11-03 21:58:24 +0100 |
|---|---|---|
| committer | cirakg <cirakg@cirakg.xyz> | 2026-11-03 21:58:24 +0100 |
| commit | cdfb1ae93444c0aa02dfe592af36d70ab36549fd (patch) | |
| tree | 2fa8d7062d907d5ab8d85d64c66be87ea4cdf0d1 /src/yuzu/main_window.cpp | |
| parent | 51341ec09b25de1d9b01d0c00ee828dd5b861d5c (diff) | |
| parent | 4383b9787afbf6c63291bf803c8330afb4f21a16 (diff) | |
# Conflicts:
# .github/workflows/release-binaries.yml
Diffstat (limited to 'src/yuzu/main_window.cpp')
| -rw-r--r-- | src/yuzu/main_window.cpp | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/src/yuzu/main_window.cpp b/src/yuzu/main_window.cpp index dbe5ea2334..1e37ee7e7e 100644 --- a/src/yuzu/main_window.cpp +++ b/src/yuzu/main_window.cpp @@ -2424,10 +2424,9 @@ void MainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target, } }(); - const bool has_user_save{user_save_size > 0}; - const bool has_device_save{device_save_size > 0}; - - ASSERT_MSG(has_user_save != has_device_save, "Game uses both user and device savedata?"); + // Some titles (e.g. NX2 games) report no sizes in their NACP yet still create account saves + // at runtime, so only use the device layout when it is explicitly declared. + const bool use_device_save{device_save_size > 0 && user_save_size == 0}; switch (target) { case GameListOpenTarget::SaveData: { @@ -2436,26 +2435,23 @@ void MainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target, auto vfs_save_dir = QtCommon::vfs->OpenDirectory(Common::FS::PathToUTF8String(save_dir), FileSys::OpenMode::Read); - if (has_user_save) { - // User save data + u128 save_user_id{}; + if (!use_device_save) { const auto user_id = GetProfileID(); - assert(user_id); - - const auto user_save_data_path = FileSys::SaveDataFactory::GetFullPath( - {}, vfs_save_dir, FileSys::SaveDataSpaceId::User, FileSys::SaveDataType::Account, - program_id, user_id->AsU128(), 0); + if (user_id) { + save_user_id = user_id->AsU128(); + } + } - path = Common::FS::ConcatPathSafe(save_dir, user_save_data_path); - } else { - // Device save data - const auto device_save_data_path = FileSys::SaveDataFactory::GetFullPath( - {}, vfs_save_dir, FileSys::SaveDataSpaceId::User, FileSys::SaveDataType::Account, - program_id, {}, 0); + const auto save_data_path = FileSys::SaveDataFactory::GetFullPath( + {}, vfs_save_dir, FileSys::SaveDataSpaceId::User, FileSys::SaveDataType::Account, + program_id, save_user_id, 0); - path = Common::FS::ConcatPathSafe(save_dir, device_save_data_path); - } + path = Common::FS::ConcatPathSafe(save_dir, save_data_path); - if (!Common::FS::CreateDirs(path)) { + // Only create the folder for games that are known to need it; otherwise an empty + // directory would be left behind in the wrong place. + if ((user_save_size > 0 || device_save_size > 0) && !Common::FS::CreateDirs(path)) { LOG_ERROR(Frontend, "Unable to create the directories for save data"); } |
