diff options
| author | 2018-10-09 21:53:26 -0400 | |
|---|---|---|
| committer | 2018-10-23 19:31:28 -0400 | |
| commit | 466960c8ab3c10091058e4472d7d2b3aa3c808f0 (patch) | |
| tree | f589638d79179e74d475ac0e6ad2e54895631682 /src | |
| parent | qt: Add Profile Manager UI to system settings (diff) | |
| download | yuzu-466960c8ab3c10091058e4472d7d2b3aa3c808f0.tar.gz yuzu-466960c8ab3c10091058e4472d7d2b3aa3c808f0.tar.xz yuzu-466960c8ab3c10091058e4472d7d2b3aa3c808f0.zip | |
qt: Allow user to select emu user on open save data
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/main.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index be9896614..1de3b817f 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -757,12 +757,33 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target | |||
| 757 | open_target = "Save Data"; | 757 | open_target = "Save Data"; |
| 758 | const std::string nand_dir = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir); | 758 | const std::string nand_dir = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir); |
| 759 | ASSERT(program_id != 0); | 759 | ASSERT(program_id != 0); |
| 760 | // TODO(tech4me): Update this to work with arbitrary user profile | 760 | |
| 761 | // Refer to core/hle/service/acc/profile_manager.cpp ProfileManager constructor | 761 | QStringList list{}; |
| 762 | constexpr u128 user_id = {1, 0}; | 762 | std::transform(Settings::values.users.begin(), Settings::values.users.end(), |
| 763 | std::back_inserter(list), | ||
| 764 | [](const auto& user) { return QString::fromStdString(user.first); }); | ||
| 765 | |||
| 766 | bool ok = false; | ||
| 767 | const auto index_string = | ||
| 768 | QInputDialog::getItem(this, tr("Select User"), | ||
| 769 | tr("Please select the user's save data you would like to open."), | ||
| 770 | list, Settings::values.current_user, false, &ok); | ||
| 771 | if (!ok) | ||
| 772 | return; | ||
| 773 | |||
| 774 | const auto index = list.indexOf(index_string); | ||
| 775 | ASSERT(index != -1); | ||
| 776 | |||
| 777 | const auto user_id = Settings::values.users[index].second.uuid; | ||
| 763 | path = nand_dir + FileSys::SaveDataFactory::GetFullPath(FileSys::SaveDataSpaceId::NandUser, | 778 | path = nand_dir + FileSys::SaveDataFactory::GetFullPath(FileSys::SaveDataSpaceId::NandUser, |
| 764 | FileSys::SaveDataType::SaveData, | 779 | FileSys::SaveDataType::SaveData, |
| 765 | program_id, user_id, 0); | 780 | program_id, user_id, 0); |
| 781 | |||
| 782 | if (!FileUtil::Exists(path)) { | ||
| 783 | FileUtil::CreateFullPath(path); | ||
| 784 | FileUtil::CreateDir(path); | ||
| 785 | } | ||
| 786 | |||
| 766 | break; | 787 | break; |
| 767 | } | 788 | } |
| 768 | case GameListOpenTarget::ModData: { | 789 | case GameListOpenTarget::ModData: { |