| 4860 | } |
| 4861 | |
| 4862 | void FullscreenUI::DoLoadInputProfile() |
| 4863 | { |
| 4864 | std::vector<std::string> profiles = Pad::GetInputProfileNames(); |
| 4865 | if (profiles.empty()) |
| 4866 | { |
| 4867 | ShowToast(std::string(), FSUI_STR("No input profiles available.")); |
| 4868 | return; |
| 4869 | } |
| 4870 | |
| 4871 | ImGuiFullscreen::ChoiceDialogOptions coptions; |
| 4872 | coptions.reserve(profiles.size()); |
| 4873 | for (std::string& name : profiles) |
| 4874 | coptions.emplace_back(std::move(name), false); |
| 4875 | OpenChoiceDialog(FSUI_ICONSTR(ICON_FA_FOLDER_OPEN, "Load Profile"), false, std::move(coptions), |
| 4876 | [](s32 index, const std::string& title, bool checked) { |
| 4877 | if (index < 0) |
| 4878 | return; |
| 4879 | |
| 4880 | INISettingsInterface ssi(VMManager::GetInputProfilePath(title)); |
| 4881 | if (!ssi.Load()) |
| 4882 | { |
| 4883 | ShowToast(std::string(), fmt::format(FSUI_FSTR("Failed to load '{}'."), title)); |
| 4884 | CloseChoiceDialog(); |
| 4885 | return; |
| 4886 | } |
| 4887 | |
| 4888 | auto lock = Host::GetSettingsLock(); |
| 4889 | SettingsInterface* dsi = GetEditingSettingsInterface(); |
| 4890 | Pad::CopyConfiguration(dsi, ssi, true, true, IsEditingGameSettings(dsi)); |
| 4891 | USB::CopyConfiguration(dsi, ssi, true, true); |
| 4892 | SetSettingsChanged(dsi); |
| 4893 | ShowToast(std::string(), fmt::format(FSUI_FSTR("Input profile '{}' loaded."), title)); |
| 4894 | CloseChoiceDialog(); |
| 4895 | }); |
| 4896 | } |
| 4897 | |
| 4898 | void FullscreenUI::DoSaveInputProfile(const std::string& name) |
| 4899 | { |