| 73 | } |
| 74 | |
| 75 | static void Render() |
| 76 | { |
| 77 | static bool onOpen = true; |
| 78 | if (ImGui::BeginTabItem("Misc")) |
| 79 | { |
| 80 | static std::string result; |
| 81 | |
| 82 | // Get processes every 5 seconds |
| 83 | static auto timeBefore = std::chrono::high_resolution_clock::now(); |
| 84 | std::chrono::duration<float, std::milli> timeDuration = std::chrono::high_resolution_clock::now() - timeBefore; |
| 85 | if (timeDuration.count() > 5000 || onOpen) |
| 86 | { |
| 87 | timeBefore = std::chrono::high_resolution_clock::now(); |
| 88 | LCU::GetLeagueProcesses(); |
| 89 | } |
| 90 | |
| 91 | ImGui::Text("Selected process: "); |
| 92 | ImGui::SameLine(); |
| 93 | |
| 94 | std::string comboProcesses; |
| 95 | if (LCU::IsProcessGood()) |
| 96 | { |
| 97 | comboProcesses = std::to_string(LCU::leagueProcesses[LCU::indexLeagueProcesses].first) |
| 98 | + " : " + LCU::leagueProcesses[LCU::indexLeagueProcesses].second; |
| 99 | } |
| 100 | ImGui::SetNextItemWidth(static_cast<float>(S.Window.width / 3)); |
| 101 | if (ImGui::BeginCombo("##comboProcesses", comboProcesses.c_str(), 0)) |
| 102 | { |
| 103 | for (size_t n = 0; n < LCU::leagueProcesses.size(); n++) |
| 104 | { |
| 105 | const bool is_selected = (LCU::indexLeagueProcesses == n); |
| 106 | if (ImGui::Selectable((std::to_string(LCU::leagueProcesses[n].first) + " : " + LCU::leagueProcesses[n].second).c_str(), |
| 107 | is_selected)) |
| 108 | { |
| 109 | LCU::indexLeagueProcesses = n; |
| 110 | LCU::SetLeagueClientInfo(); |
| 111 | } |
| 112 | |
| 113 | if (is_selected) |
| 114 | ImGui::SetItemDefaultFocus(); |
| 115 | } |
| 116 | ImGui::EndCombo(); |
| 117 | } |
| 118 | |
| 119 | ImGui::Separator(); |
| 120 | |
| 121 | ImGui::Columns(2, nullptr, false); |
| 122 | |
| 123 | if (ImGui::Button("Launch another client")) |
| 124 | { |
| 125 | if (!std::filesystem::exists(S.leaguePath)) |
| 126 | { |
| 127 | result = "Invalid path, change it in Settings tab"; |
| 128 | } |
| 129 | else |
| 130 | Utils::OpenUrl(std::format("{}LeagueClient.exe", S.leaguePath).c_str(), "--allow-multiple-clients", SW_SHOWNORMAL); |
| 131 | } |
| 132 | |