mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-12 21:44:18 +01:00
yuzu: game_list: Fix 'Open Save Data Location' for device saves.
This commit is contained in:
parent
ab9ddab0a2
commit
551c61bf27
@ -488,11 +488,11 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, std::string pat
|
|||||||
auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id);
|
auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id);
|
||||||
navigate_to_gamedb_entry->setVisible(it != compatibility_list.end() && program_id != 0);
|
navigate_to_gamedb_entry->setVisible(it != compatibility_list.end() && program_id != 0);
|
||||||
|
|
||||||
connect(open_save_location, &QAction::triggered, [this, program_id]() {
|
connect(open_save_location, &QAction::triggered, [this, program_id, path]() {
|
||||||
emit OpenFolderRequested(program_id, GameListOpenTarget::SaveData);
|
emit OpenFolderRequested(GameListOpenTarget::SaveData, path);
|
||||||
});
|
});
|
||||||
connect(open_lfs_location, &QAction::triggered, [this, program_id]() {
|
connect(open_lfs_location, &QAction::triggered, [this, program_id, path]() {
|
||||||
emit OpenFolderRequested(program_id, GameListOpenTarget::ModData);
|
emit OpenFolderRequested(GameListOpenTarget::ModData, path);
|
||||||
});
|
});
|
||||||
connect(open_transferable_shader_cache, &QAction::triggered,
|
connect(open_transferable_shader_cache, &QAction::triggered,
|
||||||
[this, program_id]() { emit OpenTransferableShaderCacheRequested(program_id); });
|
[this, program_id]() { emit OpenTransferableShaderCacheRequested(program_id); });
|
||||||
|
@ -73,7 +73,7 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void GameChosen(QString game_path);
|
void GameChosen(QString game_path);
|
||||||
void ShouldCancelWorker();
|
void ShouldCancelWorker();
|
||||||
void OpenFolderRequested(u64 program_id, GameListOpenTarget target);
|
void OpenFolderRequested(GameListOpenTarget target, const std::string& game_path);
|
||||||
void OpenTransferableShaderCacheRequested(u64 program_id);
|
void OpenTransferableShaderCacheRequested(u64 program_id);
|
||||||
void DumpRomFSRequested(u64 program_id, const std::string& game_path);
|
void DumpRomFSRequested(u64 program_id, const std::string& game_path);
|
||||||
void CopyTIDRequested(u64 program_id);
|
void CopyTIDRequested(u64 program_id);
|
||||||
|
@ -1154,15 +1154,31 @@ void GMainWindow::OnGameListLoadFile(QString game_path) {
|
|||||||
BootGame(game_path);
|
BootGame(game_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target) {
|
void GMainWindow::OnGameListOpenFolder(GameListOpenTarget target, const std::string& game_path) {
|
||||||
std::string path;
|
std::string path;
|
||||||
QString open_target;
|
QString open_target;
|
||||||
|
|
||||||
|
const auto v_file = Core::GetGameFileFromPath(vfs, game_path);
|
||||||
|
const auto loader = Loader::GetLoader(v_file);
|
||||||
|
FileSys::NACP control{};
|
||||||
|
u64 program_id{};
|
||||||
|
|
||||||
|
loader->ReadControlData(control);
|
||||||
|
loader->ReadProgramId(program_id);
|
||||||
|
|
||||||
|
const bool has_user_save{control.GetDefaultNormalSaveSize() > 0};
|
||||||
|
const bool has_device_save{control.GetDeviceSaveDataSize() > 0};
|
||||||
|
|
||||||
|
ASSERT_MSG(has_user_save != has_device_save, "Game uses both user and device savedata?");
|
||||||
|
|
||||||
switch (target) {
|
switch (target) {
|
||||||
case GameListOpenTarget::SaveData: {
|
case GameListOpenTarget::SaveData: {
|
||||||
open_target = tr("Save Data");
|
open_target = tr("Save Data");
|
||||||
const std::string nand_dir = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir);
|
const std::string nand_dir = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir);
|
||||||
ASSERT(program_id != 0);
|
ASSERT(program_id != 0);
|
||||||
|
|
||||||
|
if (has_user_save) {
|
||||||
|
// User save data
|
||||||
const auto select_profile = [this] {
|
const auto select_profile = [this] {
|
||||||
QtProfileSelectionDialog dialog(this);
|
QtProfileSelectionDialog dialog(this);
|
||||||
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
|
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
|
||||||
@ -1184,9 +1200,15 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
|
|||||||
Service::Account::ProfileManager manager;
|
Service::Account::ProfileManager manager;
|
||||||
const auto user_id = manager.GetUser(static_cast<std::size_t>(index));
|
const auto user_id = manager.GetUser(static_cast<std::size_t>(index));
|
||||||
ASSERT(user_id);
|
ASSERT(user_id);
|
||||||
path = nand_dir + FileSys::SaveDataFactory::GetFullPath(FileSys::SaveDataSpaceId::NandUser,
|
path = nand_dir + FileSys::SaveDataFactory::GetFullPath(
|
||||||
FileSys::SaveDataType::SaveData,
|
FileSys::SaveDataSpaceId::NandUser,
|
||||||
program_id, user_id->uuid, 0);
|
FileSys::SaveDataType::SaveData, program_id, user_id->uuid, 0);
|
||||||
|
} else {
|
||||||
|
// Device save data
|
||||||
|
path = nand_dir + FileSys::SaveDataFactory::GetFullPath(
|
||||||
|
FileSys::SaveDataSpaceId::NandUser,
|
||||||
|
FileSys::SaveDataType::SaveData, program_id, {}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!FileUtil::Exists(path)) {
|
if (!FileUtil::Exists(path)) {
|
||||||
FileUtil::CreateFullPath(path);
|
FileUtil::CreateFullPath(path);
|
||||||
|
@ -183,7 +183,7 @@ private slots:
|
|||||||
void OnMenuReportCompatibility();
|
void OnMenuReportCompatibility();
|
||||||
/// Called whenever a user selects a game in the game list widget.
|
/// Called whenever a user selects a game in the game list widget.
|
||||||
void OnGameListLoadFile(QString game_path);
|
void OnGameListLoadFile(QString game_path);
|
||||||
void OnGameListOpenFolder(u64 program_id, GameListOpenTarget target);
|
void OnGameListOpenFolder(GameListOpenTarget target, const std::string& game_path);
|
||||||
void OnTransferableShaderCacheOpenFile(u64 program_id);
|
void OnTransferableShaderCacheOpenFile(u64 program_id);
|
||||||
void OnGameListDumpRomFS(u64 program_id, const std::string& game_path);
|
void OnGameListDumpRomFS(u64 program_id, const std::string& game_path);
|
||||||
void OnGameListCopyTID(u64 program_id);
|
void OnGameListCopyTID(u64 program_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user