Merge branch 'simulated-profile' into 'main'

feat: add simulated profile

See merge request gabmus/envision!33
This commit is contained in:
GabMus 2024-01-14 22:20:37 +00:00
commit 24d07b94b2
5 changed files with 50 additions and 0 deletions

View file

@ -40,6 +40,16 @@ fn monado_deps() -> Vec<Dependency> {
]),
},
dep_glslang_validator(),
Dependency {
name: "sdl2".into(),
dep_type: DepType::SharedObject,
filename: "libSDL2.so".into(),
packages: HashMap::from([
(LinuxDistro::Arch, "sdl2".into()),
(LinuxDistro::Debian, "libsdl2".into()),
(LinuxDistro::Fedora, "SDL2".into()),
]),
},
]
}

View file

@ -14,6 +14,7 @@ pub static ENV_VAR_DESCRIPTIONS: Map<&str, &str> = phf_map! {
"XRT_DEBUG_GUI" => "Set to 1 to enable the Monado debug UI.",
"XRT_CURATED_GUI" => "Set to 1 to enable the Monado preview UI. Requires XRT_DEBUG_GUI=1 to work.",
"XRT_JSON_LOG" => "Set to 1 to enable JSON logging for Monado. This enables better log visualization and log level filtering.",
"QWERTY_ENABLE" => "Set to 1 to enable QWERTY Simulation driver. This enables simulated driver that allows you to use Monado without HMD and controllers. It's also possible to mix and match different profiles with this.",
"LH_DRIVER" => "Lighthouse driver, this overrides the \"Lighthouse driver option in the profile\"; Valid options are: \"vive\" for the default built-in driver, \"survive\" for Libsurvive, \"steamvr\" for the SteamVR based implementation.",
"LH_LOG" => "Lighthouse log level. Can be one of: \"trace\", \"debug\", \"info\", \"warn\", \"error\".",
"LIGHTHOUSE_LOG" => "Lighthouse driver log level. Can be one of: \"trace\", \"debug\", \"info\", \"warn\", \"error\"."

View file

@ -1,5 +1,6 @@
pub mod lighthouse;
pub mod openhmd;
pub mod simulated;
pub mod survive;
pub mod wivrn;
pub mod wmr;

36
src/profiles/simulated.rs Normal file
View file

@ -0,0 +1,36 @@
use crate::{
constants::APP_NAME,
paths::{data_monado_path, data_opencomposite_path, get_data_dir},
profile::{Profile, ProfileFeatures, XRServiceType},
};
use std::collections::HashMap;
pub fn simulated_profile() -> Profile {
let data_dir = get_data_dir();
let prefix = format!("{data}/prefixes/simulated_default", data = data_dir);
let mut environment: HashMap<String, String> = HashMap::new();
environment.insert("QWERTY_ENABLE".into(), "1".into());
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());
environment.insert(
"LD_LIBRARY_PATH".into(),
format!("{pfx}/lib:{pfx}/lib64", pfx = prefix),
);
Profile {
uuid: "simulated-default".into(),
name: format!("Simulated Driver - {name} Default", name = APP_NAME),
xrservice_path: data_monado_path(),
xrservice_type: XRServiceType::Monado,
opencomposite_path: data_opencomposite_path(),
features: ProfileFeatures::default(),
environment,
prefix,
can_be_built: true,
editable: false,
..Default::default()
}
}

View file

@ -40,6 +40,7 @@ use crate::paths::{get_data_dir, get_ipc_file_path};
use crate::profile::{Profile, XRServiceType};
use crate::profiles::lighthouse::lighthouse_profile;
use crate::profiles::openhmd::openhmd_profile;
use crate::profiles::simulated::simulated_profile;
use crate::profiles::survive::survive_profile;
use crate::profiles::wivrn::wivrn_profile;
use crate::profiles::wmr::wmr_profile;
@ -256,6 +257,7 @@ impl App {
wivrn_profile(),
wmr_profile(),
openhmd_profile(),
simulated_profile(),
];
profiles.extend(config.user_profiles.clone());
profiles.sort_unstable_by(|a, b| a.name.cmp(&b.name));