diff --git a/scripts/meson.build b/scripts/meson.build index 0a44d0f..faa8af7 100644 --- a/scripts/meson.build +++ b/scripts/meson.build @@ -3,3 +3,4 @@ install_data('build_basalt.sh', install_dir: pkgdatadir / 'scripts') install_data('build_libsurvive.sh', install_dir: pkgdatadir / 'scripts') install_data('build_monado.sh', install_dir: pkgdatadir / 'scripts') install_data('build_opencomposite.sh', install_dir: pkgdatadir / 'scripts') +install_data('build_wivrn.sh', install_dir: pkgdatadir / 'scripts') diff --git a/src/paths.rs b/src/paths.rs index f916f6e..934b4a7 100644 --- a/src/paths.rs +++ b/src/paths.rs @@ -8,6 +8,10 @@ pub fn data_monado_path() -> String { format!("{data}/monado", data = get_data_dir()) } +pub fn data_wivrn_path() -> String { + format!("{data}/wivrn", data = get_data_dir()) +} + pub fn data_libsurvive_path() -> String { format!("{data}/libsurvive", data = get_data_dir()) } diff --git a/src/profiles/mod.rs b/src/profiles/mod.rs index 853d8e2..ab8d197 100644 --- a/src/profiles/mod.rs +++ b/src/profiles/mod.rs @@ -1,2 +1,3 @@ pub mod valve_index; pub mod system_valve_index; +pub mod wivrn; diff --git a/src/profiles/wivrn.rs b/src/profiles/wivrn.rs new file mode 100644 index 0000000..4e3ba97 --- /dev/null +++ b/src/profiles/wivrn.rs @@ -0,0 +1,25 @@ +use std::collections::HashMap; + +use crate::{file_utils::get_data_dir, profile::{Profile, XRServiceType}, paths::{data_wivrn_path, data_opencomposite_path}, constants::APP_NAME}; + +pub fn wivrn_profile() -> Profile { + let data_dir = get_data_dir(); + let prefix = format!("{data}/prefixes/wivrn_default", data = data_dir); + let mut environment: HashMap = HashMap::new(); + environment.insert("LD_LIBRARY_PATH".into(), format!("{pfx}/lib", pfx = prefix)); + Profile { + name: format!("WiVRn - {name} Default", name = APP_NAME), + xrservice_path: data_wivrn_path(), + xrservice_type: XRServiceType::Wivrn, + opencomposite_path: data_opencomposite_path(), + libsurvive_path: None, + basalt_path: None, + mercury_path: None, + libsurvive_enabled: false, + basalt_enabled: false, + mercury_enabled: false, + environment, + prefix, + can_be_built: true, + } +} diff --git a/src/ui/app.rs b/src/ui/app.rs index 762ab33..6bc1112 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -24,6 +24,7 @@ use crate::file_utils::setcap_cap_sys_nice_eip; use crate::profile::{Profile, XRServiceType}; use crate::profiles::system_valve_index::system_valve_index_profile; use crate::profiles::valve_index::valve_index_profile; +use crate::profiles::wivrn::wivrn_profile; use crate::runner::{Runner, RunnerStatus}; use crate::runner_pipeline::RunnerPipeline; use crate::ui::build_window::BuildWindowMsg; @@ -275,12 +276,10 @@ impl SimpleComponent for App { // missing_deps.extend(get_missing_mercury_deps()); // runners.push(get_build_mercury_runner(profile.clone())); // } - runners.push( - match profile.xrservice_type { - XRServiceType::Monado => get_build_monado_runner(profile.clone()), - XRServiceType::Wivrn => get_build_wivrn_runner(profile.clone()), - } - ); + runners.push(match profile.xrservice_type { + XRServiceType::Monado => get_build_monado_runner(profile.clone()), + XRServiceType::Wivrn => get_build_wivrn_runner(profile.clone()), + }); // no listed deps for opencomp } runners.push(get_build_opencomposite_runner(profile.clone())); @@ -318,8 +317,12 @@ impl SimpleComponent for App { Msg::RunSetCap => { let profile = self.get_selected_profile(); setcap_cap_sys_nice_eip(match profile.xrservice_type { - XRServiceType::Monado => format!("{pfx}/bin/monado-service", pfx = profile.prefix), - XRServiceType::Wivrn => format!("{pfx}/bin/wivrn-service", pfx = profile.prefix), + XRServiceType::Monado => { + format!("{pfx}/bin/monado-service", pfx = profile.prefix) + } + XRServiceType::Wivrn => { + format!("{pfx}/bin/wivrn-service", pfx = profile.prefix) + } }); } Msg::ProfileSelected(prof_name) => { @@ -356,7 +359,11 @@ impl SimpleComponent for App { sender: ComponentSender, ) -> ComponentParts { let config = get_config(); - let profiles = vec![valve_index_profile(), system_valve_index_profile()]; + let profiles = vec![ + valve_index_profile(), + system_valve_index_profile(), + wivrn_profile(), + ]; let dependencies_dialog = adw::MessageDialog::builder() .modal(true) .transient_for(root)