Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Vindicus999
2025-09-24 21:25:03 -04:00
88 changed files with 6692 additions and 3956 deletions
+40 -85
View File
@@ -17,6 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <uni_algo/case.h>
#define IMGUI_DEFINE_MATH_OPERATORS
#ifdef __ANDROID__
@@ -139,7 +140,7 @@ static void InputText(const char * label, std::string & text, const ImVec2 & siz
return 0;
};
ImGui::InputTextEx(label, nullptr, text.data(), text.size(), size, flags | ImGuiInputTextFlags_CallbackResize, callback, &text);
ImGui::InputTextEx(label, nullptr, text.data(), text.size() + 1, size, flags | ImGuiInputTextFlags_CallbackResize, callback, &text);
}
static void display_recentering_tip(imgui_context & ctx, const std::string & tip)
@@ -771,6 +772,43 @@ void scenes::lobby::gui_settings()
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(20, 20));
{
auto language_name = [&](const std::locale & loc = std::locale()) {
return boost::locale::pgettext("language selection, replace with the name of the language", "English", loc);
};
std::vector<std::tuple<std::string, std::locale, std::string>> languages;
for (const auto & msg_info: get_locales())
{
std::string code = msg_info.language;
if (not msg_info.country.empty())
code += "_" + msg_info.country;
std::locale loc(std::locale(), boost::locale::gnu_gettext::create_messages_facet<char>(msg_info));
languages.emplace_back(language_name(loc), loc, std::move(code));
}
std::ranges::sort(languages, [](auto & l, auto & r) {
return una::casesens::collate_utf8(std::get<0>(l), std::get<0>(r)) < 0;
});
if (ImGui::BeginCombo(_S("Language"), config.locale.empty() ? _S("System language") : language_name().c_str()))
{
if (ImGui::Selectable(_S("System language"), config.locale.empty(), ImGuiSelectableFlags_SelectOnRelease))
{
config.locale.clear();
config.save();
application::instance().load_locale();
}
for (const auto & [lang, locale, code]: languages)
{
if (ImGui::Selectable(lang.c_str(), code == config.locale, ImGuiSelectableFlags_SelectOnRelease))
{
config.locale = code;
config.save();
application::instance().load_locale();
}
}
ImGui::EndCombo();
}
}
if (instance.has_extension(XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME))
{
const auto & refresh_rates = session.get_refresh_rates();
@@ -1034,89 +1072,6 @@ void scenes::lobby::gui_post_processing()
ImGui::Unindent();
}
{
// SGSR
{
if (ImGui::Checkbox(_S("Enable Snapdragon Game Super Resolution"), &config.sgsr.enabled))
{
config.save();
}
imgui_ctx->vibrate_on_hover();
if (ImGui::IsItemHovered())
{
if (application::get_openxr_post_processing_supported())
imgui_ctx->tooltip(_("On this headset, this setting has been fully superseded by the native Sharpening setting above.\nOnly enable if you know what you're doing."));
else
imgui_ctx->tooltip(_("Client-side upscaling and sharpening, adds a performance cost on the headset"));
}
if (application::get_openxr_post_processing_supported())
{
ImGui::SameLine();
ImGui::TextColored(ImColor(0xf9, 0x73, 0x06) /*orange*/, ICON_FA_TRIANGLE_EXCLAMATION);
}
}
{
ImGui::BeginDisabled(not config.sgsr.enabled);
ImGui::Indent();
{
const auto current = config.sgsr.upscaling_factor;
const auto width = stream_view.recommendedImageRectWidth * config.resolution_scale;
const auto height = stream_view.recommendedImageRectHeight * config.resolution_scale;
auto intScale = int(current * 100);
const auto slider = ImGui::SliderInt(
_("Upscaling factor").append("##upscaling_factor").c_str(),
&intScale,
100,
200,
fmt::format(_F("%d%% - {}x{} per eye"), int(width * current), int(height * current)).c_str());
if (slider)
{
config.sgsr.upscaling_factor = intScale * 0.01;
config.save();
}
imgui_ctx->vibrate_on_hover();
if (width * current > stream_view.maxImageRectWidth or height * current > stream_view.maxImageRectHeight)
{
ImGui::TextColored(ImColor(0xf9, 0x73, 0x06) /*orange*/, ICON_FA_TRIANGLE_EXCLAMATION);
ImGui::SameLine();
ImGui::Text("%s", fmt::format(_F("Resolution larger than {}x{} may not be supported by the headset"), stream_view.maxImageRectWidth, stream_view.maxImageRectHeight).c_str());
}
}
{
if (ImGui::Checkbox(_S("Use edge direction"), &config.sgsr.use_edge_direction))
{
config.save();
}
imgui_ctx->vibrate_on_hover();
if (ImGui::IsItemHovered())
imgui_ctx->tooltip(_("Adds an additional performance cost"));
}
{
const float current = config.sgsr.edge_threshold;
int intScale = int(current);
if (ImGui::SliderInt(_S("Edge threshold"), &intScale, 1, 16, "%d.0"))
{
config.sgsr.edge_threshold = float(intScale);
config.save();
}
imgui_ctx->vibrate_on_hover();
if (ImGui::IsItemHovered())
imgui_ctx->tooltip(fmt::format(_F("Recommended: {:.1f}"), 4.0));
}
{
if (ImGui::SliderFloat(_S("Edge sharpness"), &config.sgsr.edge_sharpness, 1.0, 2.0, "%.2f"))
{
config.save();
}
imgui_ctx->vibrate_on_hover();
if (ImGui::IsItemHovered())
imgui_ctx->tooltip(fmt::format(_F("Recommended: {:.1f}"), 2.0));
}
ImGui::Unindent();
ImGui::EndDisabled();
}
}
ImGui::PopStyleVar();
}
@@ -1347,7 +1302,7 @@ void scenes::lobby::gui_licenses()
ImGui::Text("%s", _("Licenses").c_str());
ImGui::PopFont();
const auto components = {"WiVRn", "FontAwesome", "openxr-loader", "simdjson", "SGSR"};
const auto components = {"WiVRn", "FontAwesome", "openxr-loader", "simdjson"};
if (not license)
{
selected_item = *components.begin();