diff options
| author | 2020-07-19 23:52:06 -0400 | |
|---|---|---|
| committer | 2020-08-04 21:14:20 -0400 | |
| commit | cf946312ca5aad399e39492bbb130bb1ff322cd1 (patch) | |
| tree | 60527e682845ac86c746fb86a79a2e7e90ff6427 | |
| parent | main: Fix Open Save/Mod Locations for installed titles (diff) | |
| download | yuzu-cf946312ca5aad399e39492bbb130bb1ff322cd1.tar.gz yuzu-cf946312ca5aad399e39492bbb130bb1ff322cd1.tar.xz yuzu-cf946312ca5aad399e39492bbb130bb1ff322cd1.zip | |
main: Fallback to loader if no control nca is found with patch manager
In some rare instances, the patch manager is not able to find a control nca, fallback to the previous method of parsing a control nca through the loader if this occurs.
Diffstat (limited to '')
| -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 | |||
| 1244 | std::string path; | 1244 | std::string path; |
| 1245 | QString open_target; | 1245 | QString open_target; |
| 1246 | 1246 | ||
| 1247 | FileSys::PatchManager pm{program_id}; | 1247 | const auto [user_save_size, device_save_size] = [this, &program_id, &game_path] { |
| 1248 | const auto control = pm.GetControlMetadata(); | 1248 | FileSys::PatchManager pm{program_id}; |
| 1249 | const auto v_file = Core::GetGameFileFromPath(vfs, game_path); | 1249 | const auto control = pm.GetControlMetadata().first; |
| 1250 | const auto loader = Loader::GetLoader(v_file); | 1250 | if (control != nullptr) { |
| 1251 | return std::make_pair(control->GetDefaultNormalSaveSize(), | ||
| 1252 | control->GetDeviceSaveDataSize()); | ||
| 1253 | } else { | ||
| 1254 | const auto file = Core::GetGameFileFromPath(vfs, game_path); | ||
| 1255 | const auto loader = Loader::GetLoader(file); | ||
| 1256 | |||
| 1257 | FileSys::NACP nacp{}; | ||
| 1258 | loader->ReadControlData(nacp); | ||
| 1259 | return std::make_pair(nacp.GetDefaultNormalSaveSize(), nacp.GetDeviceSaveDataSize()); | ||
| 1260 | } | ||
| 1261 | }(); | ||
| 1251 | 1262 | ||
| 1252 | const bool has_user_save{control.first->GetDefaultNormalSaveSize() > 0}; | 1263 | const bool has_user_save{user_save_size > 0}; |
| 1253 | const bool has_device_save{control.first->GetDeviceSaveDataSize() > 0}; | 1264 | const bool has_device_save{device_save_size > 0}; |
| 1254 | 1265 | ||
| 1255 | ASSERT_MSG(has_user_save != has_device_save, "Game uses both user and device savedata?"); | 1266 | ASSERT_MSG(has_user_save != has_device_save, "Game uses both user and device savedata?"); |
| 1256 | 1267 | ||