feat: system profiles

This commit is contained in:
Gabriele Musco 2024-07-25 09:16:36 +02:00
parent 096cc888b2
commit 9a5b0638ea
4 changed files with 93 additions and 17 deletions

View file

@ -1,13 +1,6 @@
use crate::{
constants::CMD_NAME,
device_prober::PhysicalXRDevice,
paths::get_config_dir,
profile::Profile,
profiles::{
lighthouse::lighthouse_profile, openhmd::openhmd_profile, simulated::simulated_profile,
survive::survive_profile, wivrn::wivrn_profile, wmr::wmr_profile,
},
util::file_utils::get_writer,
constants::CMD_NAME, device_prober::PhysicalXRDevice, paths::get_config_dir, profile::Profile,
profiles::default_profiles, util::file_utils::get_writer,
};
use serde::{de::Error, Deserialize, Serialize};
use std::{
@ -96,14 +89,7 @@ impl Config {
}
pub fn profiles(&self) -> Vec<Profile> {
let mut profiles = vec![
lighthouse_profile(),
survive_profile(),
wivrn_profile(),
wmr_profile(),
openhmd_profile(),
simulated_profile(),
];
let mut profiles = default_profiles();
profiles.extend(self.user_profiles.clone());
profiles.sort_unstable_by(|a, b| a.name.cmp(&b.name));
profiles

View file

@ -1,6 +1,32 @@
use crate::profile::Profile;
use lighthouse::lighthouse_profile;
use openhmd::openhmd_profile;
use simulated::simulated_profile;
use survive::survive_profile;
use system_monado::system_monado_profile;
use system_wivrn::system_wivrn_profile;
use wivrn::wivrn_profile;
use wmr::wmr_profile;
pub mod lighthouse;
pub mod openhmd;
pub mod simulated;
pub mod survive;
pub mod system_monado;
pub mod system_wivrn;
pub mod wivrn;
pub mod wmr;
/// get the default built-in envision profiles
pub fn default_profiles() -> Vec<Profile> {
vec![
lighthouse_profile(),
survive_profile(),
wivrn_profile(),
wmr_profile(),
openhmd_profile(),
simulated_profile(),
system_monado_profile(),
system_wivrn_profile(),
]
}

View file

@ -0,0 +1,34 @@
use std::collections::HashMap;
use crate::{
constants::APP_NAME,
paths::{data_monado_path, data_opencomposite_path, SYSTEM_PREFIX},
profile::{LighthouseDriver, Profile, ProfileFeatures, XRServiceType},
};
pub fn system_monado_profile() -> Profile {
let mut environment: HashMap<String, String> = HashMap::new();
environment.insert("XRT_JSON_LOG".into(), "1".into());
environment.insert("XRT_COMPOSITOR_SCALE_PERCENTAGE".into(), "140".into());
environment.insert("XRT_COMPOSITOR_COMPUTE".into(), "1".into());
environment.insert("XRT_DEBUG_GUI".into(), "1".into());
environment.insert("XRT_CURATED_GUI".into(), "1".into());
environment.insert("U_PACING_APP_USE_MIN_FRAME_PERIOD".into(), "1".into());
Profile {
prefix: SYSTEM_PREFIX.into(),
uuid: "system-monado-default".into(),
name: format!("System Monado - {name} Default", name = APP_NAME),
can_be_built: false,
// does it apply to system profiles?
xrservice_path: data_monado_path(),
xrservice_type: XRServiceType::Monado,
// does it apply to system profiles?
opencomposite_path: data_opencomposite_path(),
features: ProfileFeatures::default(),
environment,
editable: false,
lighthouse_driver: LighthouseDriver::SteamVR,
pull_on_build: false,
..Default::default()
}
}

View file

@ -0,0 +1,30 @@
use std::collections::HashMap;
use crate::{
constants::APP_NAME,
paths::{data_opencomposite_path, data_wivrn_path, SYSTEM_PREFIX},
profile::{Profile, ProfileFeatures, XRServiceType},
};
pub fn system_wivrn_profile() -> Profile {
let mut environment: HashMap<String, String> = HashMap::new();
environment.insert("XRT_DEBUG_GUI".into(), "1".into());
environment.insert("XRT_CURATED_GUI".into(), "1".into());
environment.insert("U_PACING_APP_USE_MIN_FRAME_PERIOD".into(), "1".into());
Profile {
prefix: SYSTEM_PREFIX.into(),
uuid: "system-wivrn-default".into(),
name: format!("System WiVRn - {name} Default", name = APP_NAME),
can_be_built: false,
// does it apply to system profiles?
xrservice_path: data_wivrn_path(),
xrservice_type: XRServiceType::Wivrn,
// does it apply to system profiles?
opencomposite_path: data_opencomposite_path(),
features: ProfileFeatures::default(),
environment,
editable: false,
pull_on_build: false,
..Default::default()
}
}