From 5b49e2fc9fd0ddb2fbd866e62aed245b1de40747 Mon Sep 17 00:00:00 2001 From: Sapphire Date: Thu, 13 Feb 2025 20:12:20 -0600 Subject: [PATCH] Add xrizer support --- CMakeLists.txt | 4 ++-- common/wivrn_config.h.in | 2 +- server/active_runtime.cpp | 10 +++++----- server/active_runtime.h | 2 +- server/main.cpp | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 42e60b6c..07d39678 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,8 +41,8 @@ auto_option(WIVRN_USE_X264 "Enable x264 software encoder" AUTO) auto_option(WIVRN_USE_PIPEWIRE "Enable pipewire backend" AUTO) auto_option(WIVRN_USE_PULSEAUDIO "Enable pulseaudio backend" AUTO) -set(OPENCOMPOSITE_SEARCH_PATH "/usr/local/lib/OpenComposite:/usr/lib/OpenComposite:/opt/OpenComposite:/opt/opencomposite" - CACHE STRING "List of places to search for OpenComposite, separated by :") +set(OVR_COMPAT_SEARCH_PATH "/usr/local/lib/OpenComposite:/usr/lib/OpenComposite:/opt/OpenComposite:/opt/opencomposite:/opt/xrizer" + CACHE STRING "List of places to search for the OpenVR compatibility layer, separated by :") option(WIVRN_FEATURE_DEBUG_GUI "Enable Monado debug GUI" OFF) option(WIVRN_FEATURE_RENDERDOC "Support renderdoc" OFF) diff --git a/common/wivrn_config.h.in b/common/wivrn_config.h.in index 7be95372..519b6414 100644 --- a/common/wivrn_config.h.in +++ b/common/wivrn_config.h.in @@ -38,4 +38,4 @@ #cmakedefine01 WIVRN_USE_LIBKTX #define WIVRN_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" -#define OPENCOMPOSITE_SEARCH_PATH "@OPENCOMPOSITE_SEARCH_PATH@" +#define OVR_COMPAT_SEARCH_PATH "@OVR_COMPAT_SEARCH_PATH@" diff --git a/server/active_runtime.cpp b/server/active_runtime.cpp index f41ee803..0c438eb9 100644 --- a/server/active_runtime.cpp +++ b/server/active_runtime.cpp @@ -46,11 +46,11 @@ std::filesystem::path active_runtime::manifest_path() return std::filesystem::path(WIVRN_INSTALL_PREFIX) / install_location; } -std::filesystem::path active_runtime::opencomposite_path() +std::filesystem::path active_runtime::openvr_compat_path() { if (auto path = flatpak_key(flatpak::section::instance, "app-path")) return std::filesystem::path(*path) / "OpenComposite"; - for (auto path: std::ranges::split_view(std::string_view(OPENCOMPOSITE_SEARCH_PATH), std::string_view(":"))) + for (auto path: std::ranges::split_view(std::string_view(OVR_COMPAT_SEARCH_PATH), std::string_view(":"))) { if (auto res = std::string_view(path); std::filesystem::exists(res)) return res; @@ -91,15 +91,15 @@ active_runtime::active_runtime() : try { - auto opencomposite = opencomposite_path(); - if (not opencomposite.empty()) + auto ovr_compat = openvr_compat_path(); + if (not ovr_compat.empty()) { std::filesystem::path openvr_manifest = xdg_config_home() / "openvr/openvrpaths.vrpath"; std::filesystem::create_directories(openvr_manifest.parent_path()); move_file(openvr_manifest, backup_name(openvr_manifest)); nlohmann::json manifest; - manifest["runtime"] = {opencomposite.string()}; + manifest["runtime"] = {ovr_compat.string()}; manifest["version"] = 1; std::ofstream manifest_file(openvr_manifest.c_str()); manifest_file.exceptions(std::ofstream::failbit); diff --git a/server/active_runtime.h b/server/active_runtime.h index 5ee1cbe9..909e7087 100644 --- a/server/active_runtime.h +++ b/server/active_runtime.h @@ -37,6 +37,6 @@ public: ~active_runtime(); static std::filesystem::path manifest_path(); - static std::filesystem::path opencomposite_path(); + static std::filesystem::path openvr_compat_path(); }; } // namespace wivrn diff --git a/server/main.cpp b/server/main.cpp index be682556..9b2bc189 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -168,7 +168,7 @@ static std::string steam_command() if (app_path.starts_with("/var")) pressure_vessel_filesystems_rw += ":" + app_path; } - else if (auto p = active_runtime::opencomposite_path().string(); not p.empty()) + else if (auto p = active_runtime::openvr_compat_path().string(); not p.empty()) { // /usr cannot be shared in pressure vessel container if (p.starts_with("/usr"))