aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu/main_window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu/main_window.cpp')
-rw-r--r--src/yuzu/main_window.cpp36
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");
}