feat: rename monado to xrservice internally, profile xrservice_type can be monado or wivrn

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

View file

@ -5,7 +5,7 @@ pub fn get_build_monado_runner(profile: Profile) -> Runner {
None, None,
format!("{sysdata}/scripts/build_monado.sh", sysdata = PKG_DATA_DIR), format!("{sysdata}/scripts/build_monado.sh", sysdata = PKG_DATA_DIR),
vec![ vec![
profile.monado_path, profile.xrservice_path,
profile.prefix, profile.prefix,
] ]
); );

View file

@ -6,10 +6,17 @@ use expect_dialog::ExpectDialog;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::{collections::HashMap, fmt::Display, fs::File, io::BufReader}; use std::{collections::HashMap, fmt::Display, fs::File, io::BufReader};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum XRServiceType {
Monado,
Wivrn,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Profile { pub struct Profile {
pub name: String, pub name: String,
pub monado_path: String, pub xrservice_path: String,
pub xrservice_type: XRServiceType,
pub opencomposite_path: String, pub opencomposite_path: String,
pub libsurvive_path: Option<String>, pub libsurvive_path: Option<String>,
pub basalt_path: Option<String>, pub basalt_path: Option<String>,
@ -62,13 +69,15 @@ impl Profile {
mod tests { mod tests {
use std::collections::HashMap; use std::collections::HashMap;
use crate::profile::XRServiceType;
use super::Profile; use super::Profile;
#[test] #[test]
fn profile_can_be_loaded() { fn profile_can_be_loaded() {
let profile = Profile::load_profile(&"./test/files/profile.json".to_string()); let profile = Profile::load_profile(&"./test/files/profile.json".to_string());
assert_eq!(profile.name, "Demo profile"); assert_eq!(profile.name, "Demo profile");
assert_eq!(profile.monado_path, "/home/user/monado"); assert_eq!(profile.xrservice_path, "/home/user/monado");
assert_eq!(profile.opencomposite_path, "/home/user/opencomposite"); assert_eq!(profile.opencomposite_path, "/home/user/opencomposite");
assert_eq!(profile.prefix, "/home/user/rex2prefix"); assert_eq!(profile.prefix, "/home/user/rex2prefix");
assert_eq!( assert_eq!(
@ -96,7 +105,8 @@ mod tests {
env.insert("XRT_COMPOSITOR_COMPUTE".into(), "1".into()); env.insert("XRT_COMPOSITOR_COMPUTE".into(), "1".into());
let p = Profile { let p = Profile {
name: "Demo profile".into(), name: "Demo profile".into(),
monado_path: String::from("/home/user/monado"), xrservice_path: String::from("/home/user/monado"),
xrservice_type: XRServiceType::Monado,
opencomposite_path: String::from("/home/user/opencomposite"), opencomposite_path: String::from("/home/user/opencomposite"),
libsurvive_path: Some(String::from("/home/user/libsurvive")), libsurvive_path: Some(String::from("/home/user/libsurvive")),
basalt_path: None, basalt_path: None,

View file

@ -1,4 +1,4 @@
use crate::{constants::APP_NAME, paths::{data_opencomposite_path, SYSTEM_PREFIX}, profile::Profile}; use crate::{constants::APP_NAME, paths::{data_opencomposite_path, SYSTEM_PREFIX}, profile::{Profile, XRServiceType}};
use std::collections::HashMap; use std::collections::HashMap;
pub fn system_valve_index_profile() -> Profile { pub fn system_valve_index_profile() -> Profile {
@ -10,7 +10,8 @@ pub fn system_valve_index_profile() -> Profile {
Profile { Profile {
name: format!("Valve Index (System) - {name} Default", name = APP_NAME), name: format!("Valve Index (System) - {name} Default", name = APP_NAME),
opencomposite_path: data_opencomposite_path(), opencomposite_path: data_opencomposite_path(),
monado_path: "".into(), xrservice_path: "".into(),
xrservice_type: XRServiceType::Monado,
libsurvive_path: None, libsurvive_path: None,
basalt_path: None, basalt_path: None,
mercury_path: None, mercury_path: None,

View file

@ -1,4 +1,4 @@
use crate::{constants::APP_NAME, file_utils::get_data_dir, profile::Profile, paths::{data_monado_path, data_opencomposite_path, data_libsurvive_path}}; use crate::{constants::APP_NAME, file_utils::get_data_dir, profile::{Profile, XRServiceType}, paths::{data_monado_path, data_opencomposite_path, data_libsurvive_path}};
use std::collections::HashMap; use std::collections::HashMap;
pub fn valve_index_profile() -> Profile { pub fn valve_index_profile() -> Profile {
@ -12,7 +12,8 @@ pub fn valve_index_profile() -> Profile {
environment.insert("LD_LIBRARY_PATH".into(), format!("{pfx}/lib", pfx = prefix)); environment.insert("LD_LIBRARY_PATH".into(), format!("{pfx}/lib", pfx = prefix));
Profile { Profile {
name: format!("Valve Index - {name} Default", name = APP_NAME), name: format!("Valve Index - {name} Default", name = APP_NAME),
monado_path: data_monado_path(), xrservice_path: data_monado_path(),
xrservice_type: XRServiceType::Monado,
opencomposite_path: data_opencomposite_path(), opencomposite_path: data_opencomposite_path(),
libsurvive_path: Some(data_libsurvive_path()), libsurvive_path: Some(data_libsurvive_path()),
basalt_path: None, basalt_path: None,

View file

@ -1,6 +1,7 @@
{ {
"name": "Demo profile", "name": "Demo profile",
"monado_path": "/home/user/monado", "xrservice_path": "/home/user/monado",
"xrservice_type": "Monado",
"opencomposite_path": "/home/user/opencomposite", "opencomposite_path": "/home/user/opencomposite",
"libsurvive_path": "/home/user/libsurvive", "libsurvive_path": "/home/user/libsurvive",
"basalt_path": null, "basalt_path": null,