diff options
| author | 2020-08-18 12:54:06 -0400 | |
|---|---|---|
| committer | 2020-08-18 12:54:06 -0400 | |
| commit | bea9ed2548abfa738d3381a152e7ece42efbf08d (patch) | |
| tree | 7a934ffbf397504432434a20a9ff595cf0ecfdd6 /src | |
| parent | Merge pull request #4532 from lioncash/object-name (diff) | |
| parent | main: Fallback to loader if no control nca is found with patch manager (diff) | |
| download | yuzu-bea9ed2548abfa738d3381a152e7ece42efbf08d.tar.gz yuzu-bea9ed2548abfa738d3381a152e7ece42efbf08d.tar.xz yuzu-bea9ed2548abfa738d3381a152e7ece42efbf08d.zip | |
Merge pull request #4381 from Morph1984/fix-open-folder-installed-title
main: Fix Open Save/Mod Locations for installed titles
Diffstat (limited to '')
| -rw-r--r-- | src/yuzu/game_list.cpp | 4 | ||||
| -rw-r--r-- | src/yuzu/game_list.h | 3 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 27 | ||||
| -rw-r--r-- | src/yuzu/main.h | 3 |
4 files changed, 24 insertions, 13 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 967ef4a21..6a71d9644 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -502,10 +502,10 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, std::string pat | |||
| 502 | navigate_to_gamedb_entry->setVisible(it != compatibility_list.end() && program_id != 0); | 502 | navigate_to_gamedb_entry->setVisible(it != compatibility_list.end() && program_id != 0); |
| 503 | 503 | ||
| 504 | connect(open_save_location, &QAction::triggered, [this, program_id, path]() { | 504 | connect(open_save_location, &QAction::triggered, [this, program_id, path]() { |
| 505 | emit OpenFolderRequested(GameListOpenTarget::SaveData, path); | 505 | emit OpenFolderRequested(program_id, GameListOpenTarget::SaveData, path); |
| 506 | }); | 506 | }); |
| 507 | connect(open_mod_location, &QAction::triggered, [this, program_id, path]() { | 507 | connect(open_mod_location, &QAction::triggered, [this, program_id, path]() { |
| 508 | emit OpenFolderRequested(GameListOpenTarget::ModData, path); | 508 | emit OpenFolderRequested(program_id, GameListOpenTarget::ModData, path); |
| 509 | }); | 509 | }); |
| 510 | connect(open_transferable_shader_cache, &QAction::triggered, | 510 | connect(open_transferable_shader_cache, &QAction::triggered, |
| 511 | [this, program_id]() { emit OpenTransferableShaderCacheRequested(program_id); }); | 511 | [this, program_id]() { emit OpenTransferableShaderCacheRequested(program_id); }); |
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h index 483835cce..78e2ba169 100644 --- a/src/yuzu/game_list.h +++ b/src/yuzu/game_list.h | |||
| @@ -84,7 +84,8 @@ public: | |||
| 84 | signals: | 84 | signals: |
| 85 | void GameChosen(QString game_path); | 85 | void GameChosen(QString game_path); |
| 86 | void ShouldCancelWorker(); | 86 | void ShouldCancelWorker(); |
| 87 | void OpenFolderRequested(GameListOpenTarget target, const std::string& game_path); | 87 | void OpenFolderRequested(u64 program_id, GameListOpenTarget target, |
| 88 | const std::string& game_path); | ||
| 88 | void OpenTransferableShaderCacheRequested(u64 program_id); | 89 | void OpenTransferableShaderCacheRequested(u64 program_id); |
| 89 | void RemoveInstalledEntryRequested(u64 program_id, InstalledEntryType type); | 90 | void RemoveInstalledEntryRequested(u64 program_id, InstalledEntryType type); |
| 90 | void RemoveFileRequested(u64 program_id, GameListRemoveTarget target); | 91 | void RemoveFileRequested(u64 program_id, GameListRemoveTarget target); |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 9d1e67a3a..c6b7e2c00 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -1242,20 +1242,29 @@ void GMainWindow::OnGameListLoadFile(QString game_path) { | |||
| 1242 | BootGame(game_path); | 1242 | BootGame(game_path); |
| 1243 | } | 1243 | } |
| 1244 | 1244 | ||
| 1245 | void GMainWindow::OnGameListOpenFolder(GameListOpenTarget target, const std::string& game_path) { | 1245 | void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target, |
| 1246 | const std::string& game_path) { | ||
| 1246 | std::string path; | 1247 | std::string path; |
| 1247 | QString open_target; | 1248 | QString open_target; |
| 1248 | 1249 | ||
| 1249 | const auto v_file = Core::GetGameFileFromPath(vfs, game_path); | 1250 | const auto [user_save_size, device_save_size] = [this, &program_id, &game_path] { |
| 1250 | const auto loader = Loader::GetLoader(v_file); | 1251 | FileSys::PatchManager pm{program_id}; |
| 1251 | FileSys::NACP control{}; | 1252 | const auto control = pm.GetControlMetadata().first; |
| 1252 | u64 program_id{}; | 1253 | if (control != nullptr) { |
| 1254 | return std::make_pair(control->GetDefaultNormalSaveSize(), | ||
| 1255 | control->GetDeviceSaveDataSize()); | ||
| 1256 | } else { | ||
| 1257 | const auto file = Core::GetGameFileFromPath(vfs, game_path); | ||
| 1258 | const auto loader = Loader::GetLoader(file); | ||
| 1253 | 1259 | ||
| 1254 | loader->ReadControlData(control); | 1260 | FileSys::NACP nacp{}; |
| 1255 | loader->ReadProgramId(program_id); | 1261 | loader->ReadControlData(nacp); |
| 1262 | return std::make_pair(nacp.GetDefaultNormalSaveSize(), nacp.GetDeviceSaveDataSize()); | ||
| 1263 | } | ||
| 1264 | }(); | ||
| 1256 | 1265 | ||
| 1257 | const bool has_user_save{control.GetDefaultNormalSaveSize() > 0}; | 1266 | const bool has_user_save{user_save_size > 0}; |
| 1258 | const bool has_device_save{control.GetDeviceSaveDataSize() > 0}; | 1267 | const bool has_device_save{device_save_size > 0}; |
| 1259 | 1268 | ||
| 1260 | ASSERT_MSG(has_user_save != has_device_save, "Game uses both user and device savedata?"); | 1269 | ASSERT_MSG(has_user_save != has_device_save, "Game uses both user and device savedata?"); |
| 1261 | 1270 | ||
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 64c33830d..01f9131e5 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -198,7 +198,8 @@ private slots: | |||
| 198 | void OnOpenFAQ(); | 198 | void OnOpenFAQ(); |
| 199 | /// Called whenever a user selects a game in the game list widget. | 199 | /// Called whenever a user selects a game in the game list widget. |
| 200 | void OnGameListLoadFile(QString game_path); | 200 | void OnGameListLoadFile(QString game_path); |
| 201 | void OnGameListOpenFolder(GameListOpenTarget target, const std::string& game_path); | 201 | void OnGameListOpenFolder(u64 program_id, GameListOpenTarget target, |
| 202 | const std::string& game_path); | ||
| 202 | void OnTransferableShaderCacheOpenFile(u64 program_id); | 203 | void OnTransferableShaderCacheOpenFile(u64 program_id); |
| 203 | void OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryType type); | 204 | void OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryType type); |
| 204 | void OnGameListRemoveFile(u64 program_id, GameListRemoveTarget target); | 205 | void OnGameListRemoveFile(u64 program_id, GameListRemoveTarget target); |