mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 21:36:27 -05:00
qt: Allow user to select emu user on open save data
This commit is contained in:
parent
b2a8209c5b
commit
466960c8ab
1 changed files with 24 additions and 3 deletions
|
@ -757,12 +757,33 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
|
||||||
open_target = "Save Data";
|
open_target = "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);
|
||||||
// TODO(tech4me): Update this to work with arbitrary user profile
|
|
||||||
// Refer to core/hle/service/acc/profile_manager.cpp ProfileManager constructor
|
QStringList list{};
|
||||||
constexpr u128 user_id = {1, 0};
|
std::transform(Settings::values.users.begin(), Settings::values.users.end(),
|
||||||
|
std::back_inserter(list),
|
||||||
|
[](const auto& user) { return QString::fromStdString(user.first); });
|
||||||
|
|
||||||
|
bool ok = false;
|
||||||
|
const auto index_string =
|
||||||
|
QInputDialog::getItem(this, tr("Select User"),
|
||||||
|
tr("Please select the user's save data you would like to open."),
|
||||||
|
list, Settings::values.current_user, false, &ok);
|
||||||
|
if (!ok)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const auto index = list.indexOf(index_string);
|
||||||
|
ASSERT(index != -1);
|
||||||
|
|
||||||
|
const auto user_id = Settings::values.users[index].second.uuid;
|
||||||
path = nand_dir + FileSys::SaveDataFactory::GetFullPath(FileSys::SaveDataSpaceId::NandUser,
|
path = nand_dir + FileSys::SaveDataFactory::GetFullPath(FileSys::SaveDataSpaceId::NandUser,
|
||||||
FileSys::SaveDataType::SaveData,
|
FileSys::SaveDataType::SaveData,
|
||||||
program_id, user_id, 0);
|
program_id, user_id, 0);
|
||||||
|
|
||||||
|
if (!FileUtil::Exists(path)) {
|
||||||
|
FileUtil::CreateFullPath(path);
|
||||||
|
FileUtil::CreateDir(path);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GameListOpenTarget::ModData: {
|
case GameListOpenTarget::ModData: {
|
||||||
|
|
Loading…
Reference in a new issue