From 9725ae7fc055ebd08a9bebfa98c61f4cb67dd23e Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 11 Aug 2025 10:02:02 +0200 Subject: [PATCH] Add an option to disable in-stream GUI --- client/configuration.cpp | 4 ++++ client/configuration.h | 2 ++ client/scenes/lobby_gui.cpp | 7 +++++++ client/scenes/stream.cpp | 7 +++++-- client/scenes/stream_gui.cpp | 2 ++ 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/client/configuration.cpp b/client/configuration.cpp index abe7f15e..ea0ec8d8 100644 --- a/client/configuration.cpp +++ b/client/configuration.cpp @@ -214,6 +214,9 @@ configuration::configuration(xr::system & system) if (auto val = root["resolution_scale"]; val.is_double()) resolution_scale = val.get_double(); + if (auto val = root["enable_stream_gui"]; val.is_bool()) + enable_stream_gui = val.get_bool(); + if (auto val = root["sgsr"]; val.is_object()) parse_sgsr_options(val.get_object()); @@ -365,6 +368,7 @@ void configuration::save() json << ",\"mic_unprocessed_audio\":" << std::boolalpha << mic_unprocessed_audio; json << ",\"fb_lower_body\":" << std::boolalpha << fb_lower_body; json << ",\"fb_hip\":" << std::boolalpha << fb_hip; + json << ",\"enable_stream_gui\":" << std::boolalpha << enable_stream_gui; for (auto & [key, value]: features) json << "," << key << ":" << std::boolalpha << value; json << ",\"virtual_keyboard_layout\":" << json_string(virtual_keyboard_layout); diff --git a/client/configuration.h b/client/configuration.h index 8d34faae..a0f6ecad 100644 --- a/client/configuration.h +++ b/client/configuration.h @@ -56,6 +56,8 @@ public: bool fb_lower_body = false; bool fb_hip = true; + bool enable_stream_gui = true; + // Snapdragon Game Super Resolution struct sgsr_settings { diff --git a/client/scenes/lobby_gui.cpp b/client/scenes/lobby_gui.cpp index bbc61c63..b5a61928 100644 --- a/client/scenes/lobby_gui.cpp +++ b/client/scenes/lobby_gui.cpp @@ -990,6 +990,13 @@ void scenes::lobby::gui_settings() imgui_ctx->tooltip(_("This feature is not supported by your headset")); ImGui::EndDisabled(); + { + ImGui::Checkbox(_S("Enable in-stream window"), &config.enable_stream_gui); + imgui_ctx->vibrate_on_hover(); + if (ImGui::IsItemHovered()) + 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::PopStyleVar(); // ImGuiStyleVar_ItemSpacing } diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index aa33ba7b..7dd945a3 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -465,8 +465,11 @@ void scenes::stream::on_focused() swapchain_imgui, std::vector{vp}); - plots_toggle_1 = get_action("plots_toggle_1").first; - plots_toggle_2 = get_action("plots_toggle_2").first; + if (application::get_config().enable_stream_gui) + { + plots_toggle_1 = get_action("plots_toggle_1").first; + plots_toggle_2 = get_action("plots_toggle_2").first; + } recenter_left = get_action("recenter_left").first; recenter_right = get_action("recenter_right").first; foveation_pitch = get_action("foveation_pitch").first; diff --git a/client/scenes/stream_gui.cpp b/client/scenes/stream_gui.cpp index 975445a1..1164543f 100644 --- a/client/scenes/stream_gui.cpp +++ b/client/scenes/stream_gui.cpp @@ -615,6 +615,8 @@ static glm::vec4 compute_ray_limits(const XrPosef & pose, float margin = 0) void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicted_display_period) { + if (not(plots_toggle_1 and plots_toggle_2)) + return; bool interactable = true; XrSpace world_space = application::space(xr::spaces::world); auto views = session.locate_views(viewconfig, predicted_display_time, world_space).second;