mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-30 13:52:47 -08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20d9740196 | ||
|
|
400b48c419 | ||
|
|
76f220d4f4 | ||
|
|
9c624cc23d | ||
|
|
d4a2a61e32 | ||
|
|
ba7b0d6deb | ||
|
|
7ee60b8ce0 | ||
|
|
7c279e355d | ||
|
|
63bdcd9201 | ||
|
|
516b8ee11b | ||
|
|
03bae59ec8 | ||
|
|
a3e70772d1 | ||
|
|
c11dc54ed1 | ||
|
|
554976390b | ||
|
|
ced279a867 | ||
|
|
8637d1864a | ||
|
|
5bb5a30336 | ||
|
|
c72a30aca5 | ||
|
|
4e3abbb214 | ||
|
|
ade2298a69 | ||
|
|
c834661060 | ||
|
|
1cc911d994 | ||
|
|
c3d16403d5 | ||
|
|
82f6978d3d | ||
|
|
c255b560eb | ||
|
|
a2b0ae1ffe | ||
|
|
4e70cbf04b | ||
|
|
aa07e4f7be |
No files matched your search
@@ -75,7 +75,7 @@ jobs:
|
||||
- name: Get tags
|
||||
run: git fetch --tags origin --recurse-submodules=no --force
|
||||
- name: Setup PNPM
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
uses: pnpm/action-setup@v6
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
@@ -143,7 +143,7 @@ jobs:
|
||||
- name: Get tags
|
||||
run: git fetch --tags origin --recurse-submodules=no --force
|
||||
- name: Setup PNPM
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
uses: pnpm/action-setup@v6
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
@@ -176,7 +176,7 @@ jobs:
|
||||
- name: Get tags
|
||||
run: git fetch --tags origin --recurse-submodules=no --force
|
||||
- name: Setup PNPM
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
uses: pnpm/action-setup@v6
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
# ignore gradle build folder
|
||||
build/
|
||||
|
||||
# created by clangd for index cache
|
||||
.cache/
|
||||
|
||||
# direnv has been claimed for Nix usage
|
||||
.direnv/
|
||||
.devenv
|
||||
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if ((Get-Command "clang-format" -ErrorAction SilentlyContinue) -eq $null) {
|
||||
$errorObj = New-Object System.IO.FileNotFoundException("clang-format is not installed, please install clang-format via your package manager (e.g. winget/chocolatey/scoop) and re-run the script")
|
||||
throw $errorObj
|
||||
}
|
||||
|
||||
$SourceFiles = Get-ChildItem -Path '.\src\' -Recurse -Include "*.cpp","*.hpp"
|
||||
foreach ($file in $SourceFiles) {
|
||||
Write-Output "Formatting $(Resolve-Path -Relative $file.FullName)"
|
||||
clang-format -i "$($file.FullName)"
|
||||
}
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
if ! command -v clang-format >/dev/null 2>&1; then
|
||||
echo "clang-format is not installed, please install clang-format via your package manager (e.g. pacman/apt/dnf/winget) and re-run the script" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
find src/ \( \
|
||||
-iname '*.cpp' \
|
||||
-or -iname '*.hpp' \
|
||||
\) \
|
||||
-exec echo Formatting {} \; \
|
||||
-exec clang-format -i {} \;
|
||||
@@ -102,19 +102,34 @@ static void signal_handler(int signal) {
|
||||
|
||||
int main() {
|
||||
auto &logger = Logger::get();
|
||||
// Steam and SteamVR sets these environment variables on applications that it
|
||||
// spawns, but if an app spawned by Steam then spawns a child that initialises
|
||||
// OpenVR, SteamVR will give the child the appkey of the root application it
|
||||
// is a descendant of, e.g. if SteamVR launches SlimeVR as an overlay,
|
||||
// it will set SteamAppId="3245490" and STEAMVR_APPKEY="steam.overlay.3245490"
|
||||
// which breaks our bindings. We want SteamVR to use a generated appkey if
|
||||
// possible.
|
||||
|
||||
// Steam and SteamVR respectively set these environment variables on applications that
|
||||
// they spawn, which the SteamVR client library (vrclient) will then use as the
|
||||
// application key when initiating the connection with vrserver. This may not
|
||||
// be ideal if we are launched by another Steam or OpenVR application, as we will inherit
|
||||
// their app key through the environment, which means SteamVR will load the wrong bindings.
|
||||
// A real-world example of this is if someone uses an application such as OpenVR-Autostarter
|
||||
// to start the SlimeVR Server. OpenVR-Autostarter installs an application manifest with the
|
||||
// app key "dreiekk.openvr-autostarter", so when it starts SlimeVR Server, which then starts us,
|
||||
// the STEAMVR_APPKEY="dreiekk.openvr-autostarter" environment variable will be set.
|
||||
//
|
||||
// We want SteamVR to use the appkey of the Steam version of our application if possible.
|
||||
// Unfortunately, we cannot install an application vrmanifest to force the app key,
|
||||
// as SteamVR requires a binary path in the manifest to consider it valid. We do not want to install
|
||||
// a manifest with a binary path because we want the SlimeVR Server to start us when the
|
||||
// driver initiates a connection, rather than getting auto-started by SteamVR.
|
||||
//
|
||||
// This is not documented anywhere publicly, see CVRClient::SendConnectMessage in vrclient instead.
|
||||
|
||||
constexpr const char *STEAM_APPID = "3245490";
|
||||
constexpr const char *STEAMVR_APPKEY = "steam.overlay.3245490";
|
||||
|
||||
#ifdef _WIN32
|
||||
SetEnvironmentVariableA("SteamAppId", nullptr);
|
||||
SetEnvironmentVariableA("STEAMVR_APPKEY", nullptr);
|
||||
SetEnvironmentVariableA("SteamAppId", STEAM_APPID);
|
||||
SetEnvironmentVariableA("STEAMVR_APPKEY", STEAMVR_APPKEY);
|
||||
#else
|
||||
unsetenv("SteamAppId");
|
||||
unsetenv("STEAMVR_APPKEY");
|
||||
setenv("SteamAppId", STEAM_APPID, 1);
|
||||
setenv("STEAMVR_APPKEY", STEAMVR_APPKEY, 1);
|
||||
#endif
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#include "solarxr.hpp"
|
||||
#include "logger.hpp"
|
||||
#include "paths.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <sys/socket.h>
|
||||
@@ -14,15 +16,24 @@
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
static std::string getenvSafe(const char *env) {
|
||||
char *v = getenv(env);
|
||||
if (v == nullptr)
|
||||
return {};
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
fs::path SolarXRConnection::getSocketPath() {
|
||||
using namespace std::string_view_literals;
|
||||
#if defined(__linux__)
|
||||
#define MAKE_SOCKET_PATH(PATH) \
|
||||
std::make_pair(PATH##sv, static_cast<const char *>(getenv(PATH)))
|
||||
std::make_pair(PATH##sv, getenvSafe(PATH))
|
||||
|
||||
constexpr std::string_view socketName = "SlimeVRRpc";
|
||||
std::array<std::pair<std::string_view, const char *>, 4> socketPaths{
|
||||
std::array<std::pair<std::string_view, fs::path>, 5> socketPaths{
|
||||
MAKE_SOCKET_PATH("SLIMEVR_SOCKET_DIR"),
|
||||
{ "Steam socket path", Paths::getDataPath() },
|
||||
MAKE_SOCKET_PATH("XDG_RUNTIME_DIR"),
|
||||
MAKE_SOCKET_PATH("TMPDIR"),
|
||||
{ "/tmp", "/tmp" }
|
||||
@@ -31,17 +42,17 @@ fs::path SolarXRConnection::getSocketPath() {
|
||||
#undef MAKE_SOCKET_PATH
|
||||
|
||||
for (auto [name, path] : socketPaths) {
|
||||
if (path == nullptr) {
|
||||
if (path.empty()) {
|
||||
Logger::get().info(
|
||||
"Skipping socket directory {} because it doesn't exist", name);
|
||||
"Skipping socket directory '{}' because it doesn't exist", name);
|
||||
continue;
|
||||
}
|
||||
fs::path socketPath = fs::path(path) / socketName;
|
||||
fs::path socketPath = path / socketName;
|
||||
if (fs::exists(socketPath))
|
||||
return socketPath;
|
||||
|
||||
Logger::get().info(
|
||||
"Skipping socket directory {} because socket does not exist", name);
|
||||
"Skipping socket directory '{}' because socket does not exist", name);
|
||||
}
|
||||
#elif defined(_WIN32)
|
||||
throw std::logic_error(
|
||||
|
||||
@@ -29,7 +29,6 @@ import {
|
||||
} from './paths';
|
||||
import { initStores } from './store';
|
||||
import { closeLogger, logger } from './logger';
|
||||
|
||||
import { spawn } from 'node:child_process';
|
||||
import { discordPresence } from './presence';
|
||||
import { options } from './cli';
|
||||
@@ -47,6 +46,13 @@ if (process.platform === 'linux') {
|
||||
app.commandLine.appendSwitch('force-color-profile', 'srgb');
|
||||
}
|
||||
|
||||
console.log(options);
|
||||
// SteamVR will not see the application if this is not enabled
|
||||
if (options.steam) {
|
||||
app.commandLine.appendSwitch('enable-features', 'Vulkan,WebXR,WebXROpenXR');
|
||||
app.commandLine.appendSwitch('enable-xr-sandbox');
|
||||
}
|
||||
|
||||
app.setPath('userData', getGuiDataFolder());
|
||||
app.setPath('sessionData', join(getGuiDataFolder(), 'electron'));
|
||||
|
||||
@@ -501,6 +507,12 @@ app.whenReady().then(async () => {
|
||||
|
||||
logger.info('SlimeVR started!');
|
||||
|
||||
process.on('exit', async (code) => {
|
||||
console.log(code);
|
||||
server?.close();
|
||||
await server?.waitForExit();
|
||||
});
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
app.quit();
|
||||
});
|
||||
|
||||
@@ -690,17 +690,15 @@ settings-general-gesture_control-trackers = { $amount ->
|
||||
settings-general-gesture_control-yawResetEnabled = Enable tap to yaw reset
|
||||
settings-general-gesture_control-yawResetDelay = Yaw reset delay
|
||||
settings-general-gesture_control-yawResetTaps = Taps for yaw reset
|
||||
settings-general-gesture_control-yawResetTracker = Yaw Reset Tracker
|
||||
settings-general-gesture_control-yawResetTracker = Yaw reset tracker
|
||||
settings-general-gesture_control-fullResetEnabled = Enable tap to full reset
|
||||
settings-general-gesture_control-fullResetDelay = Full reset delay
|
||||
settings-general-gesture_control-fullResetTaps = Taps for full reset
|
||||
settings-general-gesture_control-fullResetTracker = Full Reset Tracker
|
||||
settings-general-gesture_control-fullResetTracker = Full reset tracker
|
||||
settings-general-gesture_control-mountingResetEnabled = Enable tap to perform mounting calibration
|
||||
settings-general-gesture_control-mountingResetDelay = Mounting calibration delay
|
||||
settings-general-gesture_control-mountingResetTaps = Taps for mounting calibration
|
||||
settings-general-gesture_control-mountingResetTracker = Mounting Reset Tracker
|
||||
settings-general-gesture_control-yawResetTracker-title = Yaw Reset Tracker
|
||||
settings-general-gesture_control-fullResetTracker-title = Full Reset Tracker
|
||||
settings-general-gesture_control-mountingResetTracker = Mounting reset tracker
|
||||
# The number of trackers that can have higher acceleration before a tap is rejected
|
||||
settings-general-gesture_control-numberTrackersOverThreshold = Trackers over threshold
|
||||
settings-general-gesture_control-numberTrackersOverThreshold-description = Increase this value if tap detection is not working. Do not increase it above what is needed to make tap detection work as it would cause more false positives.
|
||||
|
||||
@@ -34,7 +34,8 @@ export function NavButton({
|
||||
className={classnames(
|
||||
'flex flex-col justify-center xs:gap-4 mobile:gap-2',
|
||||
'mobile:w-[65px] mobile:h-[65px]',
|
||||
'xs:py-3 mobile:py-4 rounded-md mobile:rounded-b-none group',
|
||||
'xs:py-3 mobile:py-4 rounded-md mobile:rounded-b-none group select-text',
|
||||
'vr-button',
|
||||
{
|
||||
'bg-accent-background-50 fill-accent-background-20': doesMatch,
|
||||
'hover:bg-background-70': !doesMatch,
|
||||
|
||||
@@ -98,7 +98,8 @@ export function Button({
|
||||
'rounded-full p-2 text-center min-h-[35px] min-w-[35px]': rounded,
|
||||
'rounded-md px-5 py-2.5': !rounded,
|
||||
},
|
||||
props.className
|
||||
props.className,
|
||||
'vr-button'
|
||||
);
|
||||
}, [variant, disabled, rounded, props.className]);
|
||||
|
||||
|
||||
@@ -27,12 +27,16 @@ export function Radio<T extends FieldValues = FieldValues>({
|
||||
name={name}
|
||||
render={({ field: { onChange, ref, name, value: checked } }) => (
|
||||
<label
|
||||
className={classNames('w-full p-3 rounded-md flex gap-3 border-2', {
|
||||
'border-accent-background-30': value == checked,
|
||||
'border-transparent': value != checked,
|
||||
'bg-background-60 cursor-pointer hover:bg-background-50': !disabled,
|
||||
'bg-background-80 cursor-not-allowed': disabled,
|
||||
})}
|
||||
className={classNames(
|
||||
'w-full p-3 rounded-md flex gap-3 border-2 vr-button',
|
||||
{
|
||||
'border-accent-background-30': value == checked,
|
||||
'border-transparent': value != checked,
|
||||
'bg-background-60 cursor-pointer hover:bg-background-50':
|
||||
!disabled,
|
||||
'bg-background-80 cursor-not-allowed': disabled,
|
||||
}
|
||||
)}
|
||||
>
|
||||
<input
|
||||
type="radio"
|
||||
|
||||
@@ -79,7 +79,7 @@ export function ResetButton({
|
||||
variant="primary"
|
||||
disabled={disabled}
|
||||
>
|
||||
<div className="flex flex-col">
|
||||
<div className="flex flex-col vr-button">
|
||||
<div className="opacity-0 h-0">
|
||||
{children || <Localized id={name} />}
|
||||
</div>
|
||||
|
||||
@@ -160,7 +160,7 @@ export function BodyAssignment({
|
||||
highlightedRoles={highlightedRoles}
|
||||
onSelectRole={onRoleSelected}
|
||||
leftControls={
|
||||
<div className="flex flex-col justify-between h-full text-right">
|
||||
<div className="flex flex-col justify-between h-full text-right vr-button">
|
||||
<div className="flex flex-col gap-2">
|
||||
{hasBodyPart(BodyPart.HEAD) && (
|
||||
<TrackerPartCard
|
||||
|
||||
@@ -1317,7 +1317,7 @@ export function GeneralSettings() {
|
||||
</div>
|
||||
<div className="grid sm:grid-cols-3 gap-5 pb-2">
|
||||
<div>
|
||||
<Typography variant="section-title">
|
||||
<Typography bold>
|
||||
{l10n.getString(
|
||||
'settings-general-gesture_control-yawResetTracker'
|
||||
)}
|
||||
@@ -1331,7 +1331,7 @@ export function GeneralSettings() {
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Typography variant="section-title">
|
||||
<Typography bold>
|
||||
{l10n.getString(
|
||||
'settings-general-gesture_control-fullResetTracker'
|
||||
)}
|
||||
@@ -1345,7 +1345,7 @@ export function GeneralSettings() {
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Typography variant="section-title">
|
||||
<Typography bold>
|
||||
{l10n.getString(
|
||||
'settings-general-gesture_control-mountingResetTracker'
|
||||
)}
|
||||
|
||||
@@ -173,7 +173,7 @@ export function TrackerCard({
|
||||
<div
|
||||
onClick={onClick}
|
||||
className={classNames(
|
||||
'rounded-lg overflow-hidden transition-[box-shadow] duration-200 ease-linear',
|
||||
'rounded-lg overflow-hidden transition-[box-shadow] duration-200 ease-linear vr-button',
|
||||
interactable && 'hover:bg-background-50 cursor-pointer',
|
||||
outlined && 'outline outline-2 outline-accent-background-40',
|
||||
bg
|
||||
|
||||
@@ -433,3 +433,18 @@ a,
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
a,
|
||||
.nav-link {
|
||||
-webkit-user-drag: none;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
.vr-button {
|
||||
-webkit-user-drag: none;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
touch-action: none;
|
||||
}
|
||||
@@ -406,7 +406,9 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
|
||||
var rot = packet.rotation
|
||||
rot = AXES_OFFSET.times(rot)
|
||||
val tracker = connection?.getTracker(packet.sensorId) ?: return
|
||||
if (tracker.status == TrackerStatus.DISCONNECTED) tracker.status = TrackerStatus.OK
|
||||
if (tracker.status == TrackerStatus.DISCONNECTED || tracker.status == TrackerStatus.TIMED_OUT) {
|
||||
tracker.status = TrackerStatus.OK
|
||||
}
|
||||
tracker.setRotation(rot)
|
||||
if (packet is UDPPacket23RotationAndAcceleration) {
|
||||
// sensorOffset is applied correctly since protocol 22
|
||||
@@ -422,7 +424,9 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
|
||||
|
||||
is UDPPacket17RotationData -> {
|
||||
val tracker = connection?.getTracker(packet.sensorId) ?: return
|
||||
if (tracker.status == TrackerStatus.DISCONNECTED) tracker.status = TrackerStatus.OK
|
||||
if (tracker.status == TrackerStatus.DISCONNECTED || tracker.status == TrackerStatus.TIMED_OUT) {
|
||||
tracker.status = TrackerStatus.OK
|
||||
}
|
||||
var rot17 = packet.rotation
|
||||
rot17 = AXES_OFFSET * rot17
|
||||
when (packet.dataType) {
|
||||
@@ -446,7 +450,9 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
|
||||
|
||||
is UDPPacket4Acceleration -> {
|
||||
val tracker = connection?.getTracker(packet.sensorId) ?: return
|
||||
if (tracker.status == TrackerStatus.DISCONNECTED) tracker.status = TrackerStatus.OK
|
||||
if (tracker.status == TrackerStatus.DISCONNECTED || tracker.status == TrackerStatus.TIMED_OUT) {
|
||||
tracker.status = TrackerStatus.OK
|
||||
}
|
||||
// sensorOffset is applied correctly since protocol 22
|
||||
// See: https://github.com/SlimeVR/SlimeVR-Tracker-ESP/pull/480
|
||||
if (connection.protocolVersion >= 22) {
|
||||
|
||||
@@ -5,18 +5,30 @@ import io.eiren.util.logging.LogManager
|
||||
|
||||
class Linux {
|
||||
val path: String = System.getProperty("user.dir")
|
||||
val isFrame = System.getenv("SLIME_SERVER_IS_FRAME")?.toInt()
|
||||
|
||||
fun updateLinux() {
|
||||
updateLinuxSteamVRDriver()
|
||||
}
|
||||
|
||||
fun updateLinuxSteamVRDriver() {
|
||||
val steamVRLocation = SteamUtils.findAppLibraryLocation(250820)?.resolve("steamapps/common/SteamVR") ?: run {
|
||||
LogManager.warning("SteamVR driver installation failed: couldn't find SteamVR")
|
||||
return
|
||||
}
|
||||
|
||||
val pathRegPath = "$steamVRLocation/bin/vrpathreg.sh"
|
||||
val pathRegPath =
|
||||
if (isFrame == 1) {
|
||||
"/opt/steamvr/bin/linuxarm64/vrpathreg"
|
||||
} else {
|
||||
val steamVRLocation = SteamUtils.findAppLibraryLocation(250820)?.resolve("steamapps/common/SteamVR")
|
||||
if (steamVRLocation != null) {
|
||||
LogManager.warning("SteamVR driver installation failed: couldn't find SteamVR")
|
||||
null
|
||||
} else {
|
||||
"${steamVRLocation}/bin/vrpathreg.sh"
|
||||
}
|
||||
}
|
||||
|
||||
if (pathRegPath == null) return
|
||||
|
||||
|
||||
val (findExitCode, _) = executeShellCommand(pathRegPath, "finddriver", "slimevr") ?: run {
|
||||
LogManager.warning("SteamVR driver installation failed: couldn't run vrpathreg finddriver")
|
||||
return
|
||||
@@ -40,6 +52,6 @@ class Linux {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val LINUX_STEAM_DRIVER_DIRECTORY = "slimevr-openvr-driver-x64-linux"
|
||||
private const val LINUX_STEAM_DRIVER_DIRECTORY = "slimevr-openvr-driver"
|
||||
}
|
||||
}
|
||||
@@ -58,11 +58,6 @@ class BindingsProviderManager : Runnable {
|
||||
"BindingsProviderManager already running"
|
||||
}
|
||||
|
||||
val binaryPath = getBinaryPath() ?: throw RuntimeException("Unable to find bindings provider binary")
|
||||
process = ProcessBuilder(binaryPath.toString())
|
||||
.redirectErrorStream(true)
|
||||
.start()
|
||||
LogManager.info("[BindingsProviderManager] Started process")
|
||||
watcherThread = Thread(this, "Bindings provider watcher")
|
||||
watcherThread!!.start()
|
||||
}
|
||||
@@ -77,6 +72,17 @@ class BindingsProviderManager : Runnable {
|
||||
|
||||
override fun run() {
|
||||
try {
|
||||
// Give SteamVR a bit more time to initialise everything
|
||||
// For some users, starting the executable immediately may cause startup failures
|
||||
// This feels like a bit of a hack, but whatever
|
||||
Thread.sleep(3000L)
|
||||
|
||||
val binaryPath = getBinaryPath() ?: throw RuntimeException("Unable to find bindings provider binary")
|
||||
process = ProcessBuilder(binaryPath.toString())
|
||||
.redirectErrorStream(true)
|
||||
.start()
|
||||
LogManager.info("[BindingsProviderManager] Started process")
|
||||
|
||||
val interval = 1000L / 30L
|
||||
while (process?.isAlive == true) {
|
||||
Thread.sleep(interval)
|
||||
|
||||
Reference in new issue
Block a user