diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml
index d6ad8099..df2800ed 100644
--- a/.github/workflows/Build.yml
+++ b/.github/workflows/Build.yml
@@ -153,11 +153,13 @@ jobs:
nix-test:
name: Test Nix package and devshell
runs-on: ubuntu-24.04
+ if: ${{ vars.APK_ONLY == '' }}
+
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
-
+
- uses: cachix/install-nix-action@v31
- run: nix flake check
- run: nix build
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index dddc5896..7f9b6505 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -88,6 +88,8 @@
+
+
diff --git a/client/hardware.cpp b/client/hardware.cpp
index c558deff..745be7bf 100644
--- a/client/hardware.cpp
+++ b/client/hardware.cpp
@@ -348,6 +348,24 @@ std::pair controller_offset(std::string_view profile, xr::
default:
break;
}
+ else if (profile == "meta-quest-touch-plus")
+ {
+ switch (space)
+ {
+ case xr::spaces::grip_left:
+ case xr::spaces::grip_right:
+ return {{0, -0.010, -0.025}, glm::angleAxis(glm::radians(-12.f), glm::vec3{1, 0, 0})};
+
+ case xr::spaces::aim_left:
+ return {{0, 0, 0.03}, {1, 0, 0, 0}};
+
+ case xr::spaces::aim_right:
+ return {{0, 0, 0.03}, {1, 0, 0, 0}};
+
+ default:
+ break;
+ }
+ }
else if (profile == "htc-vive-focus-3")
switch (space)
{
diff --git a/client/scenes/lobby.cpp b/client/scenes/lobby.cpp
index 727bdbd7..38403abc 100644
--- a/client/scenes/lobby.cpp
+++ b/client/scenes/lobby.cpp
@@ -966,6 +966,12 @@ void scenes::lobby::render(const XrFrameState & frame_state)
.depthMask = true,
.compareOp = application::get_config().passthrough_enabled ? XR_COMPARE_OP_LESS_FB : XR_COMPARE_OP_LESS_OR_EQUAL_FB,
};
+ XrCompositionLayerDepthTestFB layer_depth_test_bg{
+ .type = XR_TYPE_COMPOSITION_LAYER_DEPTH_TEST_FB,
+ .next = nullptr,
+ .depthMask = true,
+ .compareOp = XR_COMPARE_OP_ALWAYS_FB,
+ };
// if (composition_layer_depth_test_supported or not application::get_config().passthrough_enabled)
layers_with_z_index.emplace_back(constants::lobby::zindex_lobby, reinterpret_cast(&lobby_layer));
@@ -977,7 +983,7 @@ void scenes::lobby::render(const XrFrameState & frame_state)
if (composition_layer_depth_test_supported)
{
- lobby_layer.next = &layer_depth_test;
+ lobby_layer.next = &layer_depth_test_bg;
for (auto & [z_index, layer]: imgui_layers)
{
diff --git a/client/xr/passthrough.cpp b/client/xr/passthrough.cpp
index 8e7dc568..dbbc0823 100644
--- a/client/xr/passthrough.cpp
+++ b/client/xr/passthrough.cpp
@@ -51,6 +51,7 @@ xr::passthrough_layer_fb::passthrough_layer_fb(instance & inst, session & s, con
static XrPassthroughFB create_passthrough_fb(xr::instance & inst, xr::session & s)
{
PFN_xrCreatePassthroughFB xrCreatePassthroughFB = inst.get_proc("xrCreatePassthroughFB");
+ xrDestroyPassthroughFB = inst.get_proc("xrDestroyPassthroughFB");
XrPassthroughFB id;
XrPassthroughCreateInfoFB info{
@@ -71,7 +72,6 @@ xr::passthrough_fb::passthrough_fb(instance & inst, session & s) :
.purpose = XR_PASSTHROUGH_LAYER_PURPOSE_RECONSTRUCTION_FB,
})
{
- xrDestroyPassthroughFB = inst.get_proc("xrDestroyPassthroughFB");
xrPassthroughStartFB = inst.get_proc("xrPassthroughStartFB");
xrPassthroughPauseFB = inst.get_proc("xrPassthroughPauseFB");
xrPassthroughLayerPauseFB = inst.get_proc("xrPassthroughLayerPauseFB");
diff --git a/docs/configuration.md b/docs/configuration.md
index 5e52937f..ffc1ec76 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -1,6 +1,12 @@
# Configurable items
-Configuration is done on server side, in `$XDG_CONFIG_HOME/wivrn/config.json` or if `$XDG_CONFIG_HOME` is not set, `$HOME/.config/wivrn/config.json`.
+Configuration is done on server side.
+Files are read from
+- `/usr/share/wivrn/config.json` (where `/usr` is selected at configure time with `CMAKE_INSTALL_PREFIX`)
+- `/etc/wivrn/config.json`
+- `$XDG_CONFIG_HOME/wivrn/config.json` or if `$XDG_CONFIG_HOME` is not set, `$HOME/.config/wivrn/config.json`.
+
+Files later in the list replace top-level values from previous ones.
All elements are optional and have default values.
diff --git a/server/active_runtime.cpp b/server/active_runtime.cpp
index 84022a88..532f0531 100644
--- a/server/active_runtime.cpp
+++ b/server/active_runtime.cpp
@@ -76,7 +76,7 @@ std::filesystem::path active_runtime::openvr_compat_path()
return std::filesystem::path();
},
},
- configuration::read_user_configuration().openvr_compat_path);
+ configuration().openvr_compat_path);
}
static std::filesystem::path backup_name(std::filesystem::path file)
diff --git a/server/driver/configuration.cpp b/server/driver/configuration.cpp
index 2f7fc4b6..7bcd7a0f 100644
--- a/server/driver/configuration.cpp
+++ b/server/driver/configuration.cpp
@@ -19,6 +19,8 @@
#define JSON_DISABLE_ENUM_SERIALIZATION 1
+#include "configuration.h"
+
#include
#include
#include
@@ -31,10 +33,10 @@
#include "util/u_logging.h"
-#include "configuration.h"
#include "utils/xdg_base_directory.h"
+#include "wivrn_config.h"
-static std::filesystem::path config_file = xdg_config_home() / "wivrn" / "config.json";
+static std::filesystem::path config_file;
static std::filesystem::path known_keys_file = xdg_config_home() / "wivrn" / "known_keys.json";
static std::filesystem::path cookie_file = xdg_config_home() / "wivrn" / "cookie";
@@ -65,12 +67,56 @@ void configuration::set_config_file(const std::filesystem::path & path)
{
config_file = path;
}
-
-const std::filesystem::path & configuration::get_config_file()
+std::filesystem::path configuration::get_config_file()
{
+ if (config_file.empty())
+ return xdg_config_home() / "wivrn" / "config.json";
return config_file;
}
+nlohmann::json configuration::read_configuration()
+{
+ if (config_file.empty())
+ {
+ nlohmann::json merged;
+ for (std::filesystem::path prefix: {
+ std::filesystem::path(WIVRN_INSTALL_PREFIX "/share"),
+ std::filesystem::path("/etc"),
+ xdg_config_home(),
+ })
+ {
+ auto path = prefix / "wivrn" / "config.json";
+ if (std::filesystem::exists(path))
+ {
+ try
+ {
+ for (const auto & [key, value]: nlohmann::json::parse(std::ifstream(path)).get())
+ {
+ merged[key] = value;
+ }
+ }
+ catch (std::exception & e)
+ {
+ U_LOG_E("Invalid configuration file %s: %s", path.c_str(), e.what());
+ }
+ }
+ }
+ return merged;
+ }
+ else
+ {
+ try
+ {
+ return nlohmann::json::parse(std::ifstream(config_file));
+ }
+ catch (std::exception & e)
+ {
+ U_LOG_E("Invalid configuration file %s: %s", config_file.c_str(), e.what());
+ return nlohmann::json();
+ }
+ }
+}
+
configuration::encoder parse_encoder(const nlohmann::json & item)
{
configuration::encoder e;
@@ -94,85 +140,78 @@ configuration::encoder parse_encoder(const nlohmann::json & item)
return e;
}
-configuration configuration::read_user_configuration()
+configuration::configuration()
{
- configuration result;
- if (not std::filesystem::exists(config_file))
- return result;
- std::ifstream file(config_file);
try
{
- auto json = nlohmann::json::parse(file);
+ auto json = read_configuration();
if (auto it = json.find("scale"); it != json.end())
{
if (it->is_number())
- result.scale = std::array{*it, *it};
+ scale = std::array{*it, *it};
else
- result.scale = *it;
+ scale = *it;
}
if (auto it = json.find("grip-surface"); it != json.end())
{
- result.grip_surface = *it;
+ grip_surface = *it;
}
if (auto it = json.find("bitrate"); it != json.end())
- result.bitrate = *it;
+ bitrate = *it;
if (auto it = json.find("encoders"); it != json.end())
{
for (const auto & encoder: *it)
- result.encoders.push_back(parse_encoder(encoder));
+ encoders.push_back(parse_encoder(encoder));
}
if (auto it = json.find("encoder-passthrough"); it != json.end())
- result.encoder_passthrough = parse_encoder(*it);
+ encoder_passthrough = parse_encoder(*it);
if (auto it = json.find("application"); it != json.end())
{
if (it->is_string())
- result.application.push_back(*it);
+ application.push_back(*it);
else
{
for (const auto & i: *it)
- result.application.push_back(i);
+ application.push_back(i);
}
}
if (auto it = json.find("debug-gui"); it != json.end())
- result.debug_gui = *it;
+ debug_gui = *it;
if (auto it = json.find("use-steamvr-lh"); it != json.end())
- result.use_steamvr_lh = *it;
+ use_steamvr_lh = *it;
if (auto it = json.find("tcp-only"); it != json.end())
- result.tcp_only = *it;
+ tcp_only = *it;
else if (auto it = json.find("tcp_only"); it != json.end())
- result.tcp_only = *it;
+ tcp_only = *it;
if (auto it = json.find("publish-service"); it != json.end())
{
- result.publication = *it;
- if (result.publication == service_publication(-1))
+ publication = *it;
+ if (publication == service_publication(-1))
throw std::runtime_error("invalid service publication " + it->get());
}
if (auto it = json.find("openvr-compat-path"); it != json.end())
{
if (it->is_null())
- result.openvr_compat_path = nullptr;
+ openvr_compat_path = nullptr;
else
- result.openvr_compat_path = *it;
+ openvr_compat_path = *it;
}
}
catch (const std::exception & e)
{
- U_LOG_E("Invalid configuration file: %s", e.what());
- return {};
+ U_LOG_E("Configuration file error: %s", e.what());
}
-
- return result;
}
std::string server_cookie()
diff --git a/server/driver/configuration.h b/server/driver/configuration.h
index 86eea9de..53c0ba80 100644
--- a/server/driver/configuration.h
+++ b/server/driver/configuration.h
@@ -23,6 +23,7 @@
#include
#include
#include