Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -153,11 +153,13 @@ jobs:
|
|||||||
nix-test:
|
nix-test:
|
||||||
name: Test Nix package and devshell
|
name: Test Nix package and devshell
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
if: ${{ vars.APK_ONLY == '' }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- uses: cachix/install-nix-action@v31
|
- uses: cachix/install-nix-action@v31
|
||||||
- run: nix flake check
|
- run: nix flake check
|
||||||
- run: nix build
|
- run: nix build
|
||||||
|
|||||||
@@ -88,6 +88,8 @@
|
|||||||
|
|
||||||
<!-- https://developer.oculus.com/documentation/native/android/mobile-splash/ -->
|
<!-- https://developer.oculus.com/documentation/native/android/mobile-splash/ -->
|
||||||
<meta-data android:name="com.oculus.ossplash" android:value="true"/>
|
<meta-data android:name="com.oculus.ossplash" android:value="true"/>
|
||||||
|
<!-- https://developers.meta.com/horizon/documentation/native/android/mobile-passthrough-loading-screens -->
|
||||||
|
<meta-data android:name="com.oculus.ossplash.background" android:value="passthrough-contextual"/>
|
||||||
|
|
||||||
<!-- The activity is the built-in NativeActivity framework class. -->
|
<!-- The activity is the built-in NativeActivity framework class. -->
|
||||||
<!-- launchMode is set to singleTask because there should never be multiple copies of the app running. -->
|
<!-- launchMode is set to singleTask because there should never be multiple copies of the app running. -->
|
||||||
|
|||||||
@@ -348,6 +348,24 @@ std::pair<glm::vec3, glm::quat> controller_offset(std::string_view profile, xr::
|
|||||||
default:
|
default:
|
||||||
break;
|
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")
|
else if (profile == "htc-vive-focus-3")
|
||||||
switch (space)
|
switch (space)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -966,6 +966,12 @@ void scenes::lobby::render(const XrFrameState & frame_state)
|
|||||||
.depthMask = true,
|
.depthMask = true,
|
||||||
.compareOp = application::get_config().passthrough_enabled ? XR_COMPARE_OP_LESS_FB : XR_COMPARE_OP_LESS_OR_EQUAL_FB,
|
.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)
|
// 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<XrCompositionLayerBaseHeader *>(&lobby_layer));
|
layers_with_z_index.emplace_back(constants::lobby::zindex_lobby, reinterpret_cast<XrCompositionLayerBaseHeader *>(&lobby_layer));
|
||||||
@@ -977,7 +983,7 @@ void scenes::lobby::render(const XrFrameState & frame_state)
|
|||||||
|
|
||||||
if (composition_layer_depth_test_supported)
|
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)
|
for (auto & [z_index, layer]: imgui_layers)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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)
|
static XrPassthroughFB create_passthrough_fb(xr::instance & inst, xr::session & s)
|
||||||
{
|
{
|
||||||
PFN_xrCreatePassthroughFB xrCreatePassthroughFB = inst.get_proc<PFN_xrCreatePassthroughFB>("xrCreatePassthroughFB");
|
PFN_xrCreatePassthroughFB xrCreatePassthroughFB = inst.get_proc<PFN_xrCreatePassthroughFB>("xrCreatePassthroughFB");
|
||||||
|
xrDestroyPassthroughFB = inst.get_proc<PFN_xrDestroyPassthroughFB>("xrDestroyPassthroughFB");
|
||||||
|
|
||||||
XrPassthroughFB id;
|
XrPassthroughFB id;
|
||||||
XrPassthroughCreateInfoFB info{
|
XrPassthroughCreateInfoFB info{
|
||||||
@@ -71,7 +72,6 @@ xr::passthrough_fb::passthrough_fb(instance & inst, session & s) :
|
|||||||
.purpose = XR_PASSTHROUGH_LAYER_PURPOSE_RECONSTRUCTION_FB,
|
.purpose = XR_PASSTHROUGH_LAYER_PURPOSE_RECONSTRUCTION_FB,
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
xrDestroyPassthroughFB = inst.get_proc<PFN_xrDestroyPassthroughFB>("xrDestroyPassthroughFB");
|
|
||||||
xrPassthroughStartFB = inst.get_proc<PFN_xrPassthroughStartFB>("xrPassthroughStartFB");
|
xrPassthroughStartFB = inst.get_proc<PFN_xrPassthroughStartFB>("xrPassthroughStartFB");
|
||||||
xrPassthroughPauseFB = inst.get_proc<PFN_xrPassthroughPauseFB>("xrPassthroughPauseFB");
|
xrPassthroughPauseFB = inst.get_proc<PFN_xrPassthroughPauseFB>("xrPassthroughPauseFB");
|
||||||
xrPassthroughLayerPauseFB = inst.get_proc<PFN_xrPassthroughLayerPauseFB>("xrPassthroughLayerPauseFB");
|
xrPassthroughLayerPauseFB = inst.get_proc<PFN_xrPassthroughLayerPauseFB>("xrPassthroughLayerPauseFB");
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
# Configurable items
|
# 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.
|
All elements are optional and have default values.
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ std::filesystem::path active_runtime::openvr_compat_path()
|
|||||||
return std::filesystem::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)
|
static std::filesystem::path backup_name(std::filesystem::path file)
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#define JSON_DISABLE_ENUM_SERIALIZATION 1
|
#define JSON_DISABLE_ENUM_SERIALIZATION 1
|
||||||
|
|
||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
@@ -31,10 +33,10 @@
|
|||||||
|
|
||||||
#include "util/u_logging.h"
|
#include "util/u_logging.h"
|
||||||
|
|
||||||
#include "configuration.h"
|
|
||||||
#include "utils/xdg_base_directory.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 known_keys_file = xdg_config_home() / "wivrn" / "known_keys.json";
|
||||||
static std::filesystem::path cookie_file = xdg_config_home() / "wivrn" / "cookie";
|
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;
|
config_file = path;
|
||||||
}
|
}
|
||||||
|
std::filesystem::path configuration::get_config_file()
|
||||||
const std::filesystem::path & configuration::get_config_file()
|
|
||||||
{
|
{
|
||||||
|
if (config_file.empty())
|
||||||
|
return xdg_config_home() / "wivrn" / "config.json";
|
||||||
return config_file;
|
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<nlohmann::json::object_t>())
|
||||||
|
{
|
||||||
|
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 parse_encoder(const nlohmann::json & item)
|
||||||
{
|
{
|
||||||
configuration::encoder e;
|
configuration::encoder e;
|
||||||
@@ -94,85 +140,78 @@ configuration::encoder parse_encoder(const nlohmann::json & item)
|
|||||||
return e;
|
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
|
try
|
||||||
{
|
{
|
||||||
auto json = nlohmann::json::parse(file);
|
auto json = read_configuration();
|
||||||
|
|
||||||
if (auto it = json.find("scale"); it != json.end())
|
if (auto it = json.find("scale"); it != json.end())
|
||||||
{
|
{
|
||||||
if (it->is_number())
|
if (it->is_number())
|
||||||
result.scale = std::array<double, 2>{*it, *it};
|
scale = std::array<double, 2>{*it, *it};
|
||||||
else
|
else
|
||||||
result.scale = *it;
|
scale = *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto it = json.find("grip-surface"); it != json.end())
|
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())
|
if (auto it = json.find("bitrate"); it != json.end())
|
||||||
result.bitrate = *it;
|
bitrate = *it;
|
||||||
|
|
||||||
if (auto it = json.find("encoders"); it != json.end())
|
if (auto it = json.find("encoders"); it != json.end())
|
||||||
{
|
{
|
||||||
for (const auto & encoder: *it)
|
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())
|
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 (auto it = json.find("application"); it != json.end())
|
||||||
{
|
{
|
||||||
if (it->is_string())
|
if (it->is_string())
|
||||||
result.application.push_back(*it);
|
application.push_back(*it);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (const auto & i: *it)
|
for (const auto & i: *it)
|
||||||
result.application.push_back(i);
|
application.push_back(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto it = json.find("debug-gui"); it != json.end())
|
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())
|
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())
|
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())
|
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())
|
if (auto it = json.find("publish-service"); it != json.end())
|
||||||
{
|
{
|
||||||
result.publication = *it;
|
publication = *it;
|
||||||
if (result.publication == service_publication(-1))
|
if (publication == service_publication(-1))
|
||||||
throw std::runtime_error("invalid service publication " + it->get<std::string>());
|
throw std::runtime_error("invalid service publication " + it->get<std::string>());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto it = json.find("openvr-compat-path"); it != json.end())
|
if (auto it = json.find("openvr-compat-path"); it != json.end())
|
||||||
{
|
{
|
||||||
if (it->is_null())
|
if (it->is_null())
|
||||||
result.openvr_compat_path = nullptr;
|
openvr_compat_path = nullptr;
|
||||||
else
|
else
|
||||||
result.openvr_compat_path = *it;
|
openvr_compat_path = *it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const std::exception & e)
|
catch (const std::exception & e)
|
||||||
{
|
{
|
||||||
U_LOG_E("Invalid configuration file: %s", e.what());
|
U_LOG_E("Configuration file error: %s", e.what());
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string server_cookie()
|
std::string server_cookie()
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
@@ -68,8 +69,10 @@ struct configuration
|
|||||||
std::variant<std::monostate, std::string, std::nullptr_t> openvr_compat_path;
|
std::variant<std::monostate, std::string, std::nullptr_t> openvr_compat_path;
|
||||||
|
|
||||||
static void set_config_file(const std::filesystem::path &);
|
static void set_config_file(const std::filesystem::path &);
|
||||||
static const std::filesystem::path & get_config_file();
|
static std::filesystem::path get_config_file();
|
||||||
static configuration read_user_configuration();
|
|
||||||
|
static nlohmann::json read_configuration();
|
||||||
|
configuration();
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string server_cookie();
|
std::string server_cookie();
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ void wivrn::wivrn_connection::init(std::stop_token stop_token, std::function<voi
|
|||||||
throw std::system_error(errno, std::system_category(), "Cannot get client address");
|
throw std::system_error(errno, std::system_category(), "Cannot get client address");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configuration::read_user_configuration().tcp_only)
|
if (configuration().tcp_only)
|
||||||
{
|
{
|
||||||
port = -1;
|
port = -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -572,7 +572,7 @@ wivrn_controller::wivrn_controller(int hand_id,
|
|||||||
SET_INPUT(TOUCH, GRIP_POSE);
|
SET_INPUT(TOUCH, GRIP_POSE);
|
||||||
SET_INPUT(GENERIC, PALM_POSE);
|
SET_INPUT(GENERIC, PALM_POSE);
|
||||||
|
|
||||||
if (auto grip_surface = configuration::read_user_configuration().grip_surface)
|
if (auto grip_surface = configuration().grip_surface)
|
||||||
{
|
{
|
||||||
std::array<float, 3> angles = grip_surface.value();
|
std::array<float, 3> angles = grip_surface.value();
|
||||||
float deg_2_rad = std::numbers::pi / 180.0;
|
float deg_2_rad = std::numbers::pi / 180.0;
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ wivrn_hmd::wivrn_hmd(wivrn::wivrn_session * cnx,
|
|||||||
},
|
},
|
||||||
cnx(cnx)
|
cnx(cnx)
|
||||||
{
|
{
|
||||||
const auto config = configuration::read_user_configuration();
|
const auto config = configuration();
|
||||||
|
|
||||||
auto eye_width = info.recommended_eye_width;
|
auto eye_width = info.recommended_eye_width;
|
||||||
eye_width = ((eye_width + 3) / 4) * 4;
|
eye_width = ((eye_width + 3) / 4) * 4;
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr<wivrn_connection> connection
|
|||||||
static_roles.hand_tracking.right = xdevs[xdev_count++] = &right_hand;
|
static_roles.hand_tracking.right = xdevs[xdev_count++] = &right_hand;
|
||||||
|
|
||||||
#if WIVRN_FEATURE_STEAMVR_LIGHTHOUSE
|
#if WIVRN_FEATURE_STEAMVR_LIGHTHOUSE
|
||||||
auto use_steamvr_lh = configuration::read_user_configuration().use_steamvr_lh || std::getenv("WIVRN_USE_STEAMVR_LH");
|
auto use_steamvr_lh = configuration().use_steamvr_lh || std::getenv("WIVRN_USE_STEAMVR_LH");
|
||||||
xrt_system_devices * lhdevs = NULL;
|
xrt_system_devices * lhdevs = NULL;
|
||||||
|
|
||||||
if (use_steamvr_lh && steamvr_lh_create_devices(&lhdevs) == XRT_SUCCESS)
|
if (use_steamvr_lh && steamvr_lh_create_devices(&lhdevs) == XRT_SUCCESS)
|
||||||
|
|||||||
@@ -330,14 +330,6 @@ static uint16_t align(uint16_t value, uint16_t alignment)
|
|||||||
std::vector<encoder_settings> get_encoder_settings(wivrn_vk_bundle & bundle, uint32_t & width, uint32_t & height, const from_headset::headset_info_packet & info)
|
std::vector<encoder_settings> get_encoder_settings(wivrn_vk_bundle & bundle, uint32_t & width, uint32_t & height, const from_headset::headset_info_packet & info)
|
||||||
{
|
{
|
||||||
configuration config;
|
configuration config;
|
||||||
try
|
|
||||||
{
|
|
||||||
config = configuration::read_user_configuration();
|
|
||||||
}
|
|
||||||
catch (const std::exception & e)
|
|
||||||
{
|
|
||||||
U_LOG_E("Failed to read encoder configuration: %s", e.what());
|
|
||||||
}
|
|
||||||
if (config.encoders.empty())
|
if (config.encoders.empty())
|
||||||
config.encoders = get_encoder_default_settings(bundle, info.supported_codecs);
|
config.encoders = get_encoder_default_settings(bundle, info.supported_codecs);
|
||||||
if (not config.encoder_passthrough)
|
if (not config.encoder_passthrough)
|
||||||
|
|||||||
+12
-6
@@ -479,7 +479,7 @@ gboolean headset_connected_success(void *)
|
|||||||
|
|
||||||
expose_known_keys_on_dbus();
|
expose_known_keys_on_dbus();
|
||||||
|
|
||||||
start_server(configuration::read_user_configuration());
|
start_server(configuration());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
start_app();
|
start_app();
|
||||||
@@ -855,9 +855,15 @@ void on_name_acquired(GDBusConnection * connection, const gchar * name, gpointer
|
|||||||
|
|
||||||
on_headset_info_packet({});
|
on_headset_info_packet({});
|
||||||
|
|
||||||
std::ifstream file(configuration::get_config_file());
|
std::string config;
|
||||||
std::string config{std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>()};
|
try
|
||||||
|
{
|
||||||
|
config = configuration::read_configuration().dump();
|
||||||
|
}
|
||||||
|
catch (std::exception & e)
|
||||||
|
{
|
||||||
|
std::cerr << "Invalid configuration: " << e.what() << std::endl;
|
||||||
|
}
|
||||||
wivrn_server_set_json_configuration(dbus_server, config.c_str());
|
wivrn_server_set_json_configuration(dbus_server, config.c_str());
|
||||||
|
|
||||||
expose_known_keys_on_dbus();
|
expose_known_keys_on_dbus();
|
||||||
@@ -1035,11 +1041,11 @@ int main(int argc, char * argv[])
|
|||||||
if (*no_publish)
|
if (*no_publish)
|
||||||
publication = wivrn::service_publication::none;
|
publication = wivrn::service_publication::none;
|
||||||
else
|
else
|
||||||
publication = configuration::read_user_configuration().publication;
|
publication = configuration().publication;
|
||||||
|
|
||||||
#if WIVRN_USE_SYSTEMD
|
#if WIVRN_USE_SYSTEMD
|
||||||
if (*app_flag)
|
if (*app_flag)
|
||||||
return exec_application(configuration::read_user_configuration());
|
return exec_application(configuration());
|
||||||
#endif
|
#endif
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ pid_t wivrn::start_unit_file()
|
|||||||
|
|
||||||
pid_t wivrn::fork_application()
|
pid_t wivrn::fork_application()
|
||||||
{
|
{
|
||||||
auto config = configuration::read_user_configuration();
|
configuration config;
|
||||||
|
|
||||||
if (config.application.empty())
|
if (config.application.empty())
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user