diff options
| -rw-r--r-- | src/common/scm_rev.cpp.in | 1 | ||||
| -rw-r--r-- | src/qt_common/game_list/worker.cpp | 3 | ||||
| -rw-r--r-- | src/yuzu/main_window.cpp | 36 |
3 files changed, 19 insertions, 21 deletions
diff --git a/src/common/scm_rev.cpp.in b/src/common/scm_rev.cpp.in index 21e58e24b5..5fe066d7d9 100644 --- a/src/common/scm_rev.cpp.in +++ b/src/common/scm_rev.cpp.in @@ -13,6 +13,7 @@ #define BUILD_DATE "@BUILD_DATE@" #define BUILD_FULLNAME "@BUILD_FULLNAME@" #define BUILD_VERSION "@BUILD_VERSION@" +#undef BUILD_ID #define BUILD_ID "@BUILD_ID@" #define TITLE_BAR_FORMAT_IDLE "@TITLE_BAR_FORMAT_IDLE@" #define TITLE_BAR_FORMAT_RUNNING "@TITLE_BAR_FORMAT_RUNNING@" diff --git a/src/qt_common/game_list/worker.cpp b/src/qt_common/game_list/worker.cpp index bd3d81dac4..329fc06990 100644 --- a/src/qt_common/game_list/worker.cpp +++ b/src/qt_common/game_list/worker.cpp @@ -18,6 +18,7 @@ #include <QSettings> #include "common/fs/fs.h" +#include "common/fs/fs_util.h" #include "common/fs/path_util.h" #include "common/settings.h" #include "core/core.h" @@ -552,7 +553,7 @@ void GameListWorker::run() { DirEntryReady(game_list_dir); if (scan) { const auto discovery = GameListDiscovery::Discover( - std::filesystem::u8path(game_dir.path), game_dir.deep_scan, + std::filesystem::path(Common::FS::ToU8String(game_dir.path)), game_dir.deep_scan, [](const auto& path) { const auto name = Common::FS::PathToUTF8String(path); return HasSupportedFileExtension(name) || IsExtractedNCAMain(name); 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"); } |
