diff --git a/client/configuration.cpp b/client/configuration.cpp index 23225475..8e3f183a 100644 --- a/client/configuration.cpp +++ b/client/configuration.cpp @@ -223,22 +223,13 @@ configuration::configuration(xr::system & system) if (auto val = root["high_power_mode"]; val.is_bool()) high_power_mode = val.get_bool(); + + if (auto val = root["extended_config"]; val.is_bool()) + extended_config = val.get_bool(); } catch (std::exception & e) { spdlog::warn("Cannot read configuration: {}", e.what()); - - // Restore default configuration - servers.clear(); - preferred_refresh_rate.reset(); - minimum_refresh_rate.reset(); - resolution_scale = 1.0; - codec.reset(); - bit_depth = 10; - bitrate_bps = 50'000'000; - openxr_post_processing = {}; - passthrough_enabled = system.passthrough_supported() == xr::passthrough_type::color; - stream_scale.reset(); } } @@ -322,6 +313,7 @@ void configuration::save() json << ",\"locale\":" << json_string(locale); json << ",\"environment_model\":" << json_string(environment_model); json << ",\"high_power_mode\":" << std::boolalpha << high_power_mode; + json << ",\"extended_config\":" << std::boolalpha << extended_config; json << "}"; } diff --git a/client/configuration.h b/client/configuration.h index 20078d2a..0040284d 100644 --- a/client/configuration.h +++ b/client/configuration.h @@ -81,6 +81,9 @@ public: bool high_power_mode; + // Allow unsafe config values + bool extended_config = false; + bool first_run = true; std::string locale; @@ -103,4 +106,9 @@ public: void set_stream_scale(float); float get_stream_scale() const; + + uint32_t max_bitrate() const + { + return extended_config ? 800'000'000u : 200'000'000u; + } }; diff --git a/client/scenes/lobby_gui.cpp b/client/scenes/lobby_gui.cpp index 263cde21..8ae5c059 100644 --- a/client/scenes/lobby_gui.cpp +++ b/client/scenes/lobby_gui.cpp @@ -655,7 +655,7 @@ void scenes::lobby::gui_settings() _("Render resolution").append("##resolution_scale").c_str(), &intScale, 5, - 35, + config.extended_config ? 35 : 15, fmt::format(_F("{}%% - {}x{} per eye"), intScale * 10, int(width * current), int(height * current)).c_str()); if (slider) { @@ -685,7 +685,9 @@ void scenes::lobby::gui_settings() if (slider) { // clamp out of the slider to have the 50% value centered - intval = std::clamp(intval, 0, 80 / step); + intval = std::clamp(intval, + config.extended_config ? 0 : 30 / step, + 80 / step); config.set_stream_scale(1 - intval * step * 0.01); config.save(); } @@ -766,7 +768,7 @@ void scenes::lobby::gui_settings() _("Bitrate").append("##bitrate").c_str(), &val, 1, - 200, + config.max_bitrate() / mb, fmt::format(_F("{}Mbit/s"), val).c_str()); if (slider) { @@ -896,6 +898,13 @@ void scenes::lobby::gui_settings() imgui_ctx->tooltip(_("Enables the configuration window to be shown while the game is streaming.\nIf enabled, the window is activated by pressing both thumbsticks.")); } + { + ImGui::Checkbox(_S("Extended configuration values"), &config.extended_config); + imgui_ctx->vibrate_on_hover(); + if (ImGui::IsItemHovered()) + imgui_ctx->tooltip(_("Allows unsafe configuration values, use at your own risk.")); + } + ImGui::PopStyleVar(); // ImGuiStyleVar_ItemSpacing } diff --git a/client/scenes/stream_gui.cpp b/client/scenes/stream_gui.cpp index b917f29b..6e5dbcc8 100644 --- a/client/scenes/stream_gui.cpp +++ b/client/scenes/stream_gui.cpp @@ -599,7 +599,7 @@ void scenes::stream::gui_bitrate_settings(float predicted_display_period) // Maximum speed of 20Mbit/s float delta = application::read_action_float(settings_adjust).value_or(std::pair{0, 0}).second * 20'000'000.f * predicted_display_period; - config.bitrate_bps = std::clamp(config.bitrate_bps + static_cast(delta), 1'000'000u, 200'000'000u); + config.bitrate_bps = std::clamp(config.bitrate_bps + static_cast(delta), 1'000'000u, config.max_bitrate()); bool ok = application::read_action_bool(foveation_ok).value_or(std::pair{0, false}).second;