diff --git a/src/main.rs b/src/main.rs index f1dd2cc..02e5485 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,6 +14,7 @@ pub mod profiles; pub mod runner; pub mod ui; pub mod runner_pipeline; +pub mod paths; fn main() { let app = RelmApp::new(APP_ID); diff --git a/src/paths.rs b/src/paths.rs new file mode 100644 index 0000000..5d90072 --- /dev/null +++ b/src/paths.rs @@ -0,0 +1,13 @@ +use crate::file_utils::get_data_dir; + +pub fn data_opencomposite_path() -> String { + format!("{data}/opencomposite", data = get_data_dir()) +} + +pub fn data_monado_path() -> String { + format!("{data}/monado", data = get_data_dir()) +} + +pub fn data_libsurvive_path() -> String { + format!("{data}/libsurvive", data = get_data_dir()) +} diff --git a/src/profile.rs b/src/profile.rs index 0a5e448..786b942 100644 --- a/src/profile.rs +++ b/src/profile.rs @@ -17,6 +17,7 @@ pub struct Profile { pub environment: HashMap, /** Install prefix */ pub prefix: String, + pub can_be_built: bool, } impl Display for Profile { @@ -99,6 +100,7 @@ mod tests { mercury_enabled: false, environment: env, prefix: String::from("/home/user/rex2prefix"), + can_be_built: true, }; let fpath = String::from("./target/testout/testprofile.json"); dump_profile(p, &fpath); diff --git a/src/profiles/mod.rs b/src/profiles/mod.rs index fc8114d..4d86d5d 100644 --- a/src/profiles/mod.rs +++ b/src/profiles/mod.rs @@ -1,3 +1,2 @@ - pub mod valve_index; - +pub mod valve_index_system; diff --git a/src/profiles/valve_index.rs b/src/profiles/valve_index.rs index 3d0ae97..0ab9061 100644 --- a/src/profiles/valve_index.rs +++ b/src/profiles/valve_index.rs @@ -1,4 +1,4 @@ -use crate::{constants::APP_NAME, file_utils::get_data_dir, profile::Profile}; +use crate::{constants::APP_NAME, file_utils::get_data_dir, profile::Profile, paths::{data_monado_path, data_opencomposite_path, data_libsurvive_path}}; use std::collections::HashMap; pub fn valve_index_profile() -> Profile { @@ -12,9 +12,9 @@ pub fn valve_index_profile() -> Profile { environment.insert("LD_LIBRARY_PATH".into(), format!("{pfx}/lib", pfx = prefix)); Profile { name: format!("Valve Index - {name} Default", name = APP_NAME), - monado_path: format!("{data}/monado", data = data_dir), - opencomposite_path: format!("{data}/opencomposite", data = data_dir), - libsurvive_path: Some(format!("{data}/libsurvive", data = data_dir)), + monado_path: data_monado_path(), + opencomposite_path: data_opencomposite_path(), + libsurvive_path: Some(data_libsurvive_path()), basalt_path: None, mercury_path: None, libsurvive_enabled: true, @@ -22,5 +22,6 @@ pub fn valve_index_profile() -> Profile { mercury_enabled: false, environment, prefix, + can_be_built: true, } } diff --git a/src/profiles/valve_index_system.rs b/src/profiles/valve_index_system.rs new file mode 100644 index 0000000..5a12a88 --- /dev/null +++ b/src/profiles/valve_index_system.rs @@ -0,0 +1,24 @@ +use crate::{constants::APP_NAME, paths::data_opencomposite_path, profile::Profile}; +use std::collections::HashMap; + +pub fn system_valve_index_profile() -> Profile { + let mut environment: HashMap = HashMap::new(); + environment.insert("XRT_COMPOSITOR_SCALE_PERCENTAGE".into(), "140".into()); + environment.insert("XRT_COMPOSITOR_COMPUTE".into(), "1".into()); + environment.insert("SURVIVE_GLOBALSCENESOLVER".into(), "0".into()); + environment.insert("SURVIVE_TIMECODE_OFFSET_MS".into(), "-6.94".into()); + Profile { + name: format!("Valve Index (System) - {name} Default", name = APP_NAME), + opencomposite_path: data_opencomposite_path(), + monado_path: "".into(), + libsurvive_path: None, + basalt_path: None, + mercury_path: None, + libsurvive_enabled: false, + mercury_enabled: false, + basalt_enabled: false, + environment, + prefix: "/usr".into(), + can_be_built: false, + } +} diff --git a/src/ui/app.rs b/src/ui/app.rs index 8550f58..808daf4 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -250,22 +250,26 @@ impl SimpleComponent for App { }, Msg::BuildProfile => { let profile = self.get_selected_profile(); - let mut missing_deps = get_missing_monado_deps(); + let mut missing_deps = vec![]; let mut runners: Vec = vec![]; - if profile.libsurvive_enabled { - missing_deps.extend(get_missing_libsurvive_deps()); - runners.push(get_build_libsurvive_runner(profile.clone())); + // profile per se can't be built, but we still need opencomp + if profile.can_be_built { + missing_deps.extend(get_missing_monado_deps()); + if profile.libsurvive_enabled { + missing_deps.extend(get_missing_libsurvive_deps()); + runners.push(get_build_libsurvive_runner(profile.clone())); + } + // if profile.basalt_enabled { + // missing_deps.extend(get_missing_basalt_deps()); + // runners.push(get_build_basalt_runner(profile.clone())); + // } + // if profile.mercury_enabled { + // missing_deps.extend(get_missing_mercury_deps()); + // runners.push(get_build_mercury_runner(profile.clone())); + // } + runners.push(get_build_monado_runner(profile.clone())); + // no listed deps for opencomp } - // if profile.basalt_enabled { - // missing_deps.extend(get_missing_basalt_deps()); - // runners.push(get_build_basalt_runner(profile.clone())); - // } - // if profile.mercury_enabled { - // missing_deps.extend(get_missing_mercury_deps()); - // runners.push(get_build_mercury_runner(profile.clone())); - // } - runners.push(get_build_monado_runner(profile.clone())); - // no listed deps for opencomp runners.push(get_build_opencomposite_runner(profile.clone())); if !missing_deps.is_empty() { self.dependencies_dialog.set_body( diff --git a/test/files/profile.json b/test/files/profile.json index a4caf9f..3aabfb2 100644 --- a/test/files/profile.json +++ b/test/files/profile.json @@ -13,5 +13,6 @@ "XRT_COMPOSITOR_COMPUTE": "1", "SURVIVE_GLOBALSCENESOLVER": "0" }, - "prefix": "/home/user/rex2prefix" + "prefix": "/home/user/rex2prefix", + "can_be_built": true }