Add ipc crate; refactoring
This commit is contained in:
parent
cc51154455
commit
9133e2328d
|
@ -183,19 +183,15 @@ dependencies = [
|
|||
name = "alvr_common"
|
||||
version = "16.0.0-rc2"
|
||||
dependencies = [
|
||||
"alvr_filesystem",
|
||||
"backtrace",
|
||||
"dirs",
|
||||
"encoding_rs_io",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"msgbox",
|
||||
"parking_lot",
|
||||
"rand",
|
||||
"runas",
|
||||
"semver 1.0.4",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"settings-schema",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -234,6 +230,17 @@ dependencies = [
|
|||
"unic-langid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alvr_ipc"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"alvr_common",
|
||||
"bincode",
|
||||
"interprocess",
|
||||
"nalgebra",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alvr_launcher"
|
||||
version = "16.0.0-rc2"
|
||||
|
@ -252,6 +259,15 @@ dependencies = [
|
|||
"winres",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alvr_openvr_driver"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bindgen 0.59.1",
|
||||
"cc",
|
||||
"interprocess",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alvr_server"
|
||||
version = "16.0.0-rc2"
|
||||
|
@ -433,6 +449,23 @@ version = "1.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46016233fc1bb55c23b856fe556b7db6ccd05119a0a392e04f0b3b7c79058f16"
|
||||
|
||||
[[package]]
|
||||
name = "async-channel"
|
||||
version = "1.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319"
|
||||
dependencies = [
|
||||
"concurrent-queue",
|
||||
"event-listener",
|
||||
"futures-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-task"
|
||||
version = "4.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0"
|
||||
|
||||
[[package]]
|
||||
name = "atk"
|
||||
version = "0.9.0"
|
||||
|
@ -459,6 +492,12 @@ dependencies = [
|
|||
"system-deps",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atomic-waker"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a"
|
||||
|
||||
[[package]]
|
||||
name = "atomic_refcell"
|
||||
version = "0.1.7"
|
||||
|
@ -608,6 +647,20 @@ dependencies = [
|
|||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "blocking"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c5e170dbede1f740736619b776d7251cb1b9095c435c34d8ca9f57fcd2f335e9"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"async-task",
|
||||
"atomic-waker",
|
||||
"fastrand",
|
||||
"futures-lite",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.7.0"
|
||||
|
@ -646,6 +699,12 @@ version = "1.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
|
||||
|
||||
[[package]]
|
||||
name = "cache-padded"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba"
|
||||
|
||||
[[package]]
|
||||
name = "cairo-rs"
|
||||
version = "0.9.1"
|
||||
|
@ -854,6 +913,15 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "concurrent-queue"
|
||||
version = "1.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3"
|
||||
dependencies = [
|
||||
"cache-padded",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "console_log"
|
||||
version = "0.2.0"
|
||||
|
@ -1475,6 +1543,12 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "event-listener"
|
||||
version = "2.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59"
|
||||
|
||||
[[package]]
|
||||
name = "exec"
|
||||
version = "0.3.1"
|
||||
|
@ -1494,6 +1568,15 @@ dependencies = [
|
|||
"backtrace",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b394ed3d285a429378d3b384b9eb1285267e7df4b166df24b7a6939a04dc392e"
|
||||
dependencies = [
|
||||
"instant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fern"
|
||||
version = "0.6.0"
|
||||
|
@ -1665,6 +1748,21 @@ version = "0.3.17"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377"
|
||||
|
||||
[[package]]
|
||||
name = "futures-lite"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"memchr",
|
||||
"parking",
|
||||
"pin-project-lite",
|
||||
"waker-fn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.17"
|
||||
|
@ -2360,6 +2458,23 @@ dependencies = [
|
|||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "interprocess"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c58ec7fbda1df9a93f587b780659db3c99f61f4be27f9c82c9b37684ffd0366"
|
||||
dependencies = [
|
||||
"blocking",
|
||||
"cfg-if 1.0.0",
|
||||
"futures",
|
||||
"intmap",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"spinning",
|
||||
"thiserror",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "intl-memoizer"
|
||||
version = "0.5.1"
|
||||
|
@ -2380,6 +2495,12 @@ dependencies = [
|
|||
"unic-langid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "intmap"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e50930385956f6c4a0b99f3dd654adcc40788456c36e17c5b20e1d1ceb523ec6"
|
||||
|
||||
[[package]]
|
||||
name = "ipnet"
|
||||
version = "2.3.1"
|
||||
|
@ -3302,6 +3423,12 @@ dependencies = [
|
|||
"system-deps",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.11.2"
|
||||
|
@ -4249,6 +4376,15 @@ version = "0.5.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
||||
|
||||
[[package]]
|
||||
name = "spinning"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d4f0e86297cad2658d92a707320d87bf4e6ae1050287f51d19b67ef3f153a7b"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spirv"
|
||||
version = "0.2.0+1.5.4"
|
||||
|
@ -4891,6 +5027,12 @@ dependencies = [
|
|||
"exec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "waker-fn"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.3.2"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||
|
|
|
@ -9,7 +9,7 @@ mod audio;
|
|||
|
||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
||||
|
||||
use alvr_common::{logging, prelude::*, ALVR_VERSION};
|
||||
use alvr_common::{prelude::*, ALVR_VERSION};
|
||||
use alvr_sockets::{HeadsetInfoPacket, PrivateIdentity};
|
||||
use jni::{
|
||||
objects::{JClass, JObject, JString},
|
||||
|
@ -49,7 +49,7 @@ pub extern "system" fn Java_com_polygraphene_alvr_OvrActivity_createIdentity(
|
|||
_: JClass,
|
||||
jidentity: JObject,
|
||||
) {
|
||||
logging::show_err(|| -> StrResult {
|
||||
alvr_common::show_err(|| -> StrResult {
|
||||
let identity = alvr_sockets::create_identity(None)?;
|
||||
|
||||
let jhostname = trace_err!(env.new_string(identity.hostname))?.into();
|
||||
|
@ -112,7 +112,7 @@ pub unsafe extern "system" fn Java_com_polygraphene_alvr_OvrActivity_onCreateNat
|
|||
|
||||
legacySend = Some(legacy_send);
|
||||
|
||||
logging::show_err(|| -> StrResult {
|
||||
alvr_common::show_err(|| -> StrResult {
|
||||
let result = onCreate(
|
||||
env.get_native_interface() as _,
|
||||
*activity as _,
|
||||
|
@ -172,7 +172,7 @@ pub unsafe extern "system" fn Java_com_polygraphene_alvr_OvrActivity_onResumeNat
|
|||
jscreen_surface: JObject,
|
||||
dark_mode: u8,
|
||||
) {
|
||||
logging::show_err(|| -> StrResult {
|
||||
alvr_common::show_err(|| -> StrResult {
|
||||
let java_vm = trace_err!(env.get_java_vm())?;
|
||||
let activity_ref = trace_err!(env.new_global_ref(jactivity))?;
|
||||
let nal_class_ref = trace_err!(env.new_global_ref(nal_class))?;
|
||||
|
|
|
@ -6,5 +6,5 @@ pub fn init_logging() {
|
|||
.with_min_level(log::Level::Info),
|
||||
);
|
||||
|
||||
alvr_common::logging::set_panic_hook();
|
||||
alvr_common::set_panic_hook();
|
||||
}
|
||||
|
|
|
@ -6,24 +6,17 @@ license = "MIT"
|
|||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
# Basic utilities
|
||||
lazy_static = "1"
|
||||
parking_lot = "0.11"
|
||||
# Logging
|
||||
settings-schema = { path = "../settings-schema", features = [
|
||||
"rename_camel_case",
|
||||
] }
|
||||
|
||||
backtrace = "0.3"
|
||||
lazy_static = "1"
|
||||
log = "0.4"
|
||||
# Serialization
|
||||
parking_lot = "0.11"
|
||||
semver = { version = "1", features = ['serde'] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
# Miscellaneous
|
||||
encoding_rs_io = "0.1"
|
||||
rand = "0.8"
|
||||
semver = { version = "1", features = ['serde'] }
|
||||
|
||||
[target.'cfg(not(target_os = "android"))'.dependencies]
|
||||
alvr_filesystem = { path = "../filesystem" }
|
||||
dirs = "3"
|
||||
runas = "0.2"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
msgbox = "0.6"
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
use settings_schema::{EntryData, SettingsSchema};
|
||||
|
||||
#[derive(SettingsSchema, Serialize, Deserialize, PartialEq, Default, Clone)]
|
||||
pub struct Fov {
|
||||
#[schema(min = 0., max = 90., step = 0.1, gui = "UpDown")]
|
||||
pub left: f32,
|
||||
|
||||
#[schema(min = 0., max = 90., step = 0.1, gui = "UpDown")]
|
||||
pub right: f32,
|
||||
|
||||
#[schema(min = 0., max = 90., step = 0.1, gui = "UpDown")]
|
||||
pub top: f32,
|
||||
|
||||
#[schema(min = 0., max = 90., step = 0.1, gui = "UpDown")]
|
||||
pub bottom: f32,
|
||||
}
|
|
@ -1,4 +1,8 @@
|
|||
pub mod logging;
|
||||
mod data;
|
||||
mod logging;
|
||||
|
||||
pub use data::*;
|
||||
pub use logging::*;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use semver::{BuildMetadata, Prerelease, Version};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use alvr_session::{Fov, FoveatedRenderingDesc};
|
||||
use alvr_common::Fov;
|
||||
use alvr_session::FoveatedRenderingDesc;
|
||||
use wgpu::{CommandEncoder, TextureView};
|
||||
|
||||
pub enum FrDirection {
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::{
|
|||
theme,
|
||||
translation::{self, SharedTranslation, TranslationBundle},
|
||||
};
|
||||
use alvr_common::logging::Event;
|
||||
use alvr_common::Event;
|
||||
use alvr_session::{SessionDesc, Theme};
|
||||
use basic_components::ModalResponse;
|
||||
use egui::{Align, CentralPanel, ComboBox, CtxRef, Layout, ScrollArea, SidePanel, Ui};
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
[package]
|
||||
name = "alvr_ipc"
|
||||
version = "0.1.0"
|
||||
authors = ["alvr-org"]
|
||||
license = "MIT"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
alvr_common = { path = "../../common" }
|
||||
|
||||
bincode = "1"
|
||||
interprocess = "1"
|
||||
nalgebra = "0.29"
|
||||
serde = { version = "1", features = ["derive"] }
|
|
@ -0,0 +1,80 @@
|
|||
mod packets;
|
||||
|
||||
pub use packets::*;
|
||||
|
||||
use alvr_common::prelude::*;
|
||||
use interprocess::local_socket::{LocalSocketListener, LocalSocketStream};
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use std::{marker::PhantomData, thread, time::Duration};
|
||||
|
||||
pub struct IpcSender<S> {
|
||||
socket: LocalSocketStream,
|
||||
_phantom: PhantomData<S>,
|
||||
}
|
||||
|
||||
impl<S: Serialize> IpcSender<S> {
|
||||
pub fn send(&mut self, message: &S) -> StrResult {
|
||||
trace_err!(bincode::serialize_into(&mut self.socket, message))
|
||||
}
|
||||
}
|
||||
|
||||
pub struct IpcReceiver<R> {
|
||||
socket: LocalSocketStream,
|
||||
_phantom: PhantomData<R>,
|
||||
}
|
||||
|
||||
impl<R: DeserializeOwned> IpcReceiver<R> {
|
||||
pub fn receive(&mut self) -> StrResult<R> {
|
||||
trace_err!(bincode::deserialize_from(&mut self.socket))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ipc_connect<S, R>(name: &str) -> StrResult<(IpcSender<S>, IpcReceiver<R>)> {
|
||||
let sender = trace_err!(LocalSocketStream::connect(format!(
|
||||
"/tmp/alvr_{}_out.sock",
|
||||
name
|
||||
)))?;
|
||||
let receiver = trace_err!(trace_err!(LocalSocketListener::bind(format!(
|
||||
"/tmp/alvr_{}_in.sock",
|
||||
name
|
||||
)))?
|
||||
.accept())?;
|
||||
|
||||
Ok((
|
||||
IpcSender {
|
||||
socket: sender,
|
||||
_phantom: PhantomData,
|
||||
},
|
||||
IpcReceiver {
|
||||
socket: receiver,
|
||||
_phantom: PhantomData,
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
pub fn ipc_listen<S, R>(name: &str) -> StrResult<(IpcSender<S>, IpcReceiver<R>)> {
|
||||
let receiver = trace_err!(trace_err!(LocalSocketListener::bind(format!(
|
||||
"/tmp/alvr_{}_out.sock",
|
||||
name
|
||||
)))?
|
||||
.accept())?;
|
||||
|
||||
// Wait for the client to setup the listener
|
||||
thread::sleep(Duration::from_millis(100));
|
||||
|
||||
let sender = trace_err!(LocalSocketStream::connect(format!(
|
||||
"/tmp/alvr_{}_in.sock",
|
||||
name
|
||||
)))?;
|
||||
|
||||
Ok((
|
||||
IpcSender {
|
||||
socket: sender,
|
||||
_phantom: PhantomData,
|
||||
},
|
||||
IpcReceiver {
|
||||
socket: receiver,
|
||||
_phantom: PhantomData,
|
||||
},
|
||||
))
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
use alvr_common::Fov;
|
||||
use nalgebra::{UnitQuaternion, Vector3};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::time::Duration;
|
||||
|
||||
pub enum TrackerType {
|
||||
LeftHand,
|
||||
RightHand,
|
||||
Generic(usize),
|
||||
}
|
||||
|
||||
pub enum ServerPacket {
|
||||
Settings {
|
||||
width: u32,
|
||||
height: u32,
|
||||
fov: [Fov; 2],
|
||||
ipd_m: f32,
|
||||
fps: f32,
|
||||
},
|
||||
HeadTrackingData {
|
||||
position: Vector3<f32>,
|
||||
orientation: UnitQuaternion<f32>,
|
||||
target_time_offset: Duration, // controls black pull
|
||||
phase_shift: Duration, // adjusts latency, always positive
|
||||
},
|
||||
TrackerData {
|
||||
tracker_type: TrackerType,
|
||||
position: Vector3<f32>,
|
||||
orientation: UnitQuaternion<f32>,
|
||||
linear_velocity: Vector3<f32>,
|
||||
angular_velocity: Vector3<f32>,
|
||||
target_time_offset: Duration,
|
||||
},
|
||||
LayersConsumed,
|
||||
Restart,
|
||||
}
|
||||
|
||||
// Note: this can be reused by the vulkan layer
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct Layer {
|
||||
views: Vec<u64>, // Windows HANDLEs or file descriptors
|
||||
orientation: UnitQuaternion<f32>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub enum DriverPacket {
|
||||
Layers(Vec<Layer>),
|
||||
}
|
|
@ -2,8 +2,8 @@ mod color_correction;
|
|||
mod compositing;
|
||||
mod convert;
|
||||
|
||||
use alvr_common::prelude::*;
|
||||
use alvr_session::{ColorCorrectionDesc, Fov, FoveatedRenderingDesc};
|
||||
use alvr_common::{prelude::*, Fov};
|
||||
use alvr_session::{ColorCorrectionDesc, FoveatedRenderingDesc};
|
||||
use color_correction::ColorCorrectionPass;
|
||||
use compositing::{CompositingPass, Layer};
|
||||
use graphics::{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use alvr_common::{logging, prelude::*};
|
||||
use alvr_common::prelude::*;
|
||||
use alvr_filesystem as afs;
|
||||
use serde_json as json;
|
||||
use std::{
|
||||
|
@ -196,7 +196,7 @@ fn try_close_steamvr_gracefully() {
|
|||
pub fn restart_steamvr() {
|
||||
try_close_steamvr_gracefully();
|
||||
|
||||
if logging::show_err(maybe_register_alvr_driver()).is_some() {
|
||||
if alvr_common::show_err(maybe_register_alvr_driver()).is_some() {
|
||||
maybe_launch_steamvr();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
mod commands;
|
||||
|
||||
use alvr_common::{logging, prelude::*};
|
||||
use alvr_common::prelude::*;
|
||||
use alvr_filesystem as afs;
|
||||
use druid::{
|
||||
commands::CLOSE_WINDOW,
|
||||
|
@ -76,7 +76,7 @@ fn launcher_lifecycle(handle: ExtEventSink, window_id: WindowId) {
|
|||
|
||||
// try to launch SteamVR only one time automatically
|
||||
if !tried_steamvr_launch {
|
||||
if logging::show_err(commands::maybe_register_alvr_driver()).is_some() {
|
||||
if alvr_common::show_err(commands::maybe_register_alvr_driver()).is_some() {
|
||||
if commands::is_steamvr_running() {
|
||||
commands::kill_steamvr();
|
||||
thread::sleep(Duration::from_secs(2))
|
||||
|
@ -199,7 +199,7 @@ fn make_window() -> StrResult {
|
|||
.openvr_driver_root_dir;
|
||||
|
||||
if driver_dir.to_str().filter(|s| s.is_ascii()).is_none() {
|
||||
logging::show_e_blocking(format!(
|
||||
alvr_common::show_e_blocking(format!(
|
||||
"The path of this folder ({}) contains non ASCII characters. Please move it somewhere else (for example in C:\\Users\\Public\\Documents).",
|
||||
driver_dir.to_string_lossy(),
|
||||
));
|
||||
|
@ -252,7 +252,7 @@ fn main() {
|
|||
Some(flag) if flag == "--restart-steamvr" => commands::restart_steamvr(),
|
||||
Some(flag) if flag == "--update" => commands::invoke_installer(),
|
||||
Some(_) | None => {
|
||||
logging::show_err_blocking(make_window());
|
||||
alvr_common::show_err_blocking(make_window());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ use crate::{
|
|||
RESTART_NOTIFIER, SESSION_MANAGER,
|
||||
};
|
||||
use alvr_audio::{AudioDevice, AudioDeviceType};
|
||||
use alvr_common::{logging, prelude::*};
|
||||
use alvr_common::prelude::*;
|
||||
use alvr_session::{AudioDeviceId, CodecType, FrameSize, OpenvrConfig};
|
||||
use alvr_sockets::{
|
||||
spawn_cancelable, ClientConfigPacket, ClientControlPacket, ControlSocketReceiver,
|
||||
|
@ -714,7 +714,7 @@ pub async fn connection_lifecycle_loop() {
|
|||
loop {
|
||||
tokio::join!(
|
||||
async {
|
||||
logging::show_err(connection_pipeline().await);
|
||||
alvr_common::show_err(connection_pipeline().await);
|
||||
|
||||
// let any running task or socket shutdown
|
||||
time::sleep(CLEANUP_PAUSE).await;
|
||||
|
|
|
@ -11,7 +11,7 @@ mod bindings {
|
|||
}
|
||||
use bindings::*;
|
||||
|
||||
use alvr_common::{logging, prelude::*};
|
||||
use alvr_common::prelude::*;
|
||||
use alvr_filesystem::{self as afs, Layout};
|
||||
use alvr_session::{ClientConnectionDesc, SessionManager};
|
||||
use lazy_static::lazy_static;
|
||||
|
@ -215,7 +215,7 @@ fn init() {
|
|||
}
|
||||
|
||||
let web_server =
|
||||
logging::show_err_async(web_server::web_server(log_sender, events_sender));
|
||||
alvr_common::show_err_async(web_server::web_server(log_sender, events_sender));
|
||||
|
||||
tokio::select! {
|
||||
_ = web_server => (),
|
||||
|
@ -223,7 +223,7 @@ fn init() {
|
|||
}
|
||||
});
|
||||
|
||||
thread::spawn(|| logging::show_err(ui_thread()));
|
||||
thread::spawn(|| alvr_common::show_err(ui_thread()));
|
||||
}
|
||||
|
||||
unsafe {
|
||||
|
@ -241,6 +241,7 @@ fn init() {
|
|||
};
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn HmdDriverFactory(
|
||||
interface_name: *const c_char,
|
||||
|
@ -261,7 +262,7 @@ pub unsafe extern "C" fn HmdDriverFactory(
|
|||
COLOR_CORRECTION_CSO_LEN = COLOR_CORRECTION_CSO.len() as _;
|
||||
|
||||
unsafe extern "C" fn log_error(string_ptr: *const c_char) {
|
||||
logging::show_e(CStr::from_ptr(string_ptr).to_string_lossy());
|
||||
alvr_common::show_e(CStr::from_ptr(string_ptr).to_string_lossy());
|
||||
}
|
||||
|
||||
unsafe fn log(level: log::Level, string_ptr: *const c_char) {
|
||||
|
@ -294,7 +295,7 @@ pub unsafe extern "C" fn HmdDriverFactory(
|
|||
}
|
||||
|
||||
pub extern "C" fn driver_ready_idle(set_default_chap: bool) {
|
||||
logging::show_err(alvr_commands::apply_driver_paths_backup(
|
||||
alvr_common::show_err(alvr_commands::apply_driver_paths_backup(
|
||||
FILESYSTEM_LAYOUT.openvr_driver_root_dir.clone(),
|
||||
));
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
use crate::{FILESYSTEM_LAYOUT, SESSION_MANAGER};
|
||||
use alvr_common::logging;
|
||||
use alvr_common::{Event, EventSeverity, Raw};
|
||||
use fern::Dispatch;
|
||||
use log::LevelFilter;
|
||||
use logging::{Event, EventSeverity, Raw};
|
||||
use std::fs;
|
||||
use tokio::sync::broadcast::Sender;
|
||||
|
||||
|
@ -69,5 +68,5 @@ pub fn init_logging(log_sender: Sender<String>, events_sender: Sender<String>) {
|
|||
.apply()
|
||||
.unwrap();
|
||||
|
||||
logging::set_panic_hook();
|
||||
alvr_common::set_panic_hook();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{graphics_info, ClientListAction, FILESYSTEM_LAYOUT, SESSION_MANAGER};
|
||||
use alvr_common::{logging, prelude::*, ALVR_VERSION};
|
||||
use alvr_common::{prelude::*, ALVR_VERSION};
|
||||
use bytes::Buf;
|
||||
use futures::SinkExt;
|
||||
use headers::HeaderMapExt;
|
||||
|
@ -306,7 +306,7 @@ pub async fn web_server(
|
|||
async move {
|
||||
let res = http_api(request, log_sender, events_sender).await;
|
||||
if let Err(e) = &res {
|
||||
logging::show_e(e);
|
||||
alvr_common::show_e(e);
|
||||
}
|
||||
|
||||
res
|
||||
|
|
|
@ -16,21 +16,6 @@ pub enum FrameSize {
|
|||
},
|
||||
}
|
||||
|
||||
#[derive(SettingsSchema, Serialize, Deserialize, PartialEq, Default, Clone)]
|
||||
pub struct Fov {
|
||||
#[schema(min = 0., max = 90., step = 0.1, gui = "UpDown")]
|
||||
pub left: f32,
|
||||
|
||||
#[schema(min = 0., max = 90., step = 0.1, gui = "UpDown")]
|
||||
pub right: f32,
|
||||
|
||||
#[schema(min = 0., max = 90., step = 0.1, gui = "UpDown")]
|
||||
pub top: f32,
|
||||
|
||||
#[schema(min = 0., max = 90., step = 0.1, gui = "UpDown")]
|
||||
pub bottom: f32,
|
||||
}
|
||||
|
||||
#[derive(SettingsSchema, Serialize, Deserialize, Clone)]
|
||||
pub enum MediacodecDataType {
|
||||
Float(f32),
|
||||
|
|
Loading…
Reference in New Issue