feat: wivrn profile

This commit is contained in:
Gabriele Musco 2023-06-19 07:55:12 +02:00
commit 4ba25392bb
No known key found for this signature in database
GPG key ID: 1068D795C80E51DE
5 changed files with 47 additions and 9 deletions

View file

@ -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_libsurvive.sh', install_dir: pkgdatadir / 'scripts')
install_data('build_monado.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_opencomposite.sh', install_dir: pkgdatadir / 'scripts')
install_data('build_wivrn.sh', install_dir: pkgdatadir / 'scripts')

View file

@ -8,6 +8,10 @@ pub fn data_monado_path() -> String {
format!("{data}/monado", data = get_data_dir()) 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 { pub fn data_libsurvive_path() -> String {
format!("{data}/libsurvive", data = get_data_dir()) format!("{data}/libsurvive", data = get_data_dir())
} }

View file

@ -1,2 +1,3 @@
pub mod valve_index; pub mod valve_index;
pub mod system_valve_index; pub mod system_valve_index;
pub mod wivrn;

25
src/profiles/wivrn.rs Normal file
View file

@ -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<String, String> = 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,
}
}

View file

@ -24,6 +24,7 @@ use crate::file_utils::setcap_cap_sys_nice_eip;
use crate::profile::{Profile, XRServiceType}; use crate::profile::{Profile, XRServiceType};
use crate::profiles::system_valve_index::system_valve_index_profile; use crate::profiles::system_valve_index::system_valve_index_profile;
use crate::profiles::valve_index::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::{Runner, RunnerStatus};
use crate::runner_pipeline::RunnerPipeline; use crate::runner_pipeline::RunnerPipeline;
use crate::ui::build_window::BuildWindowMsg; use crate::ui::build_window::BuildWindowMsg;
@ -275,12 +276,10 @@ impl SimpleComponent for App {
// missing_deps.extend(get_missing_mercury_deps()); // missing_deps.extend(get_missing_mercury_deps());
// runners.push(get_build_mercury_runner(profile.clone())); // runners.push(get_build_mercury_runner(profile.clone()));
// } // }
runners.push( runners.push(match profile.xrservice_type {
match profile.xrservice_type { XRServiceType::Monado => get_build_monado_runner(profile.clone()),
XRServiceType::Monado => get_build_monado_runner(profile.clone()), XRServiceType::Wivrn => get_build_wivrn_runner(profile.clone()),
XRServiceType::Wivrn => get_build_wivrn_runner(profile.clone()), });
}
);
// no listed deps for opencomp // no listed deps for opencomp
} }
runners.push(get_build_opencomposite_runner(profile.clone())); runners.push(get_build_opencomposite_runner(profile.clone()));
@ -318,8 +317,12 @@ impl SimpleComponent for App {
Msg::RunSetCap => { Msg::RunSetCap => {
let profile = self.get_selected_profile(); let profile = self.get_selected_profile();
setcap_cap_sys_nice_eip(match profile.xrservice_type { setcap_cap_sys_nice_eip(match profile.xrservice_type {
XRServiceType::Monado => format!("{pfx}/bin/monado-service", pfx = profile.prefix), XRServiceType::Monado => {
XRServiceType::Wivrn => format!("{pfx}/bin/wivrn-service", pfx = profile.prefix), format!("{pfx}/bin/monado-service", pfx = profile.prefix)
}
XRServiceType::Wivrn => {
format!("{pfx}/bin/wivrn-service", pfx = profile.prefix)
}
}); });
} }
Msg::ProfileSelected(prof_name) => { Msg::ProfileSelected(prof_name) => {
@ -356,7 +359,11 @@ impl SimpleComponent for App {
sender: ComponentSender<Self>, sender: ComponentSender<Self>,
) -> ComponentParts<Self> { ) -> ComponentParts<Self> {
let config = get_config(); 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() let dependencies_dialog = adw::MessageDialog::builder()
.modal(true) .modal(true)
.transient_for(root) .transient_for(root)