summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/yuzu/game_list.cpp8
-rw-r--r--src/yuzu/game_list.h2
-rw-r--r--src/yuzu/main.cpp64
-rw-r--r--src/yuzu/main.h2
4 files changed, 49 insertions, 27 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index dccbabcbf..bfb600df0 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -488,11 +488,11 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, std::string pat
488 auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id); 488 auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id);
489 navigate_to_gamedb_entry->setVisible(it != compatibility_list.end() && program_id != 0); 489 navigate_to_gamedb_entry->setVisible(it != compatibility_list.end() && program_id != 0);
490 490
491 connect(open_save_location, &QAction::triggered, [this, program_id]() { 491 connect(open_save_location, &QAction::triggered, [this, program_id, path]() {
492 emit OpenFolderRequested(program_id, GameListOpenTarget::SaveData); 492 emit OpenFolderRequested(GameListOpenTarget::SaveData, path);
493 }); 493 });
494 connect(open_lfs_location, &QAction::triggered, [this, program_id]() { 494 connect(open_lfs_location, &QAction::triggered, [this, program_id, path]() {
495 emit OpenFolderRequested(program_id, GameListOpenTarget::ModData); 495 emit OpenFolderRequested(GameListOpenTarget::ModData, path);
496 }); 496 });
497 connect(open_transferable_shader_cache, &QAction::triggered, 497 connect(open_transferable_shader_cache, &QAction::triggered,
498 [this, program_id]() { emit OpenTransferableShaderCacheRequested(program_id); }); 498 [this, program_id]() { emit OpenTransferableShaderCacheRequested(program_id); });
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h
index 878d94413..a38cb2fc3 100644
--- a/src/yuzu/game_list.h
+++ b/src/yuzu/game_list.h
@@ -73,7 +73,7 @@ public:
73signals: 73signals:
74 void GameChosen(QString game_path); 74 void GameChosen(QString game_path);
75 void ShouldCancelWorker(); 75 void ShouldCancelWorker();
76 void OpenFolderRequested(u64 program_id, GameListOpenTarget target); 76 void OpenFolderRequested(GameListOpenTarget target, const std::string& game_path);
77 void OpenTransferableShaderCacheRequested(u64 program_id); 77 void OpenTransferableShaderCacheRequested(u64 program_id);
78 void DumpRomFSRequested(u64 program_id, const std::string& game_path); 78 void DumpRomFSRequested(u64 program_id, const std::string& game_path);
79 void CopyTIDRequested(u64 program_id); 79 void CopyTIDRequested(u64 program_id);
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 86e8a1d49..437464797 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1154,39 +1154,61 @@ void GMainWindow::OnGameListLoadFile(QString game_path) {
1154 BootGame(game_path); 1154 BootGame(game_path);
1155} 1155}
1156 1156
1157void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target) { 1157void GMainWindow::OnGameListOpenFolder(GameListOpenTarget target, const std::string& game_path) {
1158 std::string path; 1158 std::string path;
1159 QString open_target; 1159 QString open_target;
1160
1161 const auto v_file = Core::GetGameFileFromPath(vfs, game_path);
1162 const auto loader = Loader::GetLoader(v_file);
1163 FileSys::NACP control{};
1164 u64 program_id{};
1165
1166 loader->ReadControlData(control);
1167 loader->ReadProgramId(program_id);
1168
1169 const bool has_user_save{control.GetDefaultNormalSaveSize() > 0};
1170 const bool has_device_save{control.GetDeviceSaveDataSize() > 0};
1171
1172 ASSERT_MSG(has_user_save != has_device_save, "Game uses both user and device savedata?");
1173
1160 switch (target) { 1174 switch (target) {
1161 case GameListOpenTarget::SaveData: { 1175 case GameListOpenTarget::SaveData: {
1162 open_target = tr("Save Data"); 1176 open_target = tr("Save Data");
1163 const std::string nand_dir = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir); 1177 const std::string nand_dir = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir);
1164 ASSERT(program_id != 0); 1178 ASSERT(program_id != 0);
1165 1179
1166 const auto select_profile = [this] { 1180 if (has_user_save) {
1167 QtProfileSelectionDialog dialog(this); 1181 // User save data
1168 dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | 1182 const auto select_profile = [this] {
1169 Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); 1183 QtProfileSelectionDialog dialog(this);
1170 dialog.setWindowModality(Qt::WindowModal); 1184 dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
1185 Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
1186 dialog.setWindowModality(Qt::WindowModal);
1171 1187
1172 if (dialog.exec() == QDialog::Rejected) { 1188 if (dialog.exec() == QDialog::Rejected) {
1173 return -1; 1189 return -1;
1174 } 1190 }
1175 1191
1176 return dialog.GetIndex(); 1192 return dialog.GetIndex();
1177 }; 1193 };
1178 1194
1179 const auto index = select_profile(); 1195 const auto index = select_profile();
1180 if (index == -1) { 1196 if (index == -1) {
1181 return; 1197 return;
1182 } 1198 }
1183 1199
1184 Service::Account::ProfileManager manager; 1200 Service::Account::ProfileManager manager;
1185 const auto user_id = manager.GetUser(static_cast<std::size_t>(index)); 1201 const auto user_id = manager.GetUser(static_cast<std::size_t>(index));
1186 ASSERT(user_id); 1202 ASSERT(user_id);
1187 path = nand_dir + FileSys::SaveDataFactory::GetFullPath(FileSys::SaveDataSpaceId::NandUser, 1203 path = nand_dir + FileSys::SaveDataFactory::GetFullPath(
1188 FileSys::SaveDataType::SaveData, 1204 FileSys::SaveDataSpaceId::NandUser,
1189 program_id, user_id->uuid, 0); 1205 FileSys::SaveDataType::SaveData, program_id, user_id->uuid, 0);
1206 } else {
1207 // Device save data
1208 path = nand_dir + FileSys::SaveDataFactory::GetFullPath(
1209 FileSys::SaveDataSpaceId::NandUser,
1210 FileSys::SaveDataType::SaveData, program_id, {}, 0);
1211 }
1190 1212
1191 if (!FileUtil::Exists(path)) { 1213 if (!FileUtil::Exists(path)) {
1192 FileUtil::CreateFullPath(path); 1214 FileUtil::CreateFullPath(path);
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 60b17c54a..1495a1b26 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -183,7 +183,7 @@ private slots:
183 void OnMenuReportCompatibility(); 183 void OnMenuReportCompatibility();
184 /// Called whenever a user selects a game in the game list widget. 184 /// Called whenever a user selects a game in the game list widget.
185 void OnGameListLoadFile(QString game_path); 185 void OnGameListLoadFile(QString game_path);
186 void OnGameListOpenFolder(u64 program_id, GameListOpenTarget target); 186 void OnGameListOpenFolder(GameListOpenTarget target, const std::string& game_path);
187 void OnTransferableShaderCacheOpenFile(u64 program_id); 187 void OnTransferableShaderCacheOpenFile(u64 program_id);
188 void OnGameListDumpRomFS(u64 program_id, const std::string& game_path); 188 void OnGameListDumpRomFS(u64 program_id, const std::string& game_path);
189 void OnGameListCopyTID(u64 program_id); 189 void OnGameListCopyTID(u64 program_id);