diff options
author | Morph <39850852+Morph1984@users.noreply.github.com> | 2020-07-20 05:52:06 +0200 |
---|---|---|
committer | Morph <39850852+Morph1984@users.noreply.github.com> | 2020-08-05 03:14:20 +0200 |
commit | cf946312ca5aad399e39492bbb130bb1ff322cd1 (patch) | |
tree | 60527e682845ac86c746fb86a79a2e7e90ff6427 | |
parent | main: Fix Open Save/Mod Locations for installed titles (diff) | |
download | yuzu-cf946312ca5aad399e39492bbb130bb1ff322cd1.tar yuzu-cf946312ca5aad399e39492bbb130bb1ff322cd1.tar.gz yuzu-cf946312ca5aad399e39492bbb130bb1ff322cd1.tar.bz2 yuzu-cf946312ca5aad399e39492bbb130bb1ff322cd1.tar.lz yuzu-cf946312ca5aad399e39492bbb130bb1ff322cd1.tar.xz yuzu-cf946312ca5aad399e39492bbb130bb1ff322cd1.tar.zst yuzu-cf946312ca5aad399e39492bbb130bb1ff322cd1.zip |
-rw-r--r-- | src/yuzu/main.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f711a337f..e2b6462bb 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1244,13 +1244,24 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target std::string path; QString open_target; - FileSys::PatchManager pm{program_id}; - const auto control = pm.GetControlMetadata(); - const auto v_file = Core::GetGameFileFromPath(vfs, game_path); - const auto loader = Loader::GetLoader(v_file); + const auto [user_save_size, device_save_size] = [this, &program_id, &game_path] { + FileSys::PatchManager pm{program_id}; + const auto control = pm.GetControlMetadata().first; + if (control != nullptr) { + return std::make_pair(control->GetDefaultNormalSaveSize(), + control->GetDeviceSaveDataSize()); + } else { + const auto file = Core::GetGameFileFromPath(vfs, game_path); + const auto loader = Loader::GetLoader(file); + + FileSys::NACP nacp{}; + loader->ReadControlData(nacp); + return std::make_pair(nacp.GetDefaultNormalSaveSize(), nacp.GetDeviceSaveDataSize()); + } + }(); - const bool has_user_save{control.first->GetDefaultNormalSaveSize() > 0}; - const bool has_device_save{control.first->GetDeviceSaveDataSize() > 0}; + 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?"); |