From 0f3e6970bbf3033a511a18efb7217bb06a8b566f Mon Sep 17 00:00:00 2001 From: Sapphire Date: Sat, 1 Feb 2025 16:37:16 -0600 Subject: [PATCH 1/2] fix: prevent wivrn from overriding openvr runtime Without this flag, WiVRn would set the OpenVR runtime to a system installation if available. --- src/ui/job_worker/internal_worker.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ui/job_worker/internal_worker.rs b/src/ui/job_worker/internal_worker.rs index 25c40a2..c01a3ef 100644 --- a/src/ui/job_worker/internal_worker.rs +++ b/src/ui/job_worker/internal_worker.rs @@ -3,7 +3,7 @@ use super::{ state::JobWorkerState, }; use crate::{ - profile::{LighthouseDriver, Profile}, + profile::{LighthouseDriver, Profile, XRServiceType}, ui::SENDER_IO_ERR_MSG, }; use nix::unistd::Pid; @@ -18,6 +18,8 @@ use std::{ thread, }; +static WIVRN_LAUNCH_OPTS: [&str; 2] = ["--no-instructions", "--no-manage-active-runtime"]; + macro_rules! logger_thread { ($buf_fd: expr, $sender: expr) => { thread::spawn(move || { @@ -193,8 +195,14 @@ impl InternalJobWorker { } else { launch_opts }; - if !launch_opts.contains(" --no-instructions") { - launch_opts.push_str(" --no-instructions"); + if prof.xrservice_type == XRServiceType::Wivrn { + let mut opts = WIVRN_LAUNCH_OPTS.to_vec(); + opts.retain(|opt| !launch_opts.contains(opt)); + + opts.iter().for_each(|opt| { + launch_opts.push(' '); + launch_opts.push_str(opt); + }); } let (command, args) = match launch_opts.is_empty() { false => ( From 9098800298030dcb26465759f0b042b6588ee2be Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Wed, 5 Feb 2025 07:53:56 +0100 Subject: [PATCH 2/2] fix: better handling of wivrn launch opts --- src/ui/job_worker/internal_worker.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ui/job_worker/internal_worker.rs b/src/ui/job_worker/internal_worker.rs index c01a3ef..8278493 100644 --- a/src/ui/job_worker/internal_worker.rs +++ b/src/ui/job_worker/internal_worker.rs @@ -18,7 +18,9 @@ use std::{ thread, }; -static WIVRN_LAUNCH_OPTS: [&str; 2] = ["--no-instructions", "--no-manage-active-runtime"]; +/// launch options that are desirable on wivrn, no way currently to remove them +/// but it should be fine +const WIVRN_LAUNCH_OPTS: [&str; 2] = ["--no-instructions", "--no-manage-active-runtime"]; macro_rules! logger_thread { ($buf_fd: expr, $sender: expr) => { @@ -196,13 +198,12 @@ impl InternalJobWorker { launch_opts }; if prof.xrservice_type == XRServiceType::Wivrn { - let mut opts = WIVRN_LAUNCH_OPTS.to_vec(); - opts.retain(|opt| !launch_opts.contains(opt)); - - opts.iter().for_each(|opt| { - launch_opts.push(' '); - launch_opts.push_str(opt); - }); + for wivrn_opt in WIVRN_LAUNCH_OPTS { + if !launch_opts.contains(wivrn_opt) { + launch_opts.push(' '); + launch_opts.push_str(wivrn_opt); + } + } } let (command, args) = match launch_opts.is_empty() { false => (