Compare commits

..
Author SHA1 Message Date
dependabot[bot] 8cd7b164fc Bump actions/setup-java from 5 to 6
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 5 to 6.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
2026-09-18 20:09:03 +00:00
loucass003 83941fd38e Clean up crowdin.yml to use env variables 2026-09-18 22:02:52 +02:00
loucass003 64a2484827 Add project_id and CROWDIN_API_TOKEN fallback to Crowdin sync 2026-09-18 21:58:52 +02:00
loucass003 d75417de49 Standardize Crowdin action env mapping 2026-09-18 21:55:43 +02:00
loucass003 51aa13b6c8 Pass crowdin_personal_token and project_id to crowdin action 2026-09-18 21:48:50 +02:00
loucass003 7c202618b3 Remove label argument from translation PR creation to prevent token scope errors 2026-09-18 20:48:00 +02:00
loucass003 e3be80fadc Ignore node_modules, dist, and build stats in subdirectories 2026-09-18 20:04:07 +02:00
loucass003 49d631a2a7 Add dry-run Crowdin testing workflow and draft PR protection 2026-09-18 19:32:40 +02:00
loucass003 0efb1ca808 Configure Crowdin for l10n_main and update translation workflows 2026-09-18 19:27:28 +02:00
Futura c1424c2a23 Update Crowdin configuration file
[ci skip]
2026-09-18 18:54:54 +02:00
Sapphire c11dc54ed1 Change UDP tracker status to OK from TIMED_OUT on rotation/accel update (#1923) 2026-09-12 00:51:16 +02:00
Sapphire 554976390b Delay startup of bindings provider to work around SteamVR startup issues (#1906) 2026-08-21 01:51:55 +02:00
Sapphire ced279a867 Use app key of SlimeVR Steam application for bindings provider (#1908) 2026-08-18 11:52:54 +02:00
Sapphire 8637d1864a Tap reset selection GUI cleanup (#1909) 2026-08-18 11:52:40 +02:00
Sapphire c72a30aca5 Add socket path used when under pressure-vessel to bindings provider (#1905) 2026-08-11 03:08:44 +02:00
Eiren Rain d7205bb294 Update CONTRIBUTING.md 2026-07-29 14:28:44 +03:00
Sapphire 953ef93945 Fix order of tap detection tracker settings (#1893) 2026-07-20 18:18:30 +02:00
Ilia Ki 5e3395afb0 Fix dongle reconnection bug (#1872) 2026-06-22 18:33:27 +02:00
Sapphire cdde0b762f Get rid of grgit (#1878) 2026-06-22 14:07:05 +02:00
Sapphire fc6304d7ee Fix magnetometer status not changing when restarting HID tracker (#1863) 2026-06-22 13:13:56 +02:00
Sapphire 563933fa90 Add extra SteamVR driver sanity checks + Standable step to flightlist (#1825) 2026-06-22 13:06:08 +02:00
Sapphire 90956a6a02 Add support for smol receiver and tracker in serial console (#1868) 2026-06-22 13:04:16 +02:00
Sapphire 3a0dc4b922 Fix various GUI warnings, and run eslint+prettier on Electron code (#1834) 2026-06-22 12:57:53 +02:00
海雀 064e22dc1a Fix settings scroll target positioning (#1829) 2026-06-22 12:57:26 +02:00
Sapphire 7c6151fbe5 bindings-provider: Fix app key changing under certain circumstances (#1864) 2026-06-21 05:29:05 +02:00
Sapphire c8c57b1511 Fix disconnected UDP tracker sensors being marked as OK on reconnect (#1866) 2026-06-21 05:28:39 +02:00
Sapphire 5b45d26c2d Get rid of hostName checks when refreshing VRCOSC settings (#1867) 2026-06-21 05:27:37 +02:00
Stephen Smith 2b82638961 Tolerate dragging during button presses for easier VR controller usage (disable link dragging on buttons) closes #1873 (#1875) 2026-06-21 05:26:28 +02:00
Sapphire 8df1e3dc4c Bump electron-builder to 26.15.0, improve Nix flake (#1876) 2026-06-21 05:26:09 +02:00
Sapphire a45925bc36 Fix GUI on Android/non-Electron (#1877) 2026-06-21 05:25:50 +02:00
lucas lelievre 9835222762 Delete .github/workflows/label.yml 2026-06-12 15:47:56 +02:00
Sapphire 69068bbf17 Set skipCheckUdev feature flag to true by default (#1870) 2026-06-10 23:34:58 +02:00
lucas lelievre ba02688a82 Delete .github/labeler.yml 2026-05-28 18:09:55 +02:00
Sapphire 65bdf2fffb Add origin field to Device, fix automatic tracker toggling with VIVEs (#1847) 2026-05-28 09:50:20 +02:00
Sapphire 13ee32c903 Automatic driver installation fixes (#1859) 2026-05-28 09:49:33 +02:00
Sapphire 9748bd77c2 Remove unnecessary websocket reconnect when toggling fast data feed (#1860) 2026-05-28 09:48:08 +02:00
Sapphire d7a286863f Use callback instead of polling for network profile checker (#1861) 2026-05-28 09:47:26 +02:00
Hannahandloucass003 a1e0cd52d2 Hannah/sentry cleanup (#1862)
Co-authored-by: loucass003 <[email protected]>
2026-05-28 09:47:05 +02:00
gorbit99 d1a39dba05 Add handling for Packet 23 (#1855) 2026-05-25 11:32:14 +02:00
98 changed files with 1913 additions and 1354 deletions

No files matched your search

+4 -4
View File
@@ -1,9 +1,9 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
if ! has nix_direnv_version || ! nix_direnv_version 3.1.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.1.1/direnvrc" "sha256-p+fzQdrms/hDa7g+soShAybJNo4bN4SIAeSfqNKgD5I="
fi
nix_direnv_watch_file package.json
if ! use flake . --impure
watch_file package.json
if ! use flake .
then
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
fi
-37
View File
@@ -1,37 +0,0 @@
"Area: Continuous Integration":
- changed-files:
- any-glob-to-any-file: ".github/**"
"Area: Application Protocol":
- changed-files:
- any-glob-to-any-file: ["solarxr-protocol"]
"Area: AutoBone":
- changed-files:
- any-glob-to-any-file: "server/core/src/main/java/dev/slimevr/autobone/**"
"Area: Documentation":
- changed-files:
- any-glob-to-any-file: "**/*.md"
"Area: GUI":
- all:
- changed-files:
- all-globs-to-any-file: ["gui/**/*", "!gui/public/i18n/**/*"]
"Area: Hardware Protocol":
- changed-files:
- any-glob-to-any-file: "server/core/src/main/java/dev/slimevr/tracking/trackers/udp/**"
"Area: Server":
- changed-files:
- any-glob-to-any-file: ["server/**", "*gradle*", "gradle/**"]
"Area: Skeletal Model":
- changed-files:
- any-glob-to-any-file: "server/core/src/main/java/dev/slimevr/tracking/processor/**"
"Area: SteamVR Driver":
- changed-files:
- any-glob-to-any-file: "server/desktop/src/main/java/dev/slimevr/desktop/platform/**"
"Area: Translation":
- changed-files:
- any-glob-to-any-file: "gui/public/i18n/**"
"Area: VMC":
- changed-files:
- any-glob-to-any-file: ["server/core/src/main/java/dev/slimevr/osc/Unity*", "server/core/src/main/java/dev/slimevr/osc/VMC*", "server/core/src/main/java/dev/slimevr/osc/VRM*"]
"Area: VRCOSC":
- changed-files:
- any-glob-to-any-file: ["server/core/src/main/java/dev/slimevr/osc/VRC*"]
+3 -3
View File
@@ -93,7 +93,7 @@ jobs:
with:
submodules: recursive
- name: Set up JDK 17
uses: actions/setup-java@v5
uses: actions/setup-java@v6
with:
java-version: '17'
distribution: 'adopt'
@@ -114,7 +114,7 @@ jobs:
- name: Get tags
run: git fetch --tags origin --recurse-submodules=no --force
- name: Set up JDK 17
uses: actions/setup-java@v5
uses: actions/setup-java@v6
with:
java-version: '17'
distribution: 'adopt'
@@ -261,7 +261,7 @@ jobs:
- name: Get tags
run: git fetch --tags origin --recurse-submodules=no --force
- name: Set up JDK 17
uses: actions/setup-java@v5
uses: actions/setup-java@v6
with:
java-version: '17'
distribution: 'adopt'
+36
View File
@@ -0,0 +1,36 @@
name: Test Crowdin Sync (Dry Run)
on:
workflow_dispatch:
inputs:
dry_run:
description: 'Perform a dry run (logs changes without modifying repository)'
type: boolean
default: true
localization_branch:
description: 'Branch to target for translations'
type: string
default: 'l10n_main'
jobs:
test-crowdin:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: recursive
- name: Test Crowdin Synchronization
uses: crowdin/github-action@v2
with:
upload_sources: true
upload_translations: false
download_translations: true
localization_branch_name: ${{ inputs.localization_branch }}
dry_run: ${{ inputs.dry_run }}
create_pull_request: false
env:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
-22
View File
@@ -1,22 +0,0 @@
# This workflow will triage pull requests and apply a label based on the
# paths that are modified in the pull request.
#
# To use this workflow, you will need to set up a .github/labeler.yml
# file with configuration. For more information, see:
# https://github.com/actions/labeler
name: Labeler
on: [pull_request_target]
jobs:
label:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/labeler@v6
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
+3 -2
View File
@@ -3,6 +3,7 @@ on:
push:
branches:
- pontoon
- l10n_main
jobs:
pull_request:
if: ${{ github.repository == 'SlimeVR/SlimeVR-Server' }}
@@ -17,5 +18,5 @@ jobs:
env:
GH_TOKEN: ${{ secrets.PONTOON_BOT_KEY }}
run: |
gh_pr_up() { gh pr create "$@" --label "Area: Translation" --base main || gh pr edit "$@"; }
gh_pr_up --title "New Pontoon translations" --body "Please don't squash me 🥺"
gh_pr_up() { gh pr create "$@" --draft --base main || gh pr edit "$@"; }
gh_pr_up --title "New translations" --body "Please don't squash me 🥺"
+34 -4
View File
@@ -1,14 +1,44 @@
# This workflow will rebase `pontoon` with `main` changes, it's for making the
# Pontoon bot not try making commits to main
# This workflow will rebase `l10n_main` and `pontoon` with `main` changes, it's for making the
# translation bots not try making commits to main
name: Rebase pontoon branch to main
name: Rebase translation branches to main
on:
push:
branches:
- main
jobs:
rebase:
rebase-l10n:
if: ${{ github.repository == 'SlimeVR/SlimeVR-Server' }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
ref: l10n_main
submodules: recursive
# Get all the git history for rebasing
fetch-depth: 0
- name: Rebase
run: |
git config --local user.name "slimevr-bot"
git config --local user.email '[email protected]'
git fetch origin main
git rebase origin/main
git submodule update
- name: Push rebase
uses: github-actions-x/[email protected]
with:
github-token: ${{ secrets.PONTOON_BOT_KEY }}
push-branch: "l10n_main"
commit-message: "update"
force-push: "true"
name: "slimevr-bot"
email: "[email protected]"
rebase-pontoon:
if: ${{ github.repository == 'SlimeVR/SlimeVR-Server' }}
runs-on: ubuntu-latest
permissions:
+7 -1
View File
@@ -25,7 +25,9 @@
.settings
# Node Stuff
/node_modules
node_modules/
dist/
stats.html
.husky
# kotlin stuff
@@ -33,6 +35,10 @@
# ignore gradle build folder
build/
server/desktop/config/
# created by clangd for index cache
.cache/
# direnv has been claimed for Nix usage
.direnv/
+2
View File
@@ -1,5 +1,7 @@
# Contributing to SlimeVR
Please follow general contribution guidelines: [CONTRIBUTING.md](https://github.com/SlimeVR/.github/blob/main/profile/CONTRIBUTING.md).
This document describes essential knowledge required to contribute to the SlimeVR Server.
### Prerequisites
+12
View File
@@ -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)"
}
+12
View File
@@ -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 {} \;
+43 -1
View File
@@ -15,6 +15,13 @@
#include "openvr.h"
#ifdef _WIN32
#include <Windows.h>
#else
#include <cstdlib>
#endif
namespace fs = std::filesystem;
using namespace std::chrono_literals;
using namespace solarxr_protocol;
@@ -96,6 +103,35 @@ static void signal_handler(int signal) {
int main() {
auto &logger = Logger::get();
// 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", STEAM_APPID);
SetEnvironmentVariableA("STEAMVR_APPKEY", STEAMVR_APPKEY);
#else
setenv("SteamAppId", STEAM_APPID, 1);
setenv("STEAMVR_APPKEY", STEAMVR_APPKEY, 1);
#endif
try {
SolarXRConnection conn;
std::unique_ptr<vr::IVRSystem, decltype(&shutdown_vr)> sys{ nullptr,
@@ -128,14 +164,20 @@ int main() {
vr::IVRApplications *app = vr::VRApplications();
vr::IVRInput *input = vr::VRInput();
auto [appManifestPath, actionManifestPath] = VRUtils::initialiseManifest();
fs::path actionManifestPath;
std::tie(std::ignore, actionManifestPath) = VRUtils::initialiseManifest();
// We don't want our app key to randomly change if SteamVR decides to honour
// application manifests with no binary path. Instead let it generate an
// app key based on the executable name (system.generated.[lowercase executable name])
#if false
if (auto err = app->AddApplicationManifest(appManifestPath.string().data(), true);
err != vr::VRApplicationError_None) {
logger.error("Failed to add application manifest: {}",
app->GetApplicationsErrorNameFromEnum(err));
return 1;
}
#endif
// SetActionManifestPath may return IPCError if vrserver is busy and takes
// too long to reply, so keep invoking until it succeeds
+17 -6
View File
@@ -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(
-3
View File
@@ -1,3 +0,0 @@
plugins {
id("org.ajoberstar.grgit")
}
+19
View File
@@ -0,0 +1,19 @@
# Crowdin Configuration File
# https://developer.crowdin.com/configuration-file/
project_id_env: CROWDIN_PROJECT_ID
api_token_env: CROWDIN_PERSONAL_TOKEN
files:
- source: /gui/app/public/i18n/en/translation.ftl
translation: /gui/app/public/i18n/%locale%/%original_file_name%
languages_mapping:
locale:
zh-CN: zh-Hans
zh-TW: zh-Hant
nb: nb-NO
nb-NO: nb-NO
sv: sv-SE
sv-SE: sv-SE
en-OWO: en-x-owo
owo: en-x-owo
Generated
+6 -6
View File
@@ -5,11 +5,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1777988971,
"narHash": "sha256-qIoWPDs+0/8JecyYgE3gpKQxW/4bLW/gp45vow9ioCQ=",
"lastModified": 1778716662,
"narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "0678d8986be1661af6bb555f3489f2fdfc31f6ff",
"rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb",
"type": "github"
},
"original": {
@@ -20,11 +20,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1777954456,
"narHash": "sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9+hrDTkDU=",
"lastModified": 1781577229,
"narHash": "sha256-lrp67w8AulE9Ks53n27I45ADSzbOCn4H+CNW1Ck8B+8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "549bd84d6279f9852cae6225e372cc67fb91a4c1",
"rev": "567a49d1913ce81ac6e9582e3553dd90a955875f",
"type": "github"
},
"original": {
+134 -69
View File
@@ -14,86 +14,151 @@
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" ];
systems = [
"aarch64-linux"
"x86_64-linux"
];
perSystem =
{ pkgs, ... }:
{ lib, pkgs, ... }:
let
runtimeLibs =
pkgs:
(with pkgs; [
jdk17
runtimeLibs = [
pkgs.alsa-lib
pkgs.libpulseaudio
pkgs.at-spi2-atk
pkgs.at-spi2-core
pkgs.cairo
pkgs.cups
pkgs.dbus
pkgs.expat
pkgs.gdk-pixbuf
pkgs.glib
pkgs.gtk3
pkgs.libdrm
pkgs.libgbm
pkgs.libglvnd
pkgs.libnotify
pkgs.libxkbcommon
pkgs.mesa
pkgs.nspr
pkgs.nss
pkgs.pango
pkgs.systemd
pkgs.vulkan-loader
pkgs.wayland
pkgs.libX11
pkgs.libXcomposite
pkgs.libXdamage
pkgs.libXext
pkgs.libXfixes
pkgs.libXrandr
pkgs.libxcb
pkgs.libxshmfence
pkgs.libusb1
pkgs.udev
pkgs.libxcrypt-legacy
];
alsa-lib
libpulseaudio
at-spi2-atk
at-spi2-core
cairo
cups
dbus
expat
gdk-pixbuf
glib
gtk3
libdrm
libgbm
libglvnd
libnotify
libxkbcommon
mesa
nspr
nss
pango
systemd
vulkan-loader
wayland
libX11
libXcomposite
libXdamage
libXext
libXfixes
libXrandr
libxcb
libxshmfence
libusb1
udev
libxcrypt-legacy
rpm
fpm
toolDirectoryName =
if pkgs.stdenv.hostPlatform.isDarwin then
"darwin"
else if pkgs.stdenv.hostPlatform.isLinux then
{
"armv7l-linux" = "linux-arm32";
"aarch64-linux" = "linux-arm64";
"i686-linux" = "linux-ia32";
"x86_64-linux" = "linux-x64";
}
."${pkgs.stdenv.hostPlatform.system}"
else
throw "Unsupported platform";
wineWow64Packages.stable
zlib
squashfsTools
fakeroot
libarchive
icu
nodejs_22
pnpm
pkg-config
python3
gcc
gnumake
binutils
git
node-gyp-build
]);
# we use fuse2
# https://github.com/electron-userland/electron-builder/blob/a6117b3011a105204af8cc2eca02a56976d1ef29/packages/app-builder-lib/src/toolsets/linux.ts#L122
runtime = pkgs.stdenvNoCC.mkDerivation {
name = "electron-builder-appimage-runtime";
src = pkgs.fetchurl {
url = "https://github.com/electron-userland/electron-builder-binaries/releases/download/appimage-12.0.1/appimage-12.0.1.7z";
hash = "sha256-0S/3648dHsRlLKUjen+9yjOswMdYBFY2/spi3G7LjsQ=";
};
# https://github.com/NixOS/nixpkgs/blob/7890ba0a99c064446fe2178ef2f8e3abdf6ec42a/pkgs/by-name/lo/losslesscut-bin/build-from-windows.nix#L20
nativeBuildInputs = [ pkgs.p7zip ];
unpackPhase = ''
runHook preUnpack
7z x "$src"
runHook postUnpack
'';
installPhase = ''
mkdir $out
cp -r -t $out/ \
lib/ \
runtime-*
'';
};
slimeShell = pkgs.buildFHSEnv {
name = "slimevr-env";
targetPkgs = runtimeLibs;
profile = ''
export JAVA_HOME=${pkgs.jdk17}
export PATH="${pkgs.jdk17}/bin:$PATH"
appImageTools = pkgs.stdenvNoCC.mkDerivation {
name = "electron-builder-appimage-tools";
dontUnpack = true;
# Tell electron-builder to use system tools instead of downloading them
export USE_SYSTEM_FPM=true
export USE_SYSTEM_MKSQUASHFS=true
installPhase = ''
mkdir -p "$out/${toolDirectoryName}"
ln -s -t $out/${toolDirectoryName} \
"${pkgs.desktop-file-utils}/bin/desktop-file-validate" \
"${pkgs.squashfsTools}/bin/mksquashfs"
ln -s ${runtime}/runtime-* $out/
ln -s ${runtime}/lib $out/lib
'';
runScript = "bash";
};
in
{
devShells.default = slimeShell.env;
devShells.default = pkgs.mkShell {
packages = [
# for running the jar
pkgs.jdk17
# for build
pkgs.electron
pkgs.rpm
pkgs.fpm
pkgs.p7zip
pkgs.wineWow64Packages.stable
pkgs.zlib
pkgs.squashfsTools
pkgs.desktop-file-utils
pkgs.fakeroot
pkgs.libarchive
pkgs.icu
pkgs.nodejs_22
pkgs.pnpm
pkgs.pkg-config
pkgs.python3
pkgs.gcc
pkgs.gnumake
pkgs.binutils
pkgs.git
pkgs.node-gyp-build
];
buildInputs = runtimeLibs;
JAVA_HOME = "${pkgs.jdk17}/lib/openjdk";
USE_SYSTEM_FPM = "true";
ELECTRON_BUILDER_7ZIP_PATH = "${pkgs.p7zip}/bin/7za";
APPIMAGE_TOOLS_PATH = "${appImageTools}";
#ELECTRON_SKIP_BINARY_DOWNLOAD = true;
#ELECTRON_DIST = "${pkgs.electron.dist}";
#ELECTRON_VERSION = "${pkgs.electron.version}";
# for electron-vite, so `pnpm gui` works
ELECTRON_EXEC_PATH = "${pkgs.electron}/bin/electron";
shellHook = ''
export LD_LIBRARY_PATH="${
lib.makeLibraryPath [
pkgs.systemd
pkgs.hidapi
]
}:$LD_LIBRARY_PATH"
'';
};
};
};
}
+1 -4
View File
@@ -17,10 +17,7 @@ kotlinVersion=2.3.10
spotlessVersion=8.2.1
shadowJarVersion=9.3.1
buildconfigVersion=6.0.7
# We should probably stop using grgit, see:
# https://andrewoberstar.com/posts/2024-04-02-dont-commit-to-grgit/
grgitVersion=5.3.3
# Fix gradle leaving multiple java processes running that accumulate and use multiple GBs of RAM
# This mostly seems to affect it when running from console, and then sending a SIGINT (Ctrl + C)
org.gradle.daemon.idletimeout=10000
org.gradle.daemon.idletimeout=10000
+1 -1
View File
@@ -1,5 +1,5 @@
export default {
'**/*.{ts,tsx}': () => 'tsc -p tsconfig.json --noEmit',
'src/**/*.{js,jsx,ts,tsx}': 'eslint --max-warnings=0 --no-warn-ignored --cache --fix',
'{electron,src}/**/*.{js,jsx,ts,tsx}': 'eslint --max-warnings=0 --no-warn-ignored --cache --fix',
'**/*.{js,jsx,ts,tsx,css,scss,md,json}': 'prettier --write',
};
+16 -22
View File
@@ -1,21 +1,15 @@
import { defineConfig } from 'electron-vite'
import { resolve } from 'path'
import rendererConfig from './vite.config' // Import your existing React config
import { defineConfig } from 'electron-vite';
import { resolve } from 'path';
import rendererConfig from './vite.config'; // Import your existing React config
export default defineConfig({
main: {
build: {
rollupOptions: {
input: resolve(__dirname, 'electron/main/index.ts'),
external: [
'pino',
'pino-pretty',
'pino-roll',
'commander',
'open'
]
}
}
external: ['pino', 'pino-pretty', 'pino-roll', 'commander', 'open'],
},
},
},
preload: {
build: {
@@ -23,12 +17,12 @@ export default defineConfig({
input: resolve(__dirname, 'electron/preload/index.ts'),
output: {
format: 'cjs', // Force CJS for the preload
entryFileNames: 'index.js' // Change back to .js
}
}
}
entryFileNames: 'index.js', // Change back to .js
},
},
},
},
renderer: {
renderer: {
...rendererConfig,
root: '.',
build: {
@@ -40,8 +34,8 @@ export default defineConfig({
transformMixedEsModules: true,
},
rollupOptions: {
input: resolve(__dirname, 'index.html')
}
}
}
})
input: resolve(__dirname, 'index.html'),
},
},
},
});
+3 -3
View File
@@ -1,4 +1,4 @@
import { Option, program } from "commander";
import { Option, program } from 'commander';
program
.option('-p, --path <path>', 'set launch path')
@@ -12,10 +12,10 @@ program
// Allow passing arguments to Electron.
.allowExcessArguments();
if (process.platform === "linux") {
if (process.platform === 'linux') {
const noUdevOption = new Option('--no-udev', 'disable udev warning');
noUdevOption.negate = false;
program.addOption(noUdevOption)
program.addOption(noUdevOption);
}
program.parse(process.argv);
+27 -25
View File
@@ -127,14 +127,14 @@ handleIpc(IPC_CHANNELS.LOG, (e, type, ...args) => {
});
handleIpc(IPC_CHANNELS.OPEN_URL, (e, url) => {
const allowed_urls = [
const allowedUrls = [
/^steam:\/\//,
/^ms-settings:network$/,
/^https:\/\/(?:.+\.)?slimevr\.dev(?:\/.+)?$/,
/^https:\/\/github\.com\/SlimeVR(?:\/.+)?$/,
/^https:\/\/discord\.gg\/slimevr$/,
];
if (allowed_urls.find((a) => url.match(a))) open(url);
if (allowedUrls.find((a) => url.match(a))) open(url);
else logger.error({ url }, 'attempted to open non-whitelisted URL');
});
@@ -156,8 +156,7 @@ handleIpc(IPC_CHANNELS.STORAGE, async (e, { type, method, key, value }) => {
handleIpc(IPC_CHANNELS.DISCORD_PRESENCE, async (e, options) => {
if (options.enable) {
if (!discordPresence.state.ready)
await discordPresence.connect();
if (!discordPresence.state.ready) await discordPresence.connect();
discordPresence.updateActivity(options.activity, options.iconText);
} else if (discordPresence.state.ready) {
discordPresence.destroy();
@@ -193,6 +192,10 @@ handleIpc(IPC_CHANNELS.GET_FOLDER, (e, folder) => {
}
});
handleIpc(IPC_CHANNELS.IS_STEAM, () => {
return options.steam;
});
const defaultWindowState: {
width: number;
height: number;
@@ -208,11 +211,11 @@ const defaultWindowState: {
const windowState = await readFile(getWindowStateFile(), {
encoding: 'utf-8',
})
.then(data => JSON.parse(data))
.catch(() => {
logger.error('Failed to load window state, using defaults');
return defaultWindowState;
});
.then((data) => JSON.parse(data))
.catch(() => {
logger.error('Failed to load window state, using defaults');
return defaultWindowState;
});
const MIN_WIDTH = 393;
const MIN_HEIGHT = 667;
@@ -245,7 +248,9 @@ function validateWindowState(state: typeof defaultWindowState) {
const saveWindowState = async () => {
await mkdir(dirname(getWindowStateFile()), { recursive: true });
await writeFile(getWindowStateFile(), JSON.stringify(windowState), { encoding: 'utf-8' });
await writeFile(getWindowStateFile(), JSON.stringify(windowState), {
encoding: 'utf-8',
});
};
function createWindow() {
@@ -293,10 +298,8 @@ function createWindow() {
mainWindow.minimize();
break;
case 'toggle-maximize':
if (mainWindow.isMaximized())
mainWindow.unmaximize();
else
mainWindow.maximize();
if (mainWindow.isMaximized()) mainWindow.unmaximize();
else mainWindow.maximize();
break;
}
});
@@ -368,9 +371,9 @@ function createWindow() {
}
const checkEnvironmentVariables = () => {
const to_check = ['_JAVA_OPTIONS', 'JAVA_TOOL_OPTIONS'];
const disallowedVars = ['_JAVA_OPTIONS', 'JAVA_TOOL_OPTIONS'];
const set = to_check.filter((env) => !!process.env[env]);
const set = disallowedVars.filter((env) => !!process.env[env]);
if (set.length > 0) {
dialog.showErrorBox(
'SlimeVR',
@@ -401,9 +404,9 @@ const spawnServer = async () => {
if (!javaBin) {
dialog.showErrorBox(
'SlimeVR',
`Couldn't find a compatible Java version, please download Java 17 or higher`
'Unable to find a compatible Java version, please download Java 17 or higher'
);
app.quit()
app.quit();
return;
}
@@ -425,7 +428,9 @@ const spawnServer = async () => {
? {
...process.env,
APPDATA: app.getPath('appData'),
LOCALAPPDATA: process.env['USERPROFILE'] ? path.join(process.env['USERPROFILE'], 'AppData', 'Local') : undefined,
LOCALAPPDATA: process.env['USERPROFILE']
? path.join(process.env['USERPROFILE'], 'AppData', 'Local')
: undefined,
}
: undefined,
});
@@ -447,11 +452,11 @@ const spawnServer = async () => {
serverProcess.on('error', (err) => {
logger.info({ err }, 'Error launching the java server');
if (!isQuitting) app.quit();
})
});
serverProcess.on('exit', () => {
logger.info('Server process exiting');
})
});
const exited = new Promise<void>((resolve) => serverProcess.once('exit', resolve));
@@ -465,8 +470,7 @@ const spawnServer = async () => {
const createFolders = async () => {
await mkdir(getServerDataFolder(), { recursive: true });
await mkdir(getGuiDataFolder(), { recursive: true });
}
};
let isQuitting = false;
@@ -477,7 +481,6 @@ app.whenReady().then(async () => {
return net.fetch(pathToFileURL(filePath).toString(), { headers: request.headers });
});
try {
await createFolders();
} catch (err) {
@@ -490,7 +493,6 @@ app.whenReady().then(async () => {
return;
}
stores = await initStores();
checkEnvironmentVariables();
const server = await spawnServer();
+15 -8
View File
@@ -1,8 +1,7 @@
import { access, mkdir, readFile, writeFile } from "fs/promises";
import { dirname, join } from "path";
import { logger } from "./logger";
import { getGuiDataFolder } from "./paths";
import { access, mkdir, readFile, writeFile } from 'fs/promises';
import { dirname, join } from 'path';
import { logger } from './logger';
import { getGuiDataFolder } from './paths';
export class CustomStore {
private data: Record<string, unknown> = {};
@@ -15,7 +14,10 @@ export class CustomStore {
this.debounceMs = debounceMs;
}
static async create(filePath: string, debounceMs: number = 2000): Promise<CustomStore> {
static async create(
filePath: string,
debounceMs: number = 2000
): Promise<CustomStore> {
const store = new CustomStore(filePath, debounceMs);
await store.load();
return store;
@@ -28,7 +30,9 @@ export class CustomStore {
this.data = JSON.parse(raw);
} catch {
this.data = {};
logger.warn(`No existing store found at ${this.filePath}, starting with empty store.`);
logger.warn(
`No existing store found at ${this.filePath}, starting with empty store.`
);
}
}
@@ -73,7 +77,10 @@ export class CustomStore {
export async function initStores() {
return {
settings: await CustomStore.create(join(getGuiDataFolder(), 'gui-settings.dat'), 1000),
settings: await CustomStore.create(
join(getGuiDataFolder(), 'gui-settings.dat'),
1000
),
cache: await CustomStore.create(join(getGuiDataFolder(), 'gui-cache.dat'), 100),
};
}
+18 -19
View File
@@ -1,8 +1,8 @@
import os from 'os'
import { OSStats } from "../preload/interface";
import os from 'os';
import { OSStats } from '../preload/interface';
import { ipcMain, IpcMainInvokeEvent } from 'electron';
import { IpcInvokeMap } from '../shared';
import net from 'net'
import net from 'net';
export const getPlatform = (): OSStats['type'] => {
switch (os.platform()) {
@@ -19,21 +19,21 @@ export const getPlatform = (): OSStats['type'] => {
export const isPortAvailable = (port: number) => {
return new Promise((resolve) => {
const s = net.createServer();
s.once('error', (err) => {
s.close();
if ("code" in err && err["code"] == "EADDRINUSE") {
resolve(false);
} else {
resolve(false);
}
});
s.once('listening', () => {
resolve(true);
s.close();
});
s.listen(port);
const s = net.createServer();
s.once('error', (err) => {
s.close();
if ('code' in err && err['code'] == 'EADDRINUSE') {
resolve(false);
} else {
resolve(false);
}
});
s.once('listening', () => {
resolve(true);
s.close();
});
s.listen(port);
});
};
export function handleIpc<K extends keyof IpcInvokeMap>(
@@ -44,7 +44,6 @@ export function handleIpc<K extends keyof IpcInvokeMap>(
) => ReturnType<IpcInvokeMap[K]>
) {
ipcMain.handle(channel, (event, ...args) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return handler(event, ...args as any);
return handler(event, ...(args as any));
});
}
+13 -3
View File
@@ -14,7 +14,8 @@ contextBridge.exposeInMainWorld('electronAPI', {
close: () => ipcRenderer.invoke(IPC_CHANNELS.WINDOW_ACTIONS, 'close'),
hide: () => ipcRenderer.invoke(IPC_CHANNELS.WINDOW_ACTIONS, 'hide'),
minimize: () => ipcRenderer.invoke(IPC_CHANNELS.WINDOW_ACTIONS, 'minimize'),
toggleMaximize: () => ipcRenderer.invoke(IPC_CHANNELS.WINDOW_ACTIONS, 'toggle-maximize'),
toggleMaximize: () =>
ipcRenderer.invoke(IPC_CHANNELS.WINDOW_ACTIONS, 'toggle-maximize'),
getStorage: async (type) => {
return {
get: (key) =>
@@ -32,10 +33,19 @@ contextBridge.exposeInMainWorld('electronAPI', {
setTranslations: () => {},
openDialog: (options) => ipcRenderer.invoke(IPC_CHANNELS.OPEN_DIALOG, options),
saveDialog: (options) => ipcRenderer.invoke(IPC_CHANNELS.SAVE_DIALOG, options),
openConfigFolder: async () => ipcRenderer.invoke(IPC_CHANNELS.OPEN_FILE, await ipcRenderer.invoke(IPC_CHANNELS.GET_FOLDER, 'config')),
openLogsFolder: async () => ipcRenderer.invoke(IPC_CHANNELS.OPEN_FILE, await ipcRenderer.invoke(IPC_CHANNELS.GET_FOLDER, 'logs')),
openConfigFolder: async () =>
ipcRenderer.invoke(
IPC_CHANNELS.OPEN_FILE,
await ipcRenderer.invoke(IPC_CHANNELS.GET_FOLDER, 'config')
),
openLogsFolder: async () =>
ipcRenderer.invoke(
IPC_CHANNELS.OPEN_FILE,
await ipcRenderer.invoke(IPC_CHANNELS.GET_FOLDER, 'logs')
),
openFile: (path) => ipcRenderer.invoke(IPC_CHANNELS.OPEN_FILE, path),
ghGet: (req) => ipcRenderer.invoke(IPC_CHANNELS.GH_FETCH, req),
setPresence: (options) => ipcRenderer.invoke(IPC_CHANNELS.DISCORD_PRESENCE, options),
getInstallDir: () => ipcRenderer.invoke(IPC_CHANNELS.GET_FOLDER, 'exe'),
isSteam: () => ipcRenderer.invoke(IPC_CHANNELS.IS_STEAM),
} satisfies IElectronAPI);
+1
View File
@@ -59,6 +59,7 @@ export interface IElectronAPI {
ghGet: <T extends GHGet>(options: T) => Promise<GHReturn[T['type']]>;
setPresence: (options: DiscordPresence) => void;
getInstallDir: () => Promise<string>;
isSteam: () => Promise<boolean>;
}
declare global {
@@ -41,6 +41,7 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="303a", ATTRS{idProduct}=="0002", MODE="0660
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="0660", TAG+="uaccess"
## SlimeVR
# smol slime dongle
SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="7690", MODE="0660", TAG+="uaccess"
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="7690", MODE="0660", TAG+="uaccess"
# SlimeNRF Receiver & Tracker
SUBSYSTEM=="usb|tty", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="7690|7692", MODE="0660", TAG+="uaccess"
# same thing but hidraw
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="7690|7692", MODE="0660", TAG+="uaccess"
+3 -1
View File
@@ -19,7 +19,8 @@ export const IPC_CHANNELS = {
OPEN_FILE: 'open-file',
GET_FOLDER: 'get-folder',
GH_FETCH: 'gh-fetch',
DISCORD_PRESENCE: 'discord-presence'
DISCORD_PRESENCE: 'discord-presence',
IS_STEAM: 'is-steam',
} as const;
export interface IpcInvokeMap {
@@ -48,4 +49,5 @@ export interface IpcInvokeMap {
options: T
) => Promise<GHReturn[T['type']]>;
[IPC_CHANNELS.DISCORD_PRESENCE]: (options: DiscordPresence) => void;
[IPC_CHANNELS.IS_STEAM]: () => boolean;
}
+1 -1
View File
@@ -39,7 +39,7 @@ export const gui = [
...globals.jest,
},
},
files: ['src/**/*.{js,jsx,ts,tsx,json}'],
files: ['{electron,src}/**/*.{js,jsx,ts,tsx,json}'],
plugins: {
'@typescript-eslint': tseslint.plugin,
'@stylistic': stylistic,
+4 -4
View File
@@ -23,9 +23,9 @@
"package:build": "pnpm build && pnpm package",
"preview": "electron-vite preview --config electron.vite.config.ts",
"skipbundler": "vite build",
"lint": "tsc --noEmit && eslint --max-warnings=0 \"src/**/*.{js,jsx,ts,tsx,json}\" && prettier --check \"src/**/*.{js,jsx,ts,tsx,css,scss,md,json}\"",
"lint:fix": "tsc --noEmit && eslint --fix --max-warnings=0 \"src/**/*.{js,jsx,ts,tsx,json}\" && pnpm run format",
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,css,scss,md,json}\"",
"lint": "tsc --noEmit && eslint --max-warnings=0 \"{electron,src}/**/*.{js,jsx,ts,tsx,json}\" && prettier --check \"{electron,src}/**/*.{js,jsx,ts,tsx,css,scss,md,json}\"",
"lint:fix": "tsc --noEmit && eslint --fix --max-warnings=0 \"{electron,src}/**/*.{js,jsx,ts,tsx,json}\" && pnpm run format",
"format": "prettier --write \"{electron,src}/**/*.{js,jsx,ts,tsx,css,scss,md,json}\"",
"javaversion-build": "cd electron/resources/java-version/ && javac JavaVersion.java && jar cvfe JavaVersion.jar JavaVersion JavaVersion.class",
"gen:javaversion": "cd electron/resources/java-version/ && javac JavaVersion.java && jar cvfe JavaVersion.jar JavaVersion JavaVersion.class",
"gen:firmware-tool": "openapi-codegen gen firmwareTool"
@@ -68,7 +68,7 @@
"dmg-license": "^1.0.11",
"dotenv": "^16.4.5",
"electron": "^40.3.0",
"electron-builder": "^26.9.0",
"electron-builder": "^26.15.0",
"electron-vite": "^5.0.0",
"@eslint/eslintrc": "^3.3.5",
"@eslint/js": "^9.39.4",
+18 -6
View File
@@ -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.
@@ -790,6 +788,12 @@ settings-serial-factory_reset-warning-cancel = Cancel
settings-serial-serial_select = Select a serial port
settings-serial-auto_dropdown_item = Auto
settings-serial-get_wifi_scan = Get WiFi Scan
settings-serial-enter_pairing = Enter Pairing
settings-serial-exit_pairing = Exit Pairing
settings-serial-calibrate = Calibrate
settings-serial-six_side_calibrate = 6-Side Calibrate
settings-serial-dfu = Enter DFU
settings-serial-meow = Meow!
settings-serial-file_type = Plain text
settings-serial-save_logs = Save To File
settings-serial-send_command = Send
@@ -1657,12 +1661,20 @@ tracking_checklist-MOUNTING_CALIBRATION = Perform a mounting calibration
tracking_checklist-FEET_MOUNTING_CALIBRATION = Perform a feet mounting calibration
tracking_checklist-FULL_RESET = Perform a full reset
tracking_checklist-FULL_RESET-desc = Some trackers need a reset to be performed.
tracking_checklist-STEAMVR_DISCONNECTED = SteamVR not running
tracking_checklist-STEAMVR_DISCONNECTED = SteamVR disconnected
tracking_checklist-STEAMVR_DISCONNECTED-desc = SteamVR is not running. Are you using it for VR?
tracking_checklist-STEAMVR_DISCONNECTED-driver_blocked-desc = The driver has been blocked by SteamVR due to a previous SteamVR crash.
tracking_checklist-STEAMVR_DISCONNECTED-driver_disabled-desc = The driver is disabled in SteamVR settings.
tracking_checklist-STEAMVR_DISCONNECTED-driver_not_installed-desc = The driver is not installed.
tracking_checklist-STEAMVR_DISCONNECTED-open = Launch SteamVR
tracking_checklist-STEAMVR_DISCONNECTED-enable = Enable driver
tracking_checklist-STEAMVR_HANDS_ENABLED = Hand trackers toggled on
tracking_checklist-STEAMVR_HANDS_ENABLED-desc = You have enabled the SteamVR virtual hand trackers. This will cause button inputs to not work in SteamVR and in games.
tracking_checklist-STEAMVR_HANDS_ENABLED-go = Disable them
tracking_checklist-STANDABLE_INSTALLED = Standable is installed
tracking_checklist-STANDABLE_INSTALLED-desc =
Standable frequently causes tracking issues when used alongside SlimeVR. Standable should be fully uninstalled in Steam to ensure no issues arise.
You must close SteamVR before uninstalling Standable in Steam.
tracking_checklist-TRACKERS_REST_CALIBRATION = Calibrate your trackers
tracking_checklist-TRACKERS_REST_CALIBRATION-desc = You didn't perform tracker calibration. Please let your trackers (highlighted in yellow) rest on a stable surface for a few seconds.
tracking_checklist-TRACKER_ERROR = Trackers with Errors
+1 -1
View File
@@ -34,7 +34,7 @@ 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 select-text',
'xs:py-3 mobile:py-4 rounded-md mobile:rounded-b-none group',
{
'bg-accent-background-50 fill-accent-background-20': doesMatch,
'hover:bg-background-70': !doesMatch,
+3 -1
View File
@@ -5,6 +5,7 @@ import {
NewSerialDeviceResponseT,
RpcMessage,
SerialDeviceT,
SerialDeviceType,
} from 'solarxr-protocol';
import { useConfig } from '@/hooks/config';
import { useWebsocketAPI } from '@/hooks/websocket-api';
@@ -56,7 +57,8 @@ export function SerialDetectionModal() {
'/settings/serial',
'/onboarding/connect-trackers',
'/settings/firmware-tool',
].includes(pathname)
].includes(pathname) &&
device?.type !== SerialDeviceType.HID_RECEIVER
) {
setOpen(device);
}
@@ -14,13 +14,13 @@ export function InnerSystemFileInput({
value,
onChange,
directory,
ref,
refCallback: refCallback,
}: {
label: string;
value: string | null;
onChange: (...event: any[]) => void;
directory: boolean;
ref: RefCallBack;
refCallback: RefCallBack;
}) {
const electron = useElectron();
@@ -38,7 +38,7 @@ export function InnerSystemFileInput({
};
return (
<div ref={ref} onClick={handleClick}>
<div ref={refCallback} onClick={handleClick}>
{value !== null
? FileInputContentFile({
directory,
@@ -77,7 +77,7 @@ export function SystemFileInput<T extends FieldValues = FieldValues>({
label={label}
value={value}
onChange={onChange}
ref={ref}
refCallback={ref}
directory={directory}
/>
)}
@@ -13,6 +13,7 @@ import {
NewSerialDeviceResponseT,
RpcMessage,
SerialDeviceT,
SerialDeviceType,
SerialDevicesRequestT,
SerialDevicesResponseT,
TrackerStatus,
@@ -77,13 +78,14 @@ function SerialDevicesList({
RpcMessage.SerialDevicesResponse,
(res: SerialDevicesResponseT) => {
setDevices(
res.devices.reduce(
(curr, device) => ({
res.devices.reduce((curr, device) => {
if (device?.type != SerialDeviceType.ESP_TRACKER) return curr;
return {
...curr,
[device?.port?.toString() ?? 'unknown']: device,
}),
{}
)
};
}, {})
);
setLoading(false);
}
@@ -92,7 +94,7 @@ function SerialDevicesList({
useRPCPacket(
RpcMessage.NewSerialDeviceResponse,
({ device }: NewSerialDeviceResponseT) => {
if (device?.port)
if (device?.port && device?.type === SerialDeviceType.ESP_TRACKER)
setDevices((old) => ({
...old,
[device?.port?.toString() ?? 'unknown']: device,
@@ -28,7 +28,7 @@ function IncrementButton({
<div
onClick={onClick}
className={classNames(
'p-3 rounded-lg xs:w-10 xs:h-10 flex flex-col justify-center items-center cursor-pointer',
'no-user-drag p-3 rounded-lg xs:w-10 xs:h-10 flex flex-col justify-center items-center cursor-pointer',
'hover:bg-opacity-50 active:bg-accent-background-30',
{ 'bg-background-60': bgDark, 'bg-background-40': !bgDark }
)}
@@ -34,7 +34,7 @@ function IncrementButton({
return (
<div
className={classNames(
'flex rounded-md items-center justify-center flex-row xs:flex-col w-full gap-1 p-3 xs:p-2 xs:w-[75px] xs:h-[75px]',
'no-user-drag flex rounded-md items-center justify-center flex-row xs:flex-col w-full gap-1 p-3 xs:p-2 xs:w-[75px] xs:h-[75px]',
{
'cursor-not-allowed bg-background-80 opacity-50': disabled,
'bg-background-50 hover:bg-background-40 cursor-pointer': !disabled,
@@ -74,7 +74,7 @@ function UnitSelector({
'bg-accent-background-30': active,
'hover:bg-background-40 bg-background-40': !active,
},
'flex items-center justify-center rounded-md outline-background-10 cursor-pointer'
'no-user-drag flex items-center justify-center rounded-md outline-background-10 cursor-pointer'
)}
onClick={onClick}
>
@@ -29,8 +29,8 @@ function PosePage({
return (
<div className="flex flex-col py-2">
<div className="flex flex-col gap-2">
{descriptionKeys.map((descriptionKey) => (
<Typography>{l10n.getString(descriptionKey)}</Typography>
{descriptionKeys.map((descriptionKey, i) => (
<Typography key={i}>{l10n.getString(descriptionKey)}</Typography>
))}
</div>
<div className="flex pt-1 items-center fill-background-50 justify-center px-12">
@@ -3,10 +3,11 @@ import { ConfigContextC, loadConfig, useConfigProvider } from '@/hooks/config';
import { getSentryOrCompute } from '@/utils/sentry';
const config = await loadConfig();
const isSteam = window.electronAPI ? await window.electronAPI.isSteam() : false;
if (config?.errorTracking !== undefined) {
// load sentry ASAP to catch early errors
getSentryOrCompute(config.errorTracking ?? false, config.uuid);
getSentryOrCompute(config.errorTracking ?? false, config.uuid, isSteam);
}
export function ConfigContextProvider({ children }: { children: ReactNode }) {
@@ -1,7 +1,6 @@
import classNames from 'classnames';
import { ReactNode, useEffect, useRef } from 'react';
import { useLocation } from 'react-router-dom';
import { useBreakpoint } from '@/hooks/breakpoint';
export function SettingsPageLayout({
children,
@@ -12,7 +11,6 @@ export function SettingsPageLayout({
} & React.HTMLAttributes<HTMLDivElement>) {
const pageRef = useRef<HTMLDivElement | null>(null);
const { state } = useLocation();
const { isMobile } = useBreakpoint('mobile');
useEffect(() => {
const typedState: { scrollTo: string } = state;
@@ -23,19 +21,10 @@ export function SettingsPageLayout({
`#${typedState.scrollTo}`
) as HTMLElement | null;
if (elem) {
// stupid way of doing this, just get the closest overflow-y-auto
// usually its just the parentElem
const closestScroll = elem.closest(
'.overflow-y-auto'
) as HTMLElement | null;
if (closestScroll) {
// The 45 is just enough padding for making the scroll look perfect
const topPadding = isMobile ? 80 : 45;
closestScroll.scroll({
top: elem.offsetTop - topPadding,
behavior: 'smooth',
});
}
elem.scrollIntoView({
block: 'start',
behavior: 'smooth',
});
}
}, [state]);
@@ -58,7 +47,7 @@ export function SettingsPagePaneLayout({
return (
<div
className={classNames(
'bg-background-70 rounded-lg px-4 py-8 flex xs:gap-4 w-full relative',
'bg-background-70 rounded-lg px-4 py-8 flex xs:gap-4 w-full relative scroll-mt-12 mobile:scroll-mt-20',
className
)}
{...props}
@@ -10,8 +10,11 @@ import { Button } from '@/components/commons/Button';
import { SettingsResetModal } from '@/components/settings/SettingsResetModal';
import { error } from '@/utils/logging';
import { defaultConfig as defaultGUIConfig, useConfig } from '@/hooks/config';
import { defaultValues as defaultDevConfig } from '@/components/widgets/DeveloperModeWidget';
import {
defaultDevSettings,
defaultConfig as defaultGUIConfig,
useConfig,
} from '@/hooks/config';
import { RpcMessage, SettingsResetRequestT } from 'solarxr-protocol';
import { useWebsocketAPI } from '@/hooks/websocket-api';
import { useElectron } from '@/hooks/electron';
@@ -21,7 +24,7 @@ function guiDefaults() {
const { lang, ...guiDefaults } = defaultGUIConfig;
guiDefaults.devSettings = defaultDevConfig;
guiDefaults.devSettings = defaultDevSettings;
return guiDefaults;
}
@@ -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,21 +1331,7 @@ export function GeneralSettings() {
/>
</div>
<div>
<Typography variant="section-title">
{l10n.getString(
'settings-general-gesture_control-mountingResetTracker'
)}
</Typography>
<Dropdown
display="block"
control={control}
placeholder={''}
name="tapDetection.mountingResetTracker"
items={bodyParts}
/>
</div>
<div>
<Typography variant="section-title">
<Typography bold>
{l10n.getString(
'settings-general-gesture_control-fullResetTracker'
)}
@@ -1358,6 +1344,20 @@ export function GeneralSettings() {
items={bodyParts}
/>
</div>
<div>
<Typography bold>
{l10n.getString(
'settings-general-gesture_control-mountingResetTracker'
)}
</Typography>
<Dropdown
display="block"
control={control}
placeholder={''}
name="tapDetection.mountingResetTracker"
items={bodyParts}
/>
</div>
</div>
</div>
<div className="grid sm:grid-cols-3 gap-5 pb-2">
@@ -1,13 +1,13 @@
import { Localized, useLocalization } from '@fluent/react';
import { useEffect } from 'react';
import { useForm } from 'react-hook-form';
import { FieldPath, useForm } from 'react-hook-form';
import { CheckBox } from '@/components/commons/Checkbox';
import { Typography } from '@/components/commons/Typography';
import {
SettingsPageLayout,
SettingsPagePaneLayout,
} from '@/components/settings/SettingsPageLayout';
import { defaultConfig, useConfig } from '@/hooks/config';
import { defaultConfig, DeveloperModeConfig, useConfig } from '@/hooks/config';
import { ThemeSelector } from '@/components/commons/ThemeSelector';
import { SquaresIcon } from '@/components/commons/icon/SquaresIcon';
import { NumberSelector } from '@/components/commons/NumberSelector';
@@ -18,7 +18,6 @@ import { Range } from '@/components/commons/Range';
import { Dropdown } from '@/components/commons/Dropdown';
import { ArrowRightLeftIcon } from '@/components/commons/icon/ArrowIcons';
import { SystemFileInput } from '@/components/commons/SystemFileInput';
import { DeveloperModeWidget } from '@/components/widgets/DeveloperModeWidget';
import { useElectron } from '@/hooks/electron';
interface InterfaceSettingsForm {
@@ -28,7 +27,6 @@ interface InterfaceSettingsForm {
fonts: string;
};
behavior: {
devmode: boolean;
useTray: boolean;
discordPresence: boolean;
errorTracking: boolean;
@@ -40,6 +38,9 @@ interface InterfaceSettingsForm {
feedbackSoundVolume: number;
connectedTrackersWarning: boolean;
};
developer: DeveloperModeConfig & {
enabled: boolean;
};
}
export function InterfaceSettings() {
@@ -65,13 +66,35 @@ export function InterfaceSettings() {
defaultConfig.connectedTrackersWarning,
},
behavior: {
devmode: config?.debug ?? defaultConfig.debug,
useTray: config?.useTray ?? defaultConfig.useTray ?? false,
discordPresence:
config?.discordPresence ?? defaultConfig.discordPresence,
errorTracking: config?.errorTracking ?? false,
bvhDirectory: config?.bvhDirectory ?? defaultConfig.bvhDirectory,
},
developer: {
enabled: config?.debug ?? defaultConfig.debug,
highContrast:
config?.devSettings?.highContrast ??
defaultConfig.devSettings.highContrast,
preciseRotation:
config?.devSettings?.preciseRotation ??
defaultConfig.devSettings.preciseRotation,
fastDataFeed:
config?.devSettings?.fastDataFeed ??
defaultConfig.devSettings.fastDataFeed,
filterSlimesAndHMD:
config?.devSettings?.filterSlimesAndHMD ??
defaultConfig.devSettings.filterSlimesAndHMD,
sortByName:
config?.devSettings?.sortByName ??
defaultConfig.devSettings.sortByName,
rawSlimeRotation:
config?.devSettings?.rawSlimeRotation ??
defaultConfig.devSettings.rawSlimeRotation,
moreInfo:
config?.devSettings?.moreInfo ?? defaultConfig.devSettings.moreInfo,
},
},
});
@@ -112,9 +135,11 @@ export function InterfaceSettings() {
useTray: values.behavior.useTray,
discordPresence: values.behavior.discordPresence,
debug: values.behavior.devmode,
errorTracking: values.behavior.errorTracking,
bvhDirectory: values.behavior.bvhDirectory,
debug: values.developer.enabled,
devSettings: values.developer,
});
};
@@ -128,6 +153,16 @@ export function InterfaceSettings() {
return () => subscription.unsubscribe();
}, []);
const devToggles = {
highContrast: 'high_contrast',
preciseRotation: 'precise_rotation',
fastDataFeed: 'fast_data_feed',
filterSlimesAndHMD: 'filter_slimes_and_hmd',
sortByName: 'sort_by_name',
rawSlimeRotation: 'raw_slime_rotation',
moreInfo: 'more_info',
};
return (
<SettingsPageLayout>
<form
@@ -299,18 +334,31 @@ export function InterfaceSettings() {
</Typography>
</div>
<div className="grid grid-cols-1 gap-2 pb-4 w-full">
<div className="">
<CheckBox
variant="toggle"
control={control}
outlined
name="behavior.devmode"
label={l10n.getString(
'settings-general-interface-dev_mode-label'
)}
/>
</div>
{config?.debug && <DeveloperModeWidget />}
<CheckBox
variant="toggle"
control={control}
outlined
name="developer.enabled"
label={l10n.getString(
'settings-general-interface-dev_mode-label'
)}
/>
{!!config?.debug && (
<div className="grid grid-cols-2 w-full rounded-md gap-2">
{Object.entries(devToggles).map(([name, label], i) => (
<CheckBox
key={i}
control={control}
variant="toggle"
outlined
name={
`developer.${name}` as FieldPath<InterfaceSettingsForm>
}
label={l10n.getString(`widget-developer_mode-${label}`)}
/>
))}
</div>
)}
</div>
<Typography variant="section-title">
@@ -94,7 +94,10 @@ export function MagnetometerToggleSetting({
return settingType === 'general' ? (
<>
<div className="flex flex-col pt-5 pb-3" id={id}>
<div
className="flex flex-col pt-5 pb-3 scroll-mt-12 mobile:scroll-mt-20"
id={id}
>
<Typography variant="section-title">
{l10n.getString(
'settings-general-tracker_mechanics-use_mag_on_all_trackers'
+173 -74
View File
@@ -14,6 +14,7 @@ import {
SerialUpdateResponseT,
SerialTrackerGetWifiScanRequestT,
SerialTrackerCustomCommandRequestT,
SerialDeviceType,
} from 'solarxr-protocol';
import { useWebsocketAPI } from '@/hooks/websocket-api';
import { Button } from '@/components/commons/Button';
@@ -41,7 +42,10 @@ export function Serial() {
const consoleRef = useRef<HTMLDivElement>(null);
const [consoleContent, setConsole] = useState('');
const [isSerialOpen, setSerialOpen] = useState(false);
const [openedSerialDevice, setOpenedSerialDevice] = useState<Omit<
SerialDeviceT,
'pack'
> | null>(null);
const [serialDevices, setSerialDevices] = useState<
Omit<SerialDeviceT, 'pack'>[]
>([]);
@@ -87,11 +91,19 @@ export function Serial() {
};
useEffect(() => {
sendRPCPacket(RpcMessage.SerialDevicesRequest, new SerialDevicesRequestT());
const typedState: { serialPort: string } = state as any;
if (typedState?.serialPort) {
reset({ port: typedState.serialPort });
}
sendRPCPacket(RpcMessage.SerialDevicesRequest, new SerialDevicesRequestT());
const interval = setInterval(() => {
sendRPCPacket(
RpcMessage.SerialDevicesRequest,
new SerialDevicesRequestT()
);
}, 3000);
return () => clearInterval(interval);
}, []);
useEffect(() => {
@@ -103,11 +115,8 @@ export function Serial() {
useRPCPacket(
RpcMessage.SerialUpdateResponse,
(data: SerialUpdateResponseT) => {
if (data.closed) {
setSerialOpen(false);
} else {
setSerialOpen(true);
}
if (data.device) setOpenedSerialDevice(data.device);
else if (data.closed) setOpenedSerialDevice(null);
if (data.log) {
setConsole((console) => console + data.log);
@@ -122,6 +131,7 @@ export function Serial() {
{
name: l10n.getString('settings-serial-auto_dropdown_item'),
port: 'Auto',
type: SerialDeviceType.ESP_TRACKER,
},
...(res.devices || []),
]);
@@ -161,7 +171,7 @@ export function Serial() {
useEffect(() => {
const id = setInterval(() => {
if (!isSerialOpen) {
if (openedSerialDevice === null) {
openSerial(port ?? defaultValues.port);
} else {
clearInterval(id);
@@ -171,7 +181,7 @@ export function Serial() {
return () => {
clearInterval(id);
};
}, [isSerialOpen]);
}, [openedSerialDevice]);
const reboot = () => {
sendRPCPacket(
@@ -179,6 +189,8 @@ export function Serial() {
new SerialTrackerRebootRequestT()
);
};
// ESP
const factoryReset = () => {
sendRPCPacket(
RpcMessage.SerialTrackerFactoryResetRequest,
@@ -209,6 +221,48 @@ export function Serial() {
setValue('customCommand', '');
};
// HID
const enterPairing = () => {
sendRPCPacket(
RpcMessage.SerialTrackerCustomCommandRequest,
new SerialTrackerCustomCommandRequestT('pair')
);
};
const dfu = () => {
sendRPCPacket(
RpcMessage.SerialTrackerCustomCommandRequest,
new SerialTrackerCustomCommandRequestT('dfu')
);
};
const meow = () => {
sendRPCPacket(
RpcMessage.SerialTrackerCustomCommandRequest,
new SerialTrackerCustomCommandRequestT('meow')
);
};
// HID receiver
const exitPairing = () => {
sendRPCPacket(
RpcMessage.SerialTrackerCustomCommandRequest,
new SerialTrackerCustomCommandRequestT('exit')
);
};
// HID tracker
const calibrate = () => {
sendRPCPacket(
RpcMessage.SerialTrackerCustomCommandRequest,
new SerialTrackerCustomCommandRequestT('calibrate')
);
};
const sixSideCalibrate = () => {
sendRPCPacket(
RpcMessage.SerialTrackerCustomCommandRequest,
new SerialTrackerCustomCommandRequestT('6-side')
);
};
const consoleContentRef = useRef(consoleContent);
useLayoutEffect(() => {
consoleContentRef.current = consoleContent;
@@ -318,7 +372,7 @@ export function Serial() {
>
<div className="flex select-text">
<pre>
{isSerialOpen
{openedSerialDevice !== null
? consoleContent
: l10n.getString('settings-serial-connection_lost')}
</pre>
@@ -326,70 +380,115 @@ export function Serial() {
</div>
<div className="border-t-2 pt-2 border-background-60 border-solid gap-2 flex flex-row">
<div className="xs:flex flex-grow xs:flex-wrap gap-2 grid grid-cols-2">
<Button variant="quaternary" onClick={reboot}>
{l10n.getString('settings-serial-reboot')}
</Button>
<Button
variant="quaternary"
onClick={() => setTryFactoryReset(true)}
>
{l10n.getString('settings-serial-factory_reset')}
</Button>
<Button variant="quaternary" onClick={getWifiScan}>
{l10n.getString('settings-serial-get_wifi_scan')}
</Button>
<Button
variant="quaternary"
onClick={saveLogToFile}
disabled={!isSerialOpen || !consoleContent.trim()}
>
{l10n.getString('settings-serial-save_logs')}
</Button>
<div className="ml-auto">
<Button
variant="quaternary"
onClick={pauseScroll}
icon={
isPaused ? (
<PlayIcon width={16} />
) : (
<PauseIcon width={16} />
)
}
/>
</div>
<form
className="w-full flex flex-row gap-2 mobile:col-span-2"
onSubmit={(e) => {
if (!isSerialOpen) {
return;
}
e.preventDefault();
if (!acceptedCustomCommandWarning) {
setTrySendCustomCommand(true);
} else {
sendCustomSerialCommand();
}
}}
>
<div className="flex-grow">
<Input
control={control}
name="customCommand"
className="flex-grow"
placeholder={l10n.getString(
'settings-serial-send_command-placeholder'
)}
/>
</div>
<Button
variant="quaternary"
disabled={!isSerialOpen}
type="submit"
>
{l10n.getString('settings-serial-send_command')}
</Button>
</form>
{openedSerialDevice !== null && (
<>
<Button variant="quaternary" onClick={reboot}>
{l10n.getString('settings-serial-reboot')}
</Button>
{openedSerialDevice?.type ===
SerialDeviceType.ESP_TRACKER && (
<>
<Button
variant="quaternary"
onClick={() => setTryFactoryReset(true)}
>
{l10n.getString('settings-serial-factory_reset')}
</Button>
<Button variant="quaternary" onClick={getWifiScan}>
{l10n.getString('settings-serial-get_wifi_scan')}
</Button>
</>
)}
{openedSerialDevice?.type !==
SerialDeviceType.ESP_TRACKER && (
<Button variant="quaternary" onClick={enterPairing}>
{l10n.getString('settings-serial-enter_pairing')}
</Button>
)}
{openedSerialDevice?.type ===
SerialDeviceType.HID_RECEIVER && (
<Button variant="quaternary" onClick={exitPairing}>
{l10n.getString('settings-serial-exit_pairing')}
</Button>
)}
{openedSerialDevice?.type ===
SerialDeviceType.HID_TRACKER && (
<>
<Button variant="quaternary" onClick={calibrate}>
{l10n.getString('settings-serial-calibrate')}
</Button>
<Button variant="quaternary" onClick={sixSideCalibrate}>
{l10n.getString('settings-serial-six_side_calibrate')}
</Button>
</>
)}
{openedSerialDevice?.type !==
SerialDeviceType.ESP_TRACKER && (
<>
<Button variant="quaternary" onClick={dfu}>
{l10n.getString('settings-serial-dfu')}
</Button>
<Button variant="quaternary" onClick={meow}>
{l10n.getString('settings-serial-meow')}
</Button>
</>
)}
<Button
variant="quaternary"
onClick={saveLogToFile}
disabled={
openedSerialDevice === null || !consoleContent.trim()
}
>
{l10n.getString('settings-serial-save_logs')}
</Button>
<div className="ml-auto">
<Button
variant="quaternary"
onClick={pauseScroll}
icon={
isPaused ? (
<PlayIcon width={16} />
) : (
<PauseIcon width={16} />
)
}
/>
</div>
<form
className="w-full flex flex-row gap-2 mobile:col-span-2"
onSubmit={(e) => {
if (openedSerialDevice === null) {
return;
}
e.preventDefault();
if (!acceptedCustomCommandWarning) {
setTrySendCustomCommand(true);
} else {
sendCustomSerialCommand();
}
}}
>
<div className="flex-grow">
<Input
control={control}
name="customCommand"
className="flex-grow"
placeholder={l10n.getString(
'settings-serial-send_command-placeholder'
)}
/>
</div>
<Button
variant="quaternary"
disabled={openedSerialDevice === null}
type="submit"
>
{l10n.getString('settings-serial-send_command')}
</Button>
</form>
</>
)}
<div className="w-full mobile:col-span-2">
<Dropdown
@@ -187,14 +187,12 @@ export function VRCOSCSettings() {
{l10n.getString('settings-osc-vrchat-oscqueryEnabled')}
</Typography>
<div className="flex flex-col pb-2">
<Typography>
{l10n
.getString('settings-osc-vrchat-oscqueryEnabled-description')
.split('\n')
.map((line, i) => (
<Typography key={i}>{line}</Typography>
))}
</Typography>
{l10n
.getString('settings-osc-vrchat-oscqueryEnabled-description')
.split('\n')
.map((line, i) => (
<Typography key={i}>{line}</Typography>
))}
</div>
<div className="grid grid-cols-2 gap-3 pb-5">
<CheckBox
@@ -9,7 +9,7 @@ import { useLocalization } from '@fluent/react';
import { Dispatch, ReactNode, SetStateAction } from 'react';
import { StayAlignedRelaxedPose } from 'solarxr-protocol';
function StaAlignedPoseModal({
function StayAlignedPoseModal({
open,
title,
descriptionKeys,
@@ -39,8 +39,8 @@ function StaAlignedPoseModal({
<Typography variant="main-title">{l10n.getString(title)}</Typography>
</div>
<div className="flex flex-col gap-1">
{descriptionKeys.map((descriptionKey) => (
<Typography>{l10n.getString(descriptionKey)}</Typography>
{descriptionKeys.map((descriptionKey, i) => (
<Typography key={i}>{l10n.getString(descriptionKey)}</Typography>
))}
</div>
<div className="flex pt-1 items-center fill-background-50 justify-center px-12">
@@ -78,7 +78,7 @@ export const StandingRelaxedPoseModal = ({
}: {
open: [boolean, Dispatch<SetStateAction<boolean>>];
}) => (
<StaAlignedPoseModal
<StayAlignedPoseModal
open={open}
title={'onboarding-stay_aligned-relaxed_poses-standing-title'}
descriptionKeys={[
@@ -92,7 +92,7 @@ export const StandingRelaxedPoseModal = ({
width={260}
alt="Reset position"
/>
</StaAlignedPoseModal>
</StayAlignedPoseModal>
);
export const SittingRelaxedPoseModal = ({
@@ -100,7 +100,7 @@ export const SittingRelaxedPoseModal = ({
}: {
open: [boolean, Dispatch<SetStateAction<boolean>>];
}) => (
<StaAlignedPoseModal
<StayAlignedPoseModal
open={open}
title={'onboarding-stay_aligned-relaxed_poses-sitting-title'}
descriptionKeys={[
@@ -114,7 +114,7 @@ export const SittingRelaxedPoseModal = ({
width={260}
alt="Reset position"
/>
</StaAlignedPoseModal>
</StayAlignedPoseModal>
);
export const FlatRelaxedPoseModal = ({
@@ -122,7 +122,7 @@ export const FlatRelaxedPoseModal = ({
}: {
open: [boolean, Dispatch<SetStateAction<boolean>>];
}) => (
<StaAlignedPoseModal
<StayAlignedPoseModal
open={open}
title={'onboarding-stay_aligned-relaxed_poses-flat-title'}
descriptionKeys={[
@@ -136,5 +136,5 @@ export const FlatRelaxedPoseModal = ({
width={560}
alt="Reset position"
/>
</StaAlignedPoseModal>
</StayAlignedPoseModal>
);
+2 -2
View File
@@ -376,9 +376,9 @@ export function TrackersTable({
/>
</div>
<div className="flex flex-col gap-y-0">
{filteredSortedTrackers.map((data) => (
{filteredSortedTrackers.map((data, index) => (
<Row
key={data.tracker.trackerId?.trackerNum}
key={index}
clickedTracker={clickedTracker}
data={data}
highlightedTrackers={highlightedTrackers}
@@ -7,12 +7,14 @@ import {
import classNames from 'classnames';
import {
ChangeSettingsRequestT,
EnableSteamVRDriverRequestT,
ResetType,
RpcMessage,
SettingsRequestT,
SettingsResponseT,
SteamVRTrackersSettingT,
TrackingChecklistPublicNetworksT,
TrackingChecklistSteamVRDisconnectedT,
TrackingChecklistStepId,
} from 'solarxr-protocol';
import { ReactNode, useEffect, useMemo, useState } from 'react';
@@ -28,7 +30,7 @@ import {
ArrowDownIcon,
ArrowRightIcon,
} from '@/components/commons/icon/ArrowIcons';
import { Localized } from '@fluent/react';
import { Localized, useLocalization } from '@fluent/react';
import { WrenchIcon } from '@/components/commons/icon/WrenchIcons';
import { TrackingChecklistModal } from './TrackingChecklistModal';
import { NavLink, useNavigate } from 'react-router-dom';
@@ -108,6 +110,69 @@ function Step({
);
}
function SteamVRDisconnected({
step,
context,
}: {
step: TrackingChecklistStep;
context: TrackingChecklistContext;
}) {
const { sendRPCPacket } = useWebsocketAPI();
const data = step.extraData as TrackingChecklistSteamVRDisconnectedT | null;
const enableDriver = () => {
sendRPCPacket(
RpcMessage.EnableSteamVRDriverRequest,
new EnableSteamVRDriverRequestT()
);
};
const driverNotInstalled = data?.driverInstalled === false;
const driverBlocked = data?.driverBlockedBySafeMode === true;
const driverDisabled = data?.driverEnabled === false;
const showEnableDriverButton = driverBlocked || driverDisabled;
const getDescriptionId = () => {
if (driverBlocked)
return 'tracking_checklist-STEAMVR_DISCONNECTED-driver_blocked-desc';
if (driverDisabled)
return 'tracking_checklist-STEAMVR_DISCONNECTED-driver_disabled-desc';
if (driverNotInstalled)
return 'tracking_checklist-STEAMVR_DISCONNECTED-driver_not_installed-desc';
return 'tracking_checklist-STEAMVR_DISCONNECTED-desc';
};
return (
<div className="space-y-2.5">
<Typography id={getDescriptionId()} />
<div className="flex justify-between sm:items-center gap-1 flex-col sm:flex-row">
{showEnableDriverButton && (
<Button
id="tracking_checklist-STEAMVR_DISCONNECTED-enable"
variant="primary"
onClick={enableDriver}
/>
)}
{!showEnableDriverButton && !driverNotInstalled && (
<Button
id="tracking_checklist-STEAMVR_DISCONNECTED-open"
variant="primary"
onClick={() => openUrl('steam://run/250820')}
/>
)}
{step.ignorable && (
<Button
id="tracking_checklist-ignore"
variant="secondary"
onClick={() => context.toggleSession(step.id)}
/>
)}
</div>
</div>
);
}
function SteamVRHandsEnabled() {
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
const [steamVrTrackers, setSteamVrTrackers] = useState<Omit<
@@ -157,6 +222,21 @@ function SteamVRHandsEnabled() {
);
}
function StandableInstalled() {
const { l10n } = useLocalization();
return (
<div className="space-y-2.5">
{l10n
.getString('tracking_checklist-STANDABLE_INSTALLED-desc')
.split('\n')
.map((line, i) => (
<Typography key={i}>{line}</Typography>
))}
</div>
);
}
const stepContentLookup: Record<
number,
(
@@ -224,28 +304,8 @@ const stepContentLookup: Record<
</div>
);
},
[TrackingChecklistStepId.STEAMVR_DISCONNECTED]: (step, { toggleSession }) => {
return (
<>
<div className="space-y-2.5">
<Typography id="tracking_checklist-STEAMVR_DISCONNECTED-desc" />
<div className="flex justify-between sm:items-center gap-1 flex-col sm:flex-row">
<Button
id="tracking_checklist-STEAMVR_DISCONNECTED-open"
variant="primary"
onClick={() => openUrl('steam://run/250820')}
/>
{step.ignorable && (
<Button
id="tracking_checklist-ignore"
variant="secondary"
onClick={() => toggleSession(step.id)}
/>
)}
</div>
</div>
</>
);
[TrackingChecklistStepId.STEAMVR_DISCONNECTED]: (step, context) => {
return <SteamVRDisconnected step={step} context={context} />;
},
[TrackingChecklistStepId.TRACKER_ERROR]: () => {
return <Typography id="tracking_checklist-TRACKER_ERROR-desc" />;
@@ -410,6 +470,9 @@ const stepContentLookup: Record<
[TrackingChecklistStepId.STEAMVR_HANDS_ENABLED]: () => {
return <SteamVRHandsEnabled />;
},
[TrackingChecklistStepId.STANDABLE_INSTALLED]: () => {
return <StandableInstalled />;
},
};
export function TrackingChecklistMobile() {
@@ -1,80 +0,0 @@
import { useEffect } from 'react';
import { FieldPath, useForm } from 'react-hook-form';
import { useConfig } from '@/hooks/config';
import { useWebsocketAPI } from '@/hooks/websocket-api';
import { CheckBox } from '@/components/commons/Checkbox';
import { useLocalization } from '@fluent/react';
export interface DeveloperModeWidgetForm {
highContrast: boolean;
preciseRotation: boolean;
fastDataFeed: boolean;
filterSlimesAndHMD: boolean;
sortByName: boolean;
rawSlimeRotation: boolean;
moreInfo: boolean;
}
export const defaultValues: DeveloperModeWidgetForm = {
highContrast: false,
preciseRotation: false,
fastDataFeed: false,
filterSlimesAndHMD: false,
sortByName: false,
rawSlimeRotation: false,
moreInfo: false,
};
export function DeveloperModeWidget() {
const { l10n } = useLocalization();
const { config, setConfig } = useConfig();
const { reconnect } = useWebsocketAPI();
const { reset, control, handleSubmit, watch } =
useForm<DeveloperModeWidgetForm>({
defaultValues: defaultValues,
});
useEffect(() => {
reset(config?.devSettings || {});
}, []);
useEffect(() => {
const subscription = watch(() => handleSubmit(onSubmit)());
return () => subscription.unsubscribe();
}, []);
const onSubmit = async (formData: DeveloperModeWidgetForm) => {
const needReconnect =
config?.devSettings?.fastDataFeed !== formData.fastDataFeed;
await setConfig({ devSettings: formData });
if (needReconnect) reconnect();
};
const makeToggle = ([name, label]: string[], index: number) => (
<CheckBox
key={index}
control={control}
variant="toggle"
outlined
name={name as FieldPath<DeveloperModeWidgetForm>}
label={l10n.getString(`widget-developer_mode-${label}`)}
/>
);
const toggles = {
highContrast: 'high_contrast',
preciseRotation: 'precise_rotation',
fastDataFeed: 'fast_data_feed',
filterSlimesAndHMD: 'filter_slimes_and_hmd',
sortByName: 'sort_by_name',
rawSlimeRotation: 'raw_slime_rotation',
moreInfo: 'more_info',
};
return (
<form className="grid grid-cols-2 w-full rounded-md gap-2">
{Object.entries(toggles).map(makeToggle)}
</form>
);
}
@@ -130,14 +130,18 @@ async function initializeIMUVisualizer(
accelArrow.setLength(Math.sqrt(accelLength) * 2);
}
const magVec = new Vector3(mag.x, mag.y, mag.z);
const magVec = Vector3FromVec3fT(mag);
const magLen = magVec.length();
const magMag = Math.sqrt(magLen / 100);
if (magLen > 0) {
if (magArrow.parent === null) scene.add(magArrow);
const magDir = magVec.clone().normalize();
magArrow.position.copy(magDir.clone().multiplyScalar(-magMag));
magArrow.setDirection(magDir);
magArrow.setLength(2 * magMag);
} else {
magArrow.removeFromParent();
}
};
@@ -207,9 +211,7 @@ function IMUVisualizerCanvas({
}, [model]);
useEffect(() => {
if (contextRef.current) {
contextRef.current.update(quat, vec, mag);
}
contextRef.current?.update(quat, vec, mag);
}, [quat, vec, mag]);
if (error) {
+4 -2
View File
@@ -16,6 +16,8 @@ import { getSentryOrCompute, updateSentryContext } from '@/utils/sentry';
import { fetchCurrentFirmwareRelease, FirmwareRelease } from './firmware-update';
import { DEFAULT_LOCALE, LangContext } from '@/i18n/config';
const isSteam = window.electronAPI ? await window.electronAPI.isSteam() : false;
export interface AppContext {
currentFirmwareRelease: FirmwareRelease | null;
}
@@ -40,7 +42,7 @@ export function useProvideAppContext(): AppContext {
startDataFeed.dataFeeds = [dataFeedConfig, bonesDataFeedConfig];
sendDataFeedPacket(DataFeedMessage.StartDataFeed, startDataFeed);
}
}, [isConnected]);
}, [isConnected, config?.debug, config?.devSettings?.fastDataFeed]);
useDataFeedPacket(DataFeedMessage.DataFeedUpdate, (packet: DataFeedUpdateT) => {
if (packet.index === 0) {
@@ -79,7 +81,7 @@ export function useProvideAppContext(): AppContext {
if (config.errorTracking !== undefined) {
// Alows for sentry to refresh if user change the setting once the gui
// is initialized
getSentryOrCompute(config.errorTracking ?? false, config.uuid);
getSentryOrCompute(config.errorTracking ?? false, config.uuid, isSteam);
}
}, [config]);
+21 -5
View File
@@ -1,8 +1,4 @@
import { createContext, useContext, useState } from 'react';
import {
defaultValues as defaultDevSettings,
DeveloperModeWidgetForm,
} from '@/components/widgets/DeveloperModeWidget';
import { error } from '@/utils/logging';
import { useDebouncedEffect } from './timeout';
import { waitUntil } from '@/utils/a11y';
@@ -25,13 +21,33 @@ export enum AssignMode {
All = 'all',
}
export interface DeveloperModeConfig {
highContrast: boolean;
preciseRotation: boolean;
fastDataFeed: boolean;
filterSlimesAndHMD: boolean;
sortByName: boolean;
rawSlimeRotation: boolean;
moreInfo: boolean;
}
export const defaultDevSettings: DeveloperModeConfig = {
highContrast: false,
preciseRotation: false,
fastDataFeed: false,
filterSlimesAndHMD: false,
sortByName: false,
rawSlimeRotation: false,
moreInfo: false,
};
export interface Config {
uuid: string;
debug: boolean;
lang: string;
doneOnboarding: boolean;
watchNewDevices: boolean;
devSettings: DeveloperModeWidgetForm;
devSettings: DeveloperModeConfig;
feedbackSound: boolean;
feedbackSoundVolume: number;
connectedTrackersWarning: boolean;
+7 -2
View File
@@ -5,7 +5,7 @@ export function useDataFeedConfig() {
const { config } = useConfig();
const fastDataFeed = config?.debug && config?.devSettings?.fastDataFeed;
const feedMaxTps = fastDataFeed ? 40 : 10;
const feedMaxTps = fastDataFeed ? 90 : 10;
const trackerData = new TrackerDataMaskT();
trackerData.position = true;
@@ -39,8 +39,13 @@ export function useDataFeedConfig() {
}
export function useBonesDataFeedConfig() {
const { config } = useConfig();
const fastDataFeed = config?.debug && config?.devSettings?.fastDataFeed;
const feedMaxTps = fastDataFeed ? 90 : 40;
const dataFeedConfig = new DataFeedConfigT();
dataFeedConfig.boneMask = true;
dataFeedConfig.minimumTimeSinceLast = 1000 / 40;
dataFeedConfig.minimumTimeSinceLast = 1000 / feedMaxTps;
return dataFeedConfig;
}
+7
View File
@@ -426,3 +426,10 @@ div {
[data-electron-drag-region='true'] {
-webkit-app-region: drag;
}
a,
.no-user-drag {
-webkit-user-drag: none;
-webkit-user-select: none;
user-select: none;
}
+10 -4
View File
@@ -9,7 +9,13 @@ import {
} from 'react-router-dom';
import { DeviceDataT } from 'solarxr-protocol';
export function getSentryOrCompute(enabled = false, uuid: string) {
export function getSentryOrCompute(enabled = false, uuid: string, isSteam: boolean) {
// to be considered prod it needs to be a proper version tag, non-dirty
const isProd = import.meta.env.PROD && __GIT_CLEAN__ && __VERSION_TAG__;
// We disable sentry for non prod environments
if (!isProd) enabled = false;
Sentry.setUser({ id: uuid });
// if sentry is already initialized - SKIP
@@ -44,10 +50,10 @@ export function getSentryOrCompute(enabled = false, uuid: string) {
}),
],
beforeSend: (ev) => (newClient?.getOptions().enabled ? ev : null),
environment: import.meta.env.MODE,
environment: isSteam ? 'steam' : 'production',
release: (__VERSION_TAG__ || __COMMIT_HASH__) + (__GIT_CLEAN__ ? '' : '-dirty'),
// Tracing
tracesSampleRate: import.meta.env.PROD ? 0.5 : 1.0, // Capture 50% of the transactions
tracesSampleRate: 0.5, // Capture 50% of the transactions
// Set profilesSampleRate to 1.0 to profile every transaction.
// Since profilesSampleRate is relative to tracesSampleRate,
// the final profiling rate can be computed as tracesSampleRate * profilesSampleRate
@@ -55,7 +61,7 @@ export function getSentryOrCompute(enabled = false, uuid: string) {
// results in 25% of transactions being profiled (0.5*0.5=0.25)
profilesSampleRate: 0.2,
// Session Replay
replaysSessionSampleRate: import.meta.env.PROD ? 0.1 : 1.0, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
normalizeDepth: 8,
enabled,
+1 -1
View File
@@ -6,7 +6,7 @@ import path from 'path';
import { visualizer } from 'rollup-plugin-visualizer';
import jotaiReactRefresh from 'jotai/babel/plugin-react-refresh';
const commitHash = execSync('git rev-parse --verify --short HEAD').toString().trim();
const commitHash = execSync('git rev-parse --verify --short=8 HEAD').toString().trim();
const versionTag = execSync('git --no-pager tag --sort -taggerdate --points-at HEAD')
.toString()
.split('\n')[0]
+253 -472
View File
File diff suppressed because it is too large. Load diff
+8 -3
View File
@@ -17,7 +17,6 @@ plugins {
id("com.github.gmazzo.buildconfig")
id("com.android.application") version "8.13.2"
id("org.ajoberstar.grgit")
}
kotlin {
@@ -124,8 +123,14 @@ dependencies {
// The android block is where you configure all your Android-specific build options.
extra.apply {
set("gitVersionCode", grgit.tag.list().size)
set("gitVersionName", grgit.describe(mapOf("tags" to true, "always" to true)))
val tagCount = providers.exec {
commandLine("git", "--no-pager", "tag", "-l")
}.standardOutput.asText.get().trim().split('\n').size
val description = providers.exec {
commandLine("git", "describe", "--tags", "--abbrev=8", "--always")
}.standardOutput.asText.get().trim()
set("gitVersionCode", tagCount)
set("gitVersionName", description)
}
android {
// The app's namespace. Used primarily to access app resources.
@@ -14,6 +14,7 @@ import com.hoho.android.usbserial.driver.UsbSerialProber
import com.hoho.android.usbserial.util.SerialInputOutputManager
import dev.slimevr.serial.SerialHandler
import dev.slimevr.serial.SerialListener
import dev.slimevr.tracking.trackers.hid.HIDCommon
import io.eiren.util.logging.LogManager
import java.io.IOException
import java.nio.ByteBuffer
@@ -57,7 +58,7 @@ class AndroidSerialHandler(val activity: AppCompatActivity) :
get() = getPorts()
.asSequence()
.map { SerialPortWrapper(it.ports[0]) }
.filter { isKnownBoard(it) }
.filter { isKnownBoard(it) || HIDCommon.matchesAny(it.vendorId, it.productId) }
.asStream()
val usbReceiver: BroadcastReceiver = object : BroadcastReceiver() {
@@ -144,11 +145,11 @@ class AndroidSerialHandler(val activity: AppCompatActivity) :
}
@Synchronized
override fun openSerial(portLocation: String?, auto: Boolean): Boolean {
override fun openSerial(portLocation: String?, auto: Boolean, autoIncludeHid: Boolean): Boolean {
LogManager.info("[SerialHandler] Trying to open: $portLocation, auto: $auto")
lastKnownPorts = knownPorts.asSequence().toSet()
val newPort = lastKnownPorts.find {
(!auto && it.portLocation == portLocation) || (auto && isKnownBoard(it))
(!auto && it.portLocation == portLocation) || (auto && isKnownBoard(it)) || (auto && autoIncludeHid && HIDCommon.matchesAny(it.vendorId, it.productId))
}
if (newPort == null) {
@@ -71,6 +71,7 @@ class AndroidHIDManager(
val serial = hidDevice.serialNumber ?: "Unknown USB Device ${hidDevice.deviceId}"
this.devicesBySerial[serial]?.let {
this.devicesByHID[hidDevice] = it
this.lastDataByHID[hidDevice] = 0
synchronized(this.devices) {
for (id in it) {
val device = this.devices[id]
@@ -187,7 +188,7 @@ class AndroidHIDManager(
}
// LogManager.info("[TrackerServer] HID received $packetCount tracker packets")
} else {
lastDataByHID[hidDevice] = lastDataByHID[hidDevice]!! + 1 // increment last data received
lastDataByHID[hidDevice] = lastDataByHID.getOrDefault(hidDevice, 0) + 1 // increment last data received
}
}
if (!devicesPresent) {
+4
View File
@@ -91,6 +91,10 @@ dependencies {
// Jitpack
implementation("com.github.SlimeVR:oscquery-kt:566a0cba58")
// For SteamVR driver detection
implementation("io.ktor:ktor-client-core:2.3.13")
implementation("io.ktor:ktor-client-cio:2.3.13")
testImplementation(kotlin("test"))
// Use JUnit test framework
testImplementation(platform("org.junit:junit-bom:6.0.2"))
@@ -2,5 +2,5 @@ package dev.slimevr
data class FeatureFlags(
var steam: Boolean = false,
var skipCheckUdev: Boolean = false,
var skipCheckUdev: Boolean = true,
)
@@ -5,7 +5,7 @@ data class NetworkInfo(
val description: String?,
val category: NetworkCategory?,
val connectivity: Set<ConnectivityFlags>?,
val connected: Boolean?,
val connected: Boolean,
)
/**
@@ -18,7 +18,7 @@ enum class NetworkCategory(val value: Int) {
;
companion object {
fun fromInt(value: Int) = values().find { it.value == value }
fun fromInt(value: Int) = entries.find { it.value == value }
}
}
@@ -41,7 +41,7 @@ enum class ConnectivityFlags(val value: Int) {
fun fromInt(value: Int): Set<ConnectivityFlags> = if (value == 0) {
setOf(DISCONNECTED)
} else {
values().filter { it != DISCONNECTED && (value and it.value) != 0 }.toSet()
entries.filter { it != DISCONNECTED && (value and it.value) != 0 }.toSet()
}
}
}
@@ -51,7 +51,7 @@ abstract class NetworkProfileChecker {
abstract val publicNetworks: List<NetworkInfo>
}
class NetworkProfileCheckerStub : NetworkProfileChecker() {
class StubNetworkProfileChecker : NetworkProfileChecker() {
override val isSupported: Boolean
get() = false
override val publicNetworks: List<NetworkInfo>
@@ -35,6 +35,7 @@ import dev.slimevr.tracking.trackers.udp.TrackersUDPServer
import dev.slimevr.trackingchecklist.TrackingChecklistManager
import dev.slimevr.util.ann.VRServerThread
import dev.slimevr.websocketapi.WebSocketVRBridge
import io.eiren.util.Process
import io.eiren.util.ann.ThreadSafe
import io.eiren.util.ann.ThreadSecure
import io.eiren.util.collections.FastList
@@ -61,7 +62,9 @@ class VRServer @JvmOverloads constructor(
serialHandlerProvider: (VRServer) -> SerialHandler = { _ -> SerialHandlerStub() },
flashingHandlerProvider: (VRServer) -> SerialFlashingHandler? = { _ -> null },
vrcConfigHandlerProvider: (VRServer) -> VRCConfigHandler = { _ -> VRCConfigHandlerStub() },
networkProfileProvider: (VRServer) -> NetworkProfileChecker = { _ -> NetworkProfileCheckerStub() },
networkProfileProvider: (VRServer) -> NetworkProfileChecker = { _ -> StubNetworkProfileChecker() },
val processListProvider: () -> Sequence<Process> = { emptySequence() },
val tryOpenUri: (String) -> Unit = {},
acquireMulticastLock: () -> Any? = { null },
@JvmField val configManager: ConfigManager,
) : Thread("VRServer") {
@@ -31,7 +31,7 @@ class ServerConfig {
// it.setMag(false)
// } else {
trackers.map { (_, t) ->
async { it.setMag(false, t.trackerNum) }
async { it.setMag(MagnetometerStatus.DISABLED, t.trackerNum) }
}.awaitAll()
// }
return@async
@@ -51,7 +51,7 @@ class ServerConfig {
.map { (_, t) ->
async {
// FIXME: Tracker gets restarted after each setMag, what will happen for devices with 3 trackers?
it.setMag(true, t.trackerNum)
it.setMag(MagnetometerStatus.ENABLED, t.trackerNum)
}
}.awaitAll()
}
@@ -16,6 +16,7 @@ import dev.slimevr.osc.UnityBone.Companion.getByStringVal
import dev.slimevr.tracking.processor.BoneType
import dev.slimevr.tracking.processor.HumanPoseManager
import dev.slimevr.tracking.trackers.Device
import dev.slimevr.tracking.trackers.DeviceOrigin
import dev.slimevr.tracking.trackers.Tracker
import dev.slimevr.tracking.trackers.TrackerPosition
import dev.slimevr.tracking.trackers.TrackerStatus
@@ -270,7 +271,7 @@ class VMCHandler(
// Create device if it doesn't exist
var rot = rotation
if (trackerDevice == null) {
trackerDevice = server.deviceManager.createDevice("VMC receiver", "1.0", "VMC")
trackerDevice = server.deviceManager.createDevice(DeviceOrigin.VMC, "VMC receiver", "1.0", "VMC")
server.deviceManager.addDevice(trackerDevice!!)
}
@@ -13,6 +13,7 @@ import com.jme3.system.NanoTimer
import dev.slimevr.VRServer
import dev.slimevr.config.VRCOSCConfig
import dev.slimevr.tracking.trackers.Device
import dev.slimevr.tracking.trackers.DeviceOrigin
import dev.slimevr.tracking.trackers.Tracker
import dev.slimevr.tracking.trackers.TrackerPosition
import dev.slimevr.tracking.trackers.TrackerStatus
@@ -118,7 +119,7 @@ class VRCOSCHandler(
for (netInt in NetworkInterface.getNetworkInterfaces()) {
if (netInt.isUp && !netInt.isLoopback && !netInt.isVirtual) {
for (netAddr in netInt.interfaceAddresses) {
if (a == netAddr.address || a.address.contentEquals(netAddr.address.address) || a.hostName == netAddr.address.hostName) {
if (a == netAddr.address || a.address.contentEquals(netAddr.address.address)) {
return true
}
}
@@ -133,7 +134,6 @@ class VRCOSCHandler(
b != null &&
(
a.address.contentEquals(b.address) ||
(a.hostName == b.hostName) ||
(ipIsLocal(a) && ipIsLocal(b))
)
)
@@ -328,7 +328,7 @@ class VRCOSCHandler(
// Create device if it doesn't exist
if (vrsystemTrackersDevice == null) {
// Instantiate OSC Trackers device
vrsystemTrackersDevice = server.deviceManager.createDevice("VRC VRSystem", null, "VRChat")
vrsystemTrackersDevice = server.deviceManager.createDevice(DeviceOrigin.VRCHAT, "VRC VRSystem", null, "VRChat")
server.deviceManager.addDevice(vrsystemTrackersDevice!!)
}
@@ -404,7 +404,7 @@ class VRCOSCHandler(
// Receiving OSC Trackers data. This is not from VRChat.
if (oscTrackersDevice == null) {
// Instantiate OSC Trackers device
oscTrackersDevice = server.deviceManager.createDevice("OSC Tracker", null, "OSC Trackers")
oscTrackersDevice = server.deviceManager.createDevice(DeviceOrigin.OSC, "OSC Tracker", null, "OSC Trackers")
server.deviceManager.addDevice(oscTrackersDevice!!)
}
@@ -22,14 +22,18 @@ import dev.slimevr.protocol.rpc.setup.RPCUtil.getLocalIp
import dev.slimevr.protocol.rpc.status.RPCStatusHandler
import dev.slimevr.protocol.rpc.trackingchecklist.RPCTrackingChecklistHandler
import dev.slimevr.protocol.rpc.trackingpause.RPCTrackingPause
import dev.slimevr.steamvr.SteamVRUtils
import dev.slimevr.tracking.processor.config.SkeletonConfigOffsets
import dev.slimevr.tracking.processor.stayaligned.poses.RelaxedPose
import dev.slimevr.tracking.trackers.TrackerPosition
import dev.slimevr.tracking.trackers.TrackerPosition.Companion.getByBodyPart
import dev.slimevr.tracking.trackers.TrackerStatus
import dev.slimevr.tracking.trackers.TrackerUtils.getTrackerForSkeleton
import dev.slimevr.tracking.trackers.udp.MagnetometerStatus
import io.eiren.util.logging.LogManager
import io.github.axisangles.ktmath.Quaternion
import io.ktor.client.HttpClient
import io.ktor.client.engine.cio.CIO
import kotlinx.coroutines.*
import solarxr_protocol.MessageBundle
import solarxr_protocol.datatypes.TransactionId
@@ -151,6 +155,11 @@ class RPCHandler(private val api: ProtocolAPI) : ProtocolHandler<RpcMessageHeade
RpcMessage.ResetStayAlignedRelaxedPoseRequest,
::onResetStayAlignedRelaxedPoseRequest,
)
registerPacketListener(
RpcMessage.EnableSteamVRDriverRequest,
::onEnableSteamVRDriverRequest,
)
}
private fun onServerInfosRequest(
@@ -517,7 +526,7 @@ class RPCHandler(private val api: ProtocolAPI) : ProtocolHandler<RpcMessageHeade
mainScope.launch {
withTimeoutOrNull(MAG_TIMEOUT) {
tracker.device.setMag(state, tracker.trackerNum)
tracker.device.setMag(if (state) MagnetometerStatus.ENABLED else MagnetometerStatus.DISABLED, tracker.trackerNum)
}
val fbb = FlatBufferBuilder(32)
@@ -610,6 +619,16 @@ class RPCHandler(private val api: ProtocolAPI) : ProtocolHandler<RpcMessageHeade
sendSettingsChangedResponse(conn, messageHeader)
}
private fun onEnableSteamVRDriverRequest(conn: GenericConnection, messageHeader: RpcMessageHeader) {
val request = messageHeader.message(EnableSteamVRDriverRequest()) as? EnableSteamVRDriverRequest ?: return
mainScope.launch {
val client = HttpClient(CIO)
SteamVRUtils.unblockDriver(client, "slimevr")
client.close()
}
}
fun sendSettingsChangedResponse(conn: GenericConnection, messageHeader: RpcMessageHeader?) {
val fbb = FlatBufferBuilder(32)
val settings = createSettingsResponse(fbb, api.server)
@@ -7,10 +7,24 @@ import dev.slimevr.protocol.ProtocolAPIServer
import dev.slimevr.protocol.rpc.RPCHandler
import dev.slimevr.serial.SerialListener
import dev.slimevr.serial.SerialPort
import dev.slimevr.tracking.trackers.hid.HIDCommon
import io.eiren.util.logging.LogManager
import solarxr_protocol.rpc.*
import java.util.*
import java.util.function.Consumer
import kotlin.collections.emptyList
fun createSerialDevice(fbb: FlatBufferBuilder, port: SerialPort): Int {
val portOffset = fbb.createString(port.portLocation)
val nameOffset = fbb.createString(port.descriptivePortName)
val portType = when {
HIDCommon.matchesReceiver(port.vendorId, port.productId) -> SerialDeviceType.HID_RECEIVER
HIDCommon.matchesTracker(port.vendorId, port.productId) -> SerialDeviceType.HID_TRACKER
else -> SerialDeviceType.ESP_TRACKER
}
return SerialDevice.createSerialDevice(fbb, portOffset, nameOffset, portType)
}
class RPCSerialHandler(var rpcHandler: RPCHandler, var api: ProtocolAPI) : SerialListener {
init {
@@ -35,38 +49,36 @@ class RPCSerialHandler(var rpcHandler: RPCHandler, var api: ProtocolAPI) : Seria
val outbound = rpcHandler.createRPCMessage(fbb, RpcMessage.SerialUpdateResponse, update)
fbb.finish(outbound)
this.forAllListeners(
Consumer { conn: GenericConnection ->
conn.send(fbb.dataBuffer())
conn.context.useSerial = false
},
)
this.forAllListeners { conn: GenericConnection ->
conn.send(fbb.dataBuffer())
conn.context.useSerial = false
}
}
override fun onSerialLog(str: String, server: Boolean) {
val fbb = FlatBufferBuilder(32)
val logOffset = fbb.createString(str)
val portOffset = api.server.serialHandler.getCurrentPort()?.let { port ->
createSerialDevice(fbb, port)
} ?: 0
SerialUpdateResponse.startSerialUpdateResponse(fbb)
SerialUpdateResponse.addLog(fbb, logOffset)
SerialUpdateResponse.addDevice(fbb, portOffset)
val update = SerialUpdateResponse.endSerialUpdateResponse(fbb)
val outbound = rpcHandler.createRPCMessage(fbb, RpcMessage.SerialUpdateResponse, update)
fbb.finish(outbound)
this.forAllListeners(
Consumer { conn: GenericConnection ->
conn.send(fbb.dataBuffer())
},
)
this.forAllListeners { conn ->
conn.send(fbb.dataBuffer())
}
}
override fun onNewSerialDevice(port: SerialPort) {
val fbb = FlatBufferBuilder(32)
val portOffset = fbb.createString(port.portLocation)
val nameOffset = fbb.createString(port.descriptivePortName)
val deviceOffset = SerialDevice.createSerialDevice(fbb, portOffset, nameOffset)
val deviceOffset = createSerialDevice(fbb, port)
val newSerialOffset = NewSerialDeviceResponse
.createNewSerialDeviceResponse(fbb, deviceOffset)
val outbound = rpcHandler
@@ -89,17 +101,17 @@ class RPCSerialHandler(var rpcHandler: RPCHandler, var api: ProtocolAPI) : Seria
override fun onSerialConnected(port: SerialPort) {
val fbb = FlatBufferBuilder(32)
val deviceOffset = createSerialDevice(fbb, port)
SerialUpdateResponse.startSerialUpdateResponse(fbb)
SerialUpdateResponse.addClosed(fbb, false)
SerialUpdateResponse.addDevice(fbb, deviceOffset)
val update = SerialUpdateResponse.endSerialUpdateResponse(fbb)
val outbound = rpcHandler.createRPCMessage(fbb, RpcMessage.SerialUpdateResponse, update)
fbb.finish(outbound)
this.forAllListeners(
Consumer { conn: GenericConnection ->
conn.send(fbb.dataBuffer())
},
)
this.forAllListeners { conn ->
conn.send(fbb.dataBuffer())
}
}
fun onSerialTrackerRebootRequest(
@@ -165,20 +177,17 @@ class RPCSerialHandler(var rpcHandler: RPCHandler, var api: ProtocolAPI) : Seria
val fbb = FlatBufferBuilder(32)
val devicesOffsets: MutableList<Int> = ArrayList()
try {
this.api.server.serialHandler.knownPorts.forEach { port: SerialPort ->
val portOffset = fbb.createString(port.portLocation)
val nameOffset = fbb.createString(port.descriptivePortName)
devicesOffsets.add(SerialDevice.createSerialDevice(fbb, portOffset, nameOffset))
}
val devicesOffsets = try {
api.server.serialHandler.knownPorts.map { port ->
createSerialDevice(fbb, port)
}.toList()
} catch (e: Throwable) {
LogManager.severe("Using serial ports is not supported on this platform", e)
emptyList()
}
SerialDevicesResponse.startDevicesVector(fbb, devicesOffsets.size)
devicesOffsets.forEach(Consumer { offset: Int -> SerialDevicesResponse.addDevices(fbb, offset) })
devicesOffsets.forEach { offset: Int -> SerialDevicesResponse.addDevices(fbb, offset) }
val devices = fbb.endVector()
val serialDeviceOffsets = SerialDevicesResponse.createSerialDevicesResponse(fbb, devices)
val outbound = rpcHandler
@@ -188,7 +197,7 @@ class RPCSerialHandler(var rpcHandler: RPCHandler, var api: ProtocolAPI) : Seria
}
fun onSetWifiRequest(conn: GenericConnection, messageHeader: RpcMessageHeader) {
val req = messageHeader.message(SetWifiRequest()) as SetWifiRequest? ?: return
val req = messageHeader.message(SetWifiRequest()) as? SetWifiRequest? ?: return
if (req.password() == null || req.ssid() == null || !this.api.server.serialHandler.isConnected) {
return
@@ -198,13 +207,13 @@ class RPCSerialHandler(var rpcHandler: RPCHandler, var api: ProtocolAPI) : Seria
fun onOpenSerialRequest(conn: GenericConnection, messageHeader: RpcMessageHeader) {
val req =
messageHeader.message(OpenSerialRequest()) as OpenSerialRequest? ?: return
messageHeader.message(OpenSerialRequest()) as? OpenSerialRequest? ?: return
conn.context.useSerial = true
this.api.server.queueTask {
try {
this.api.server.serialHandler.openSerial(req.port(), req.auto())
this.api.server.serialHandler.openSerial(req.port(), req.auto(), true)
} catch (e: Exception) {
LogManager.severe("Unable to open serial port", e)
} catch (e: Throwable) {
@@ -245,17 +254,10 @@ class RPCSerialHandler(var rpcHandler: RPCHandler, var api: ProtocolAPI) : Seria
conn.send(fbb.dataBuffer())
}
fun forAllListeners(action: Consumer<in GenericConnection?>?) {
this.api
.apiServers
.forEach(
Consumer { server: ProtocolAPIServer ->
server
.apiConnections
.filter { conn: GenericConnection -> conn.context.useSerial }
.forEach(action)
},
)
fun forAllListeners(action: (GenericConnection) -> Unit) {
this.api.apiServers.forEach { server ->
server.apiConnections.filter { it.context.useSerial }.forEach(action)
}
}
override fun onSerialDeviceDeleted(port: SerialPort) {
@@ -71,9 +71,9 @@ public class ProvisioningHandler implements SerialListener {
try {
boolean openResult = false;
if (port != null)
openResult = vrServer.serialHandler.openSerial(port, false);
openResult = vrServer.serialHandler.openSerial(port, false, false);
else
openResult = vrServer.serialHandler.openSerial(null, true);
openResult = vrServer.serialHandler.openSerial(null, true, false);
if (!openResult)
LogManager.info("[SerialHandler] Serial port wasn't open...");
} catch (Exception e) {
@@ -9,7 +9,7 @@ abstract class SerialHandler {
abstract fun addListener(channel: SerialListener)
abstract fun removeListener(channel: SerialListener)
abstract fun openSerial(portLocation: String?, auto: Boolean): Boolean
abstract fun openSerial(portLocation: String?, auto: Boolean, autoIncludeHid: Boolean = false): Boolean
abstract fun rebootRequest()
abstract fun factoryResetRequest()
abstract fun infoRequest()
@@ -22,7 +22,7 @@ abstract class SerialHandler {
companion object {
// Please also update the udev rules when updating these in:
// gui/src-tauri/69-slimevr-devices.rules
// gui/electron/resources/69-slimevr-devices.rules
val supportedSerial: Set<Pair<Int, Int>> = setOf(
// / QinHeng
// CH340
@@ -61,7 +61,7 @@ class SerialHandlerStub : SerialHandler() {
override fun removeListener(channel: SerialListener) {}
override fun openSerial(portLocation: String?, auto: Boolean): Boolean = false
override fun openSerial(portLocation: String?, auto: Boolean, autoIncludeHid: Boolean): Boolean = false
override fun rebootRequest() {}
@@ -5,8 +5,8 @@ import java.util.*
abstract class SerialPort {
abstract val portLocation: String
abstract val descriptivePortName: String
abstract val vendorId: Int?
abstract val productId: Int?
abstract val vendorId: Int
abstract val productId: Int
override fun equals(other: Any?): Boolean {
val other: SerialPort = other as? SerialPort ?: return super.equals(other)
@@ -0,0 +1,123 @@
package dev.slimevr.steamvr
import dev.slimevr.VRServer
import io.eiren.util.logging.LogManager
import io.ktor.client.HttpClient
import io.ktor.client.call.body
import io.ktor.client.request.get
import io.ktor.client.request.header
import io.ktor.client.request.parameter
import io.ktor.client.request.request
import io.ktor.client.request.setBody
import io.ktor.http.HttpMethod
import io.ktor.http.isSuccess
import kotlinx.coroutines.delay
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.contentOrNull
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
import kotlin.time.Duration.Companion.milliseconds
@Serializable
data class DriverManifest(
val directory: String,
@SerialName("hmd_presence")
val hmdPresence: List<String>?,
val name: String,
)
@Serializable
data class Driver(
@SerialName("always_activate")
val alwaysActivate: Boolean,
@SerialName("blocked_by_safe_mode")
val blockedBySafeMode: Boolean,
val enabled: Boolean,
@SerialName("enabled_by_default")
val enabledByDefault: Boolean,
val id: Int,
@SerialName("load_priority")
val loadPriority: Int,
val manifest: DriverManifest,
@SerialName("on_safemode_whitelist")
val onSafeModeWhitelist: Boolean,
@SerialName("show_enable_in_settings")
val showEnableInSettings: Boolean,
)
@Serializable
private data class DriverListResponse(
val drivers: List<Driver>,
@SerialName("jsonid")
val jsonId: String,
)
class SteamVRUtils {
companion object {
const val SERVER_URL = "http://127.0.0.1:27062"
const val REFERER = "$SERVER_URL/dashboard/index.html"
private val jsonIgnoreUnknownKeys = Json { ignoreUnknownKeys = true }
suspend fun getDriversList(client: HttpClient): List<Driver>? {
val resp = try {
client.request("$SERVER_URL/drivers/list.json") {
header("Referer", REFERER)
}
} catch (_: Exception) {
return null
}
if (!resp.status.isSuccess()) {
LogManager.warning("[SteamVRUtils] Failed to connect to SteamVR web server (status ${resp.status})")
return null
}
val body: String = try {
resp.body()
} catch (_: Exception) {
return null
}
val driverList: DriverListResponse = try {
jsonIgnoreUnknownKeys.decodeFromString(body)
} catch (e: Exception) {
LogManager.warning("[SteamVRUtils] Failed to decode SteamVR drivers list", e)
return null
}
if (driverList.jsonId != "vr_driver_list") {
LogManager.severe("[SteamVRUtils] SteamVR driver list response had wrong jsonId (${driverList.jsonId})")
return null
}
return driverList.drivers
}
suspend fun unblockDriver(client: HttpClient, driver: String) {
val unblockReq = client.get("$SERVER_URL/drivers/unblock") {
method = HttpMethod.Post
header("Referer", REFERER)
setBody("""{"driver":"$driver"}""")
}
if (!unblockReq.status.isSuccess()) {
LogManager.severe("[SteamVRUtils] Failed to unblock driver: ${unblockReq.status}")
}
val enableReq = client.get("$SERVER_URL/drivers/setenable") {
method = HttpMethod.Post
header("Referer", REFERER)
setBody("""{"driver":"$driver","enable":true}""")
}
if (!enableReq.status.isSuccess()) {
LogManager.severe("[SteamVRUtils] Failed to enable driver: ${enableReq.status}")
}
delay(500.milliseconds)
VRServer.instance.tryOpenUri("vrmonitor://restartsystem")
}
}
}
@@ -2,6 +2,7 @@ package dev.slimevr.tracking.trackers
import dev.slimevr.tracking.trackers.udp.BoardType
import dev.slimevr.tracking.trackers.udp.MCUType
import dev.slimevr.tracking.trackers.udp.MagnetometerStatus
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
@@ -9,7 +10,18 @@ import kotlinx.coroutines.launch
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.atomic.AtomicInteger
open class Device(val magSupport: Boolean = false) {
enum class DeviceOrigin {
HID,
UDP,
VRCHAT,
OSC,
VMC,
STEAMVR,
SOLARXR,
WEBSOCKET,
}
open class Device(val origin: DeviceOrigin, val magSupport: Boolean = false) {
open val id: Int = nextLocalDeviceId.incrementAndGet()
open var name: String? = null
open var firmwareVersion: String? = null
@@ -26,9 +38,6 @@ open class Device(val magSupport: Boolean = false) {
open val hardwareIdentifier: String = "Unknown"
val isOpenVrDevice: Boolean
get() = manufacturer == "OpenVR"
init {
CoroutineScope(Job()).launch {
// Wait a little for device to get configured
@@ -41,7 +50,7 @@ open class Device(val magSupport: Boolean = false) {
* if `sensorId` null or in the specified tracker
* @param sensorId If null, every sensor will be modified
*/
open suspend fun setMag(state: Boolean, sensorId: Int = 255) {
open suspend fun setMag(status: MagnetometerStatus, sensorId: Int = 255) {
TODO("Not implemented because no mag support: $magSupport")
}
@@ -5,8 +5,8 @@ import io.eiren.util.collections.FastList
class DeviceManager(private val server: VRServer) {
val devices = FastList<Device>()
fun createDevice(name: String?, version: String?, manufacturer: String?): Device {
val device = Device()
fun createDevice(origin: DeviceOrigin, name: String?, version: String?, manufacturer: String?): Device {
val device = Device(origin)
device.name = name
device.firmwareVersion = version
device.manufacturer = manufacturer
@@ -148,8 +148,12 @@ class Tracker @JvmOverloads constructor(
var packetsLost: Int? = null
var packetLoss: Float? = null
var customName: String? = null
/**
* Please don't use this and instead set it via [Device.setMag]
*/
var magStatus: MagnetometerStatus = magStatus
private set
internal set
/**
* Watch the rest calibration status
@@ -499,17 +503,6 @@ class Tracker @JvmOverloads constructor(
*/
fun isImu(): Boolean = imuType != null && trackerDataType == TrackerDataType.ROTATION
/**
* Please don't use this and instead set it via [Device.setMag]
*/
internal fun setMagPrivate(mag: Boolean) {
magStatus = if (mag) {
MagnetometerStatus.ENABLED
} else {
MagnetometerStatus.DISABLED
}
}
/**
* Gets the magnetic field vector, in mGauss.
*/
@@ -12,6 +12,7 @@ import io.eiren.util.logging.LogManager
import io.github.axisangles.ktmath.Quaternion
import io.github.axisangles.ktmath.Quaternion.Companion.fromRotationVector
import io.github.axisangles.ktmath.Vector3
import kotlinx.coroutines.runBlocking
import java.nio.ByteBuffer
import java.util.function.Consumer
import kotlin.collections.set
@@ -134,6 +135,10 @@ class HIDCommon {
.info(
"[TrackerServer] Added sensor $trackerId for ${device.name}, type $sensorType",
)
} else {
runBlocking {
device.setMag(magStatus, trackerId)
}
}
}
@@ -1,13 +1,20 @@
package dev.slimevr.tracking.trackers.hid
import dev.slimevr.tracking.trackers.Device
import dev.slimevr.tracking.trackers.DeviceOrigin
import dev.slimevr.tracking.trackers.Tracker
import dev.slimevr.tracking.trackers.udp.BoardType
import dev.slimevr.tracking.trackers.udp.MCUType
import dev.slimevr.tracking.trackers.udp.MagnetometerStatus
class HIDDevice(val hidId: Int) : Device() {
class HIDDevice(val hidId: Int) : Device(DeviceOrigin.HID) {
override var hardwareIdentifier: String = "Unknown"
override var boardType: BoardType = BoardType.UNKNOWN
override var mcuType: MCUType = MCUType.UNKNOWN
fun getTracker(id: Int): Tracker? = trackers[id]
override suspend fun setMag(status: MagnetometerStatus, sensorId: Int) {
val tracker = trackers[sensorId] ?: error("Tracker $sensorId not found in device $this")
tracker.magStatus = status
}
}
@@ -249,7 +249,7 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
) {
mainScope.launch {
withTimeoutOrNull(MAG_TIMEOUT) {
connection.setMag(false, trackerId)
connection.setMag(MagnetometerStatus.DISABLED, trackerId)
}
}
} else if (magStatus == MagnetometerStatus.DISABLED &&
@@ -258,7 +258,7 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
) {
mainScope.launch {
withTimeoutOrNull(MAG_TIMEOUT) {
connection.setMag(true, trackerId)
connection.setMag(MagnetometerStatus.ENABLED, trackerId)
}
}
}
@@ -357,13 +357,6 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
LogManager.info("[TrackerServer] Tracker timed out: $conn")
}
} else {
for (value in conn.trackers.values) {
if (value.status == TrackerStatus.DISCONNECTED ||
value.status == TrackerStatus.TIMED_OUT
) {
value.status = TrackerStatus.OK
}
}
conn.timedOut = false
}
@@ -404,7 +397,6 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
}
private fun processPacket(received: DatagramPacket, packet: UDPPacket, connection: UDPDevice?) {
val tracker: Tracker?
when (packet) {
is UDPPacket0Heartbeat, is UDPPacket1Heartbeat, is UDPPacket25SetConfigFlag -> {}
@@ -413,8 +405,10 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
is RotationPacket -> {
var rot = packet.rotation
rot = AXES_OFFSET.times(rot)
tracker = connection?.getTracker(packet.sensorId)
if (tracker == null) return
val tracker = connection?.getTracker(packet.sensorId) ?: return
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
@@ -429,8 +423,10 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
}
is UDPPacket17RotationData -> {
tracker = connection?.getTracker(packet.sensorId)
if (tracker == null) return
val tracker = connection?.getTracker(packet.sensorId) ?: return
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) {
@@ -453,8 +449,10 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
is UDPPacket18MagnetometerAccuracy -> {}
is UDPPacket4Acceleration -> {
tracker = connection?.getTracker(packet.sensorId)
if (tracker == null) return
val tracker = connection?.getTracker(packet.sensorId) ?: return
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) {
@@ -504,8 +502,7 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
}
is UDPPacket13Tap -> {
tracker = connection?.getTracker(packet.sensorId)
if (tracker == null) return
val tracker = connection?.getTracker(packet.sensorId) ?: return
LogManager.info(
"[TrackerServer] Tap packet received from ${tracker.name}: ${packet.tap}",
)
@@ -515,8 +512,7 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
LogManager.severe(
"[TrackerServer] Error received from ${received.socketAddress}: ${packet.errorNumber}",
)
tracker = connection?.getTracker(packet.sensorId)
if (tracker == null) return
val tracker = connection?.getTracker(packet.sensorId) ?: return
tracker.status = TrackerStatus.ERROR
}
@@ -548,7 +544,7 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
}
is UDPPacket20Temperature -> {
tracker = connection?.getTracker(packet.sensorId) ?: return
val tracker = connection?.getTracker(packet.sensorId) ?: return
tracker.temperature = packet.temperature
}
@@ -616,8 +612,7 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
}
is UDPPacket26FlexData -> {
tracker = connection?.getTracker(packet.sensorId)
if (tracker == null) return
val tracker = connection?.getTracker(packet.sensorId) ?: return
if (tracker.trackerDataType == TrackerDataType.FLEX_RESISTANCE) {
tracker.trackerFlexHandler.setFlexResistance(packet.flexData)
} else if (tracker.trackerDataType == TrackerDataType.FLEX_ANGLE) {
@@ -627,8 +622,7 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
}
is UDPPacket27Position -> {
tracker = connection?.getTracker(packet.sensorId)
if (tracker == null) return
val tracker = connection?.getTracker(packet.sensorId) ?: return
tracker.position = packet.position
// dont call dataTick here as this is just position update
}
@@ -3,6 +3,7 @@ package dev.slimevr.tracking.trackers.udp
import dev.slimevr.NetworkProtocol
import dev.slimevr.VRServer
import dev.slimevr.tracking.trackers.Device
import dev.slimevr.tracking.trackers.DeviceOrigin
import dev.slimevr.tracking.trackers.Tracker
import java.net.InetAddress
import java.net.SocketAddress
@@ -14,7 +15,7 @@ class UDPDevice(
override val hardwareIdentifier: String,
override val boardType: BoardType = BoardType.UNKNOWN,
override val mcuType: MCUType = MCUType.UNKNOWN,
) : Device(true) {
) : Device(DeviceOrigin.UDP, true) {
override val id: Int = nextLocalDeviceId.incrementAndGet()
@@ -66,14 +67,15 @@ class UDPDevice(
var timedOut = false
override val trackers = ConcurrentHashMap<Int, Tracker>()
override suspend fun setMag(state: Boolean, sensorId: Int) {
override suspend fun setMag(magStatus: MagnetometerStatus, sensorId: Int) {
val state = magStatus == MagnetometerStatus.ENABLED
if (sensorId == 255) {
VRServer.instance.trackersServer.setConfigFlag(this, ConfigTypeId(1u), state)
trackers.forEach { (_, t) -> t.setMagPrivate(state) }
trackers.forEach { (_, t) -> t.magStatus = magStatus }
} else {
require(trackers[sensorId] != null) { "There is no tracker $sensorId in device ${toString()}" }
VRServer.instance.trackersServer.setConfigFlag(this, ConfigTypeId(1u), state, sensorId)
trackers[sensorId]!!.setMagPrivate(state)
trackers[sensorId]!!.magStatus = magStatus
}
}
@@ -114,6 +114,7 @@ class UDPProtocolParser {
PACKET_TEMPERATURE -> UDPPacket20Temperature()
PACKET_USER_ACTION -> UDPPacket21UserAction()
PACKET_FEATURE_FLAGS -> UDPPacket22FeatureFlags()
PACKET_ROTATION_AND_ACCELERATION -> UDPPacket23RotationAndAcceleration()
PACKET_ACK_CONFIG_CHANGE -> UDPPacket24AckConfigChange()
PACKET_FLEX_DATA -> UDPPacket26FlexData()
PACKET_POSITION -> UDPPacket27Position()
@@ -7,13 +7,18 @@ import dev.slimevr.games.vrchat.VRCConfigListener
import dev.slimevr.games.vrchat.VRCConfigRecommendedValues
import dev.slimevr.games.vrchat.VRCConfigValidity
import dev.slimevr.games.vrchat.VRCConfigValues
import dev.slimevr.steamvr.SteamVRUtils
import dev.slimevr.tracking.trackers.Tracker
import dev.slimevr.tracking.trackers.TrackerPosition
import dev.slimevr.tracking.trackers.TrackerRole
import dev.slimevr.tracking.trackers.TrackerStatus
import dev.slimevr.tracking.trackers.TrackerUtils
import dev.slimevr.tracking.trackers.udp.TrackerDataType
import io.eiren.util.OperatingSystem
import io.github.axisangles.ktmath.Quaternion
import io.ktor.client.HttpClient
import io.ktor.client.engine.cio.CIO
import kotlinx.coroutines.runBlocking
import solarxr_protocol.datatypes.DeviceIdT
import solarxr_protocol.datatypes.TrackerIdT
import solarxr_protocol.rpc.*
@@ -26,7 +31,7 @@ interface TrackingChecklistListener {
}
class TrackingChecklistManager(private val vrServer: VRServer) : VRCConfigListener {
private var httpClient: HttpClient? = null
private val listeners: MutableList<TrackingChecklistListener> = CopyOnWriteArrayList()
val steps: MutableList<TrackingChecklistStepT> = mutableListOf()
@@ -98,6 +103,16 @@ class TrackingChecklistManager(private val vrServer: VRServer) : VRCConfigListen
},
)
steps.add(
TrackingChecklistStepT().apply {
id = TrackingChecklistStepId.STANDABLE_INSTALLED
enabled = false
optional = false
ignorable = true
visibility = TrackingChecklistStepVisibility.WHEN_INVALID
},
)
steps.add(
TrackingChecklistStepT().apply {
id = TrackingChecklistStepId.TRACKER_ERROR
@@ -278,23 +293,57 @@ class TrackingChecklistManager(private val vrServer: VRServer) : VRCConfigListen
} as? ISteamVRBridge
if (steamVRBridge != null) {
val steamvrConnected = steamVRBridge.isConnected()
val vrServerProcName = when (OperatingSystem.currentPlatform) {
OperatingSystem.WINDOWS -> "vrserver.exe"
else -> "vrserver"
}
val steamvrRunning = steamvrConnected ||
vrServer.processListProvider().any { proc ->
proc.name == vrServerProcName
}
val driverList = if (steamvrRunning) {
runBlocking {
if (httpClient == null) httpClient = HttpClient(CIO)
SteamVRUtils.getDriversList(httpClient!!)
}
} else {
null
}
val driver = driverList?.firstOrNull { driver ->
driver.manifest.name == "slimevr"
}
val standableInstalled = driverList?.any { driver ->
driver.manifest.name == "standable"
} ?: false
updateValidity(
TrackingChecklistStepId.STEAMVR_DISCONNECTED,
steamvrConnected,
) {
it.enabled = true
if (!steamvrConnected) {
it.extraData = TrackingChecklistExtraDataUnion().apply {
it.extraData = if (!steamvrConnected) {
TrackingChecklistExtraDataUnion().apply {
type = TrackingChecklistExtraData.TrackingChecklistSteamVRDisconnected
value = TrackingChecklistSteamVRDisconnectedT().apply {
bridgeSettingsName = steamVRBridge.getBridgeConfigKey()
driverInstalled = !steamvrRunning || driverList == null || driver != null
driverBlockedBySafeMode = driver?.blockedBySafeMode ?: false
driverEnabled = driver?.enabled ?: true
}
}
} else {
it.extraData = null
null
}
}
updateValidity(
TrackingChecklistStepId.STANDABLE_INSTALLED,
!standableInstalled,
) {
it.enabled = true
}
val handsEnabled = steamVRBridge.getShareSetting(TrackerRole.LEFT_HAND) || steamVRBridge.getShareSetting(TrackerRole.RIGHT_HAND)
val hasControllers = vrServer.allTrackers.any {
(it.trackerPosition == TrackerPosition.LEFT_HAND || it.trackerPosition == TrackerPosition.RIGHT_HAND) && it.isComputed && !it.isInternal
@@ -6,6 +6,7 @@ import dev.slimevr.VRServer
import dev.slimevr.VRServer.Companion.getNextLocalTrackerId
import dev.slimevr.VRServer.Companion.instance
import dev.slimevr.bridge.Bridge
import dev.slimevr.tracking.trackers.DeviceOrigin
import dev.slimevr.tracking.trackers.Tracker
import dev.slimevr.tracking.trackers.TrackerPosition
import dev.slimevr.tracking.trackers.TrackerStatus
@@ -63,7 +64,7 @@ class WebSocketVRBridge(
if (hmdTracker == null) {
// Create HMD for websocket
val hmdDevice = server.deviceManager
.createDevice("WebSocketVRBridge", null, null)
.createDevice(DeviceOrigin.WEBSOCKET, "WebSocketVRBridge", null, null)
hmdTracker = Tracker(
null,
getNextLocalTrackerId(),
@@ -2,10 +2,13 @@ package io.eiren.util
import dev.slimevr.SLIMEVR_IDENTIFIER
import java.io.File
import java.io.IOException
import java.nio.file.Path
import java.util.*
import kotlin.io.path.Path
data class Process(val pid: ULong, val name: String)
enum class OperatingSystem(
val descriptor: String,
private val aliases: Array<String>,
+10 -5
View File
@@ -13,7 +13,6 @@ plugins {
application
id("com.gradleup.shadow")
id("com.github.gmazzo.buildconfig")
id("org.ajoberstar.grgit")
}
kotlin {
@@ -89,12 +88,18 @@ buildConfig {
useKotlinOutput { topLevelConstants = true }
packageName("dev.slimevr.desktop")
val gitCommitHash = providers.exec {
commandLine("git", "rev-parse", "--short=8", "HEAD")
}.standardOutput.asText.get().trim()
val gitVersionTag = providers.exec {
commandLine("git", "--no-pager", "tag", "--sort", "-taggerdate", "--points-at", "HEAD")
}.standardOutput.asText.get().split('\n').first()
buildConfigField("String", "GIT_COMMIT_HASH", "\"${grgit.head().abbreviatedId}\"")
buildConfigField("String", "GIT_VERSION_TAG", "\"${gitVersionTag.trim()}\"")
buildConfigField("boolean", "GIT_CLEAN", grgit.status().isClean.toString())
}.standardOutput.asText.get().trim()
val gitIsClean = providers.exec {
commandLine("git", "status", "--porcelain")
}.standardOutput.asText.get().trim().isEmpty()
buildConfigField("String", "GIT_COMMIT_HASH", "\"${gitCommitHash}\"")
buildConfigField("String", "GIT_VERSION_TAG", "\"${gitVersionTag}\"")
buildConfigField("boolean", "GIT_CLEAN", gitIsClean.toString())
}
tasks.run<JavaExec> {
@@ -1,26 +1,31 @@
package dev.slimevr.desktop
import com.sun.jna.Native
import com.sun.jna.Pointer
import com.sun.jna.platform.win32.COM.COMException
import com.sun.jna.platform.win32.COM.COMUtils
import com.sun.jna.platform.win32.COM.Dispatch
import com.sun.jna.platform.win32.Guid.CLSID
import com.sun.jna.platform.win32.Guid.IID
import com.sun.jna.platform.win32.IPHlpAPI
import com.sun.jna.platform.win32.IPHlpAPI.AF_UNSPEC
import com.sun.jna.platform.win32.OaIdl.VARIANT_BOOLByReference
import com.sun.jna.platform.win32.Ole32
import com.sun.jna.platform.win32.OleAuto
import com.sun.jna.platform.win32.WTypes
import com.sun.jna.platform.win32.WinDef
import com.sun.jna.platform.win32.WinError
import com.sun.jna.platform.win32.WinNT
import com.sun.jna.platform.win32.WinNT.HRESULT
import com.sun.jna.ptr.IntByReference
import com.sun.jna.ptr.PointerByReference
import com.sun.jna.win32.StdCallLibrary
import dev.slimevr.ConnectivityFlags
import dev.slimevr.NetworkCategory
import dev.slimevr.NetworkInfo
import dev.slimevr.NetworkProfileChecker
import dev.slimevr.VRServer
import io.eiren.util.OperatingSystem
import java.util.*
import kotlin.concurrent.scheduleAtFixedRate
import io.eiren.util.logging.LogManager
/**
* @see <a href="https://learn.microsoft.com/en-us/windows/win32/api/netlistmgr/nn-netlistmgr-inetworkconnection">INetworkConnection interface (netlistmgr.h)</a>
@@ -234,13 +239,44 @@ constructor() : AutoCloseable {
}
}
@Suppress("ktlint:standard:function-naming", "ktlint:standard:class-naming")
interface NetIOAPI : IPHlpAPI {
enum class MIB_NOTIFICATION_TYPE(val native: Int) {
MibParameterNotification(0),
MibAddInstance(1),
MibDeleteInstance(2),
MibInitialNotification(3),
;
companion object {
fun fromNative(native: Int) = byNative[native]
private val byNative = entries.associateBy { it.native }
}
}
interface IPINTERFACE_CHANGE_CALLBACK : StdCallLibrary.StdCallCallback {
fun callback(
context: Pointer?,
row: Pointer?,
/* MIB_NOTIFICATION_TYPE */
notificationType: Int,
)
}
fun NotifyIpInterfaceChange(family: Int, callback: IPINTERFACE_CHANGE_CALLBACK, context: Pointer?, initialNotification: WinDef.BOOL, notificationHandle: WinNT.HANDLEByReference): Long
fun CancelMibChangeNotify2(notificationHandle: WinNT.HANDLE): Long
companion object {
val INSTANCE: NetIOAPI = Native.load("Iphlpapi", NetIOAPI::class.java)
}
}
fun enumerateNetworks(): List<NetworkInfo>? {
if (OperatingSystem.currentPlatform != OperatingSystem.WINDOWS) {
return null
}
try {
COMNetworkManager().use { netmgr ->
netmgr.instance.GetNetworkConnections().use { conns ->
COMNetworkManager().use { netMgr ->
netMgr.instance.GetNetworkConnections().use { conns ->
return generateSequence { conns.Next() }
.map { conn ->
conn.use {
@@ -257,14 +293,16 @@ fun enumerateNetworks(): List<NetworkInfo>? {
}.toList()
}
}
} catch (err: Exception) {
println(err.stackTraceToString())
} catch (e: Exception) {
LogManager.severe("[DesktopNetworkProfileChecker] Exception when enumerating networks", e)
}
return null
}
class DesktopNetworkProfileChecker(private val server: VRServer) : NetworkProfileChecker() {
private val updateTickTimer = Timer("NetworkProfileCheck")
class DesktopNetworkProfileChecker :
NetworkProfileChecker(),
Runnable {
private val thread = Thread(this, "DesktopNetworkProfileChecker runner")
private var publicNetworksLocal: List<NetworkInfo> = listOf()
override val isSupported: Boolean
@@ -274,11 +312,40 @@ class DesktopNetworkProfileChecker(private val server: VRServer) : NetworkProfil
get() = publicNetworksLocal
init {
if (OperatingSystem.currentPlatform == OperatingSystem.WINDOWS) {
this.updateTickTimer.scheduleAtFixedRate(0, 3000) {
publicNetworksLocal = enumerateNetworks()?.filter { net ->
net.connected == true && net.category == NetworkCategory.PUBLIC
} ?: listOf()
if (isSupported) {
thread.start()
}
}
override fun run() {
val handle = WinNT.HANDLEByReference()
val callback = object : NetIOAPI.IPINTERFACE_CHANGE_CALLBACK {
override fun callback(
context: Pointer?,
row: Pointer?,
notificationType: Int,
) {
synchronized(publicNetworksLocal) {
publicNetworksLocal = enumerateNetworks()?.filter { net ->
net.connected && net.category == NetworkCategory.PUBLIC
} ?: listOf()
}
}
}
val ret = NetIOAPI.INSTANCE.NotifyIpInterfaceChange(AF_UNSPEC, callback, null, WinDef.BOOL(true), handle)
if (ret != WinError.ERROR_SUCCESS.toLong()) {
LogManager.warning("[DesktopNetworkProfileChecker] Error registering network interface change callback, public interface detection will not work: $ret")
return
}
try {
while (true) Thread.sleep(Long.MAX_VALUE)
} catch (_: InterruptedException) {} finally {
handle.value?.let {
try {
NetIOAPI.INSTANCE.CancelMibChangeNotify2(it)
} catch (_: Exception) {}
}
}
}
@@ -2,6 +2,13 @@
package dev.slimevr.desktop
import com.sun.jna.Native
import com.sun.jna.platform.win32.Kernel32
import com.sun.jna.platform.win32.Shell32
import com.sun.jna.platform.win32.Tlhelp32
import com.sun.jna.platform.win32.WinBase
import com.sun.jna.platform.win32.WinDef
import com.sun.jna.platform.win32.WinUser
import dev.slimevr.FeatureFlags
import dev.slimevr.Keybinding
import dev.slimevr.SLIMEVR_IDENTIFIER
@@ -20,6 +27,8 @@ import dev.slimevr.desktop.serial.DesktopSerialHandler
import dev.slimevr.desktop.tracking.trackers.hid.DesktopHIDManager
import dev.slimevr.tracking.trackers.Tracker
import io.eiren.util.OperatingSystem
import io.eiren.util.OperatingSystem.Companion.currentPlatform
import io.eiren.util.Process
import io.eiren.util.collections.FastList
import io.eiren.util.logging.LogManager
import org.apache.commons.cli.CommandLine
@@ -156,7 +165,9 @@ fun main(args: Array<String>) {
{ _ -> DesktopSerialHandler() },
{ _ -> DesktopSerialFlashingHandler() },
{ _ -> DesktopVRCConfigHandler() },
{ server -> DesktopNetworkProfileChecker(server) },
{ _ -> DesktopNetworkProfileChecker() },
::getRunningProcesses,
::tryOpenUri,
configManager = configManager,
)
vrServer.start()
@@ -265,6 +276,68 @@ fun provideBridges(
}
}
fun getRunningProcesses(): Sequence<Process> = when (currentPlatform) {
OperatingSystem.LINUX -> sequence {
val psProc = try {
ProcessBuilder("ps", "-eo", "pid,comm").redirectErrorStream(true).start()
} catch (_: IOException) {
return@sequence
}
val lines = psProc.inputStream.bufferedReader().readLines()
// skip the header
for (line in lines.slice(1 until lines.size)) {
val data = line.trimStart().split(' ')
yield(Process(data[0].toULong(), data[1]))
}
}
OperatingSystem.WINDOWS -> sequence {
val k32 = Kernel32.INSTANCE
val snapshot = k32.CreateToolhelp32Snapshot(Tlhelp32.TH32CS_SNAPPROCESS, WinDef.DWORD(0))
if (WinBase.INVALID_HANDLE_VALUE.equals(snapshot)) {
return@sequence
}
try {
val entry = Tlhelp32.PROCESSENTRY32()
if (!k32.Process32First(snapshot, entry)) {
LogManager.warning("[Windows] Failed to retrieve process information: " + k32.GetLastError())
return@sequence
}
do {
yield(Process(entry.th32ProcessID.toLong().toULong(), Native.toString(entry.szExeFile)))
} while (k32.Process32Next(snapshot, entry))
} finally {
k32.CloseHandle(snapshot)
}
}
else -> emptySequence()
}
fun tryOpenUri(uri: String) {
when (currentPlatform) {
OperatingSystem.LINUX -> {
try {
ProcessBuilder("xdg-open", uri).start()
} catch (e: Exception) {
LogManager.severe("[Linux] Failed to open URI $uri", e)
}
}
OperatingSystem.WINDOWS -> {
val ret = Shell32.INSTANCE.ShellExecute(null, null, uri, null, null, WinUser.SW_SHOWNORMAL).toLong()
if (ret <= 32) {
LogManager.severe("[Windows] Failed to open URI $uri: $ret (${Kernel32.INSTANCE.GetLastError()})")
}
}
else -> {}
}
}
const val CONFIG_FILENAME = "vrconfig.yml"
fun resolveConfig(): String {
// If config folder exists, then save config on relative path
@@ -6,6 +6,7 @@ import com.sun.jna.platform.win32.Advapi32Util
import com.sun.jna.platform.win32.WinNT
import com.sun.jna.platform.win32.WinReg
import com.sun.jna.ptr.IntByReference
import dev.slimevr.desktop.platform.linux.SteamUtils
import io.eiren.util.logging.LogManager
import java.io.BufferedReader
import java.io.FileReader
@@ -13,8 +14,6 @@ import java.io.InvalidObjectException
import java.nio.ByteBuffer
import java.nio.ByteOrder
import java.nio.file.Path
import kotlin.io.path.Path
import kotlin.io.path.exists
abstract class AbstractRegEdit {
abstract fun getQwordValue(path: String, key: String): Double?
@@ -72,7 +71,7 @@ class RegEditWindows : AbstractRegEdit() {
keysMap[it.key.replace("""_h\d+$""".toRegex(), "")] = it.key
}
} catch (e: Exception) {
LogManager.severe("[VRChatRegEdit] Error reading Values from VRC registry: ${e.message}")
LogManager.severe("[VRChatRegEdit] Error reading values from VRC registry: ${e.message}")
}
return keysMap
}
@@ -92,11 +91,13 @@ class RegEditWindows : AbstractRegEdit() {
}
class RegEditLinux : AbstractRegEdit() {
private val userRegPath: Path? = SteamUtils.findAppLibraryLocation(438100)?.resolve(USER_REG_SUBPATH)
init {
if (USER_REG_PATH == null) {
if (userRegPath == null) {
LogManager.info("[VRChatRegEdit] Couldn't find any VRChat registry file")
} else {
LogManager.info("[VRChatRegEdit] Using VRChat registry file: $USER_REG_PATH")
LogManager.info("[VRChatRegEdit] Using VRChat registry file: $userRegPath")
}
}
lateinit var registry: Map<String, String>
@@ -129,7 +130,7 @@ class RegEditLinux : AbstractRegEdit() {
val map = mutableMapOf<String, String>()
try {
BufferedReader(FileReader(USER_REG_PATH?.toFile() ?: return keysMap)).use { reader ->
BufferedReader(FileReader(userRegPath?.toFile() ?: return keysMap)).use { reader ->
// The reg file uses double backward-slash for paths
val actualPath = "[${path.replace("\\", """\\""")}]"
while (reader.ready()) {
@@ -141,7 +142,7 @@ class RegEditLinux : AbstractRegEdit() {
val keyValue = reader.readLine()
if (keyValue == "") break
KEY_VALUE_PATTERN.matchEntire(keyValue)?.let {
REG_KEY_VALUE_PATTERN.matchEntire(keyValue)?.let {
map[it.groupValues[1]] = it.groupValues[2]
keysMap[it.groupValues[1].replace("""_h\d+$""".toRegex(), "")] = it.groupValues[1]
}
@@ -150,7 +151,7 @@ class RegEditLinux : AbstractRegEdit() {
}
}
} catch (e: Exception) {
LogManager.severe("[VRChatRegEdit] Error reading Values from VRC registry: ${e.message}")
LogManager.severe("[VRChatRegEdit] Error reading values from VRC registry: ${e.message}")
}
registry = map
return keysMap
@@ -160,79 +161,9 @@ class RegEditLinux : AbstractRegEdit() {
override fun getKeyByPath(hkey: WinReg.HKEY, path: String): Map<String, String> = mutableMapOf<String, String>()
companion object {
private fun findAppLibraryLocation(steamPath: Path, appId: Int): Path? {
val keyValueRegex = Regex(""""(\w+)"[ \t]*(?:"(.+)")?""")
try {
BufferedReader(FileReader(steamPath.resolve("config/libraryfolders.vdf").toFile())).use { reader ->
var depth = 0
var currentLibraryPath: Path? = null
while (reader.ready()) {
val line = reader.readLine().trim()
if (line == "{") {
depth += 1
continue
}
if (line == "}") {
depth -= 1
continue
}
keyValueRegex.matchEntire(line)?.let {
val key = it.groupValues[1]
val value = it.groupValues[2]
when (depth) {
0 -> {
require(key == "libraryfolders") { "root key must be libraryfolders" }
}
1 -> {
// start of a library node
}
2 -> {
// in a library node
if (key == "path") {
currentLibraryPath = Path(value)
} else if (key == "apps") {
// start of apps node
require(currentLibraryPath != null) { "path must come before apps in node" }
}
}
3 -> {
// in apps node
val curAppId = try {
key.toInt()
} catch (_: NumberFormatException) {
null
}
if (curAppId != null && curAppId == appId) {
assert(currentLibraryPath != null)
return currentLibraryPath
}
}
}
}
}
LogManager.warning("[VRChatRegEdit] Couldn't find library folder for appid $appId")
}
} catch (e: Exception) {
LogManager.severe("[VRChatRegEdit] Error parsing Steam libraryfolders", e)
}
return null
}
const val USER_REG_SUBPATH = "steamapps/compatdata/438100/pfx/user.reg"
val STEAM_PATH = System.getenv("HOME")?.let { home ->
Path(home, ".steam", "root").takeIf { it.exists() }
?: Path(home, ".steam", "debian-installation").takeIf { it.exists() }
?: Path(home, ".var", "app", "com.valvesoftware.Steam", "data", "Steam").takeIf { it.exists() }
}
val USER_REG_PATH: Path? = if (STEAM_PATH != null) findAppLibraryLocation(STEAM_PATH, 438100)?.resolve(USER_REG_SUBPATH) else null
val KEY_VALUE_PATTERN = Regex(""""(.+)"=(.+)""")
val REG_KEY_VALUE_PATTERN = Regex(""""(.+)"=(.+)""")
val HEX_FORMAT = HexFormat {
upperCase = false
@@ -3,14 +3,31 @@ package dev.slimevr.desktop.install.drivers
import io.eiren.util.logging.LogManager
import java.io.IOException
fun executeShellCommand(vararg command: String): String? = try {
fun executeShellCommand(vararg command: String): Pair<Int, String>? = try {
val process = ProcessBuilder(*command)
.redirectErrorStream(true)
.start()
process.inputStream.bufferedReader().readText().also {
process.waitFor()
}
process.waitFor()
Pair(process.exitValue(), process.inputStream.bufferedReader().readText())
} catch (e: IOException) {
LogManager.warning("Error executing shell command", e)
null
}
// vrpathreg returns 1 if the driver is present
fun shouldInstallDriver(exitCode: Int): Boolean = exitCode == 1
// get a descriptive reason why we're skipping driver installation
// Exit codes from vrpathreg output:
// 0 : Success
// 1 : ( finddriver only ) Driver not present
// 2 : ( finddriver only ) Error, driver installed more than once
// -1 : Configuration or permission problem
// -2 : Argument problem
fun getDriverInstallSkipReason(exitCode: Int): String = when (exitCode) {
0 -> "driver already installed"
2 -> "driver installed more than once"
-1 -> "SteamVR is misconfigured"
else -> "unknown reason ($exitCode)"
}
@@ -1,10 +1,9 @@
package dev.slimevr.desktop.install.drivers
import dev.slimevr.desktop.featureFlags
import dev.slimevr.desktop.platform.linux.SteamUtils
import io.eiren.util.logging.LogManager
class Linux {
val path: String = System.getProperty("user.dir")
fun updateLinux() {
@@ -12,21 +11,29 @@ class Linux {
}
fun updateLinuxSteamVRDriver() {
val pathRegPath = "${System.getProperty("user.home")}/.steam/steam/steamapps/common/SteamVR/bin/vrpathreg.sh"
val vrPathRegContents = executeShellCommand(pathRegPath)
if (vrPathRegContents == null) {
LogManager.warning("SteamVR driver installation failed")
return
}
if (vrPathRegContents.contains("slimevr")) {
LogManager.info("SteamVR driver is already installed")
val steamVRLocation = SteamUtils.findAppLibraryLocation(250820)?.resolve("steamapps/common/SteamVR") ?: run {
LogManager.warning("SteamVR driver installation failed: couldn't find SteamVR")
return
}
executeShellCommand(pathRegPath, "adddriver", "$path/$LINUX_STEAM_DRIVER_DIRECTORY")
val pathRegPath = "$steamVRLocation/bin/vrpathreg.sh"
val (findExitCode, _) = executeShellCommand(pathRegPath, "finddriver", "slimevr") ?: run {
LogManager.warning("SteamVR driver installation failed: couldn't run vrpathreg finddriver")
return
}
if (executeShellCommand(pathRegPath)?.contains("slimevr") != true) {
LogManager.warning("Failed to install SteamVR driver")
if (!shouldInstallDriver(findExitCode)) {
LogManager.info("Skipping SteamVR driver installation: ${getDriverInstallSkipReason(findExitCode)}")
return
}
val (addExitCode, _) = executeShellCommand(pathRegPath, "adddriver", "$path/$LINUX_STEAM_DRIVER_DIRECTORY") ?: run {
LogManager.warning("SteamVR driver installation failed: couldn't run vrpathreg adddriver")
return
}
if (addExitCode != 0) {
LogManager.warning("SteamVR driver installation failed: vrpathreg exited with code $addExitCode")
return
}
LogManager.info("SteamVR driver successfully installed")
@@ -3,9 +3,10 @@ package dev.slimevr.desktop.install.drivers
import com.sun.jna.platform.win32.WinReg
import dev.slimevr.desktop.games.vrchat.RegEditWindows
import io.eiren.util.logging.LogManager
import kotlin.io.path.Path
import kotlin.io.path.exists
class Windows {
val path: String = System.getProperty("user.dir")
fun updateWindows() {
@@ -14,28 +15,36 @@ class Windows {
fun steamVRDriver() {
val regEdit = RegEditWindows()
val regQuery = regEdit.getKeyByPath(WinReg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam App 250820")
val steamVRLocation = regQuery["InstallLocation"]
if (steamVRLocation == null || !steamVRLocation.contains("SteamVR")) {
LogManager.warning("Can't find SteamVR, unable to install SteamVR driver")
val steamVRLocation = regEdit.getKeyByPath(WinReg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam App 250820")["InstallLocation"]
if (steamVRLocation == null || !steamVRLocation.endsWith("SteamVR")) {
LogManager.warning("SteamVR driver installation failed: couldn't find SteamVR")
return
}
val pathRegPath = "${steamVRLocation}\\bin\\win64\\vrpathreg.exe"
val vrPathRegContents = executeShellCommand(pathRegPath, "finddriver", "slimevr")
if (vrPathRegContents == null) {
LogManager.warning("Error installing SteamVR driver")
return
}
if (vrPathRegContents.contains("slimevr")) {
LogManager.info("SteamVR driver is already installed")
if (Path(steamVRLocation, "drivers", "slimevr").exists()) {
LogManager.warning("Skipping SteamVR driver installation: driver is in SteamVR drivers folder")
LogManager.warning("If you would like the SteamVR driver to automatically update, please uninstall the other version of SlimeVR")
return
}
executeShellCommand(pathRegPath, "adddriver", "${path}\\${WINDOWS_STEAMVR_DRIVER_DIRECTORY}")
val pathRegPath = "$steamVRLocation\\bin\\win64\\vrpathreg.exe"
val (findExitCode, _) = executeShellCommand(pathRegPath, "finddriver", "slimevr") ?: run {
LogManager.warning("SteamVR driver installation failed: couldn't run vrpathreg finddriver")
return
}
if (executeShellCommand(pathRegPath, "finddriver", "slimevr")?.contains("slimevr") != true) {
LogManager.warning("Failed to install SlimeVR driver")
if (!shouldInstallDriver(findExitCode)) {
LogManager.info("Skipping SteamVR driver installation: ${getDriverInstallSkipReason(findExitCode)}")
return
}
val (addExitCode, _) = executeShellCommand(pathRegPath, "adddriver", "$path\\$WINDOWS_STEAMVR_DRIVER_DIRECTORY") ?: run {
LogManager.warning("SteamVR driver installation failed: couldn't run vrpathreg adddriver")
return
}
if (addExitCode != 0) {
LogManager.warning("SteamVR driver installation failed: vrpathreg exited with code $addExitCode")
return
}
LogManager.info("SteamVR driver successfully installed")
@@ -8,6 +8,7 @@ import dev.slimevr.bridge.ISteamVRBridge
import dev.slimevr.config.BridgeConfig
import dev.slimevr.desktop.platform.ProtobufMessages.*
import dev.slimevr.protocol.rpc.settings.RPCSettingsHandler
import dev.slimevr.tracking.trackers.DeviceOrigin
import dev.slimevr.tracking.trackers.Tracker
import dev.slimevr.tracking.trackers.TrackerPosition
import dev.slimevr.tracking.trackers.TrackerPosition.Companion.getByTrackerRole
@@ -57,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()
}
@@ -76,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)
@@ -140,61 +147,33 @@ abstract class SteamVRBridge(
if (!config.automaticSharedTrackersToggling || server.getPauseTracking()) return false
val skeleton = instance.humanPoseManager.skeleton
val isWaistSteamVr = skeleton.hipTracker?.device?.isOpenVrDevice == true ||
skeleton.waistTracker?.device?.isOpenVrDevice == true
// Enable waist if skeleton has an spine tracker
changeShareSettings(TrackerRole.WAIST, skeleton.hasSpineTracker && !isWaistSteamVr)
// hasChest if waist and/or hip is on, and chest and/or upper chest is also on
val hasChest = skeleton.upperChestTracker != null || skeleton.chestTracker != null
val isChestSteamVr = skeleton.upperChestTracker?.device?.isOpenVrDevice == true ||
skeleton.chestTracker?.device?.isOpenVrDevice == true
changeShareSettings(
TrackerRole.CHEST,
hasChest && !isChestSteamVr,
)
// hasFeet if lower and/or upper leg tracker is on
val hasLeftFoot =
(skeleton.leftUpperLegTracker != null || skeleton.leftLowerLegTracker != null)
val isLeftFootSteamVr =
skeleton.leftLowerLegTracker?.device?.isOpenVrDevice == true ||
skeleton.leftFootTracker?.device?.isOpenVrDevice == true
val hasRightFoot =
(skeleton.rightUpperLegTracker != null || skeleton.rightLowerLegTracker != null)
val isRightFootSteamVr =
skeleton.rightLowerLegTracker?.device?.isOpenVrDevice == true ||
skeleton.rightFootTracker?.device?.isOpenVrDevice == true
changeShareSettings(
TrackerRole.LEFT_FOOT,
hasLeftFoot && !isLeftFootSteamVr,
)
changeShareSettings(
TrackerRole.RIGHT_FOOT,
hasRightFoot && !isRightFootSteamVr,
)
// hasKnees is just hasFeet
val isLeftKneeSteamVr = skeleton.leftUpperLegTracker?.device?.isOpenVrDevice == true
val isRightKneeSteamVr = skeleton.rightUpperLegTracker?.device?.isOpenVrDevice == true
changeShareSettings(TrackerRole.LEFT_KNEE, hasLeftFoot && !isLeftKneeSteamVr)
changeShareSettings(TrackerRole.RIGHT_KNEE, hasRightFoot && !isRightKneeSteamVr)
// hasElbows if an upper arm or a lower arm tracker is on
val hasLeftElbow = skeleton.hasLeftArmTracker
val isLeftElbowSteamVr = skeleton.leftUpperArmTracker?.device?.isOpenVrDevice == true ||
skeleton.leftLowerArmTracker?.device?.isOpenVrDevice == true
val hasRightElbow = skeleton.hasRightArmTracker
val isRightElbowSteamVr = skeleton.rightUpperArmTracker?.device?.isOpenVrDevice == true ||
skeleton.rightLowerArmTracker?.device?.isOpenVrDevice == true
changeShareSettings(TrackerRole.LEFT_ELBOW, hasLeftElbow && !isLeftElbowSteamVr)
changeShareSettings(TrackerRole.RIGHT_ELBOW, hasRightElbow && !isRightElbowSteamVr)
// Hands aren't touched as they will override the controller's tracking
// Return true to say that trackers were successfully toggled automatically
val roleToTrackers = mapOf(
TrackerRole.CHEST to setOf(skeleton.upperChestTracker, skeleton.chestTracker),
TrackerRole.LEFT_ELBOW to setOf(skeleton.leftUpperArmTracker),
TrackerRole.RIGHT_ELBOW to setOf(skeleton.rightUpperArmTracker),
TrackerRole.WAIST to setOf(skeleton.waistTracker, skeleton.hipTracker),
TrackerRole.LEFT_KNEE to setOf(skeleton.leftUpperLegTracker),
TrackerRole.RIGHT_KNEE to setOf(skeleton.rightUpperLegTracker),
TrackerRole.LEFT_FOOT to setOf(skeleton.leftLowerLegTracker, skeleton.leftFootTracker),
TrackerRole.RIGHT_FOOT to setOf(skeleton.rightLowerLegTracker, skeleton.rightFootTracker),
)
for ((role, trackers) in roleToTrackers) {
val shouldShare = if (role == TrackerRole.WAIST) {
// Waist is special, it should be enabled if there is any tracker on the spine,
// but ignored if the waist or hip tracker is from us
skeleton.hasSpineTracker &&
!trackers.any {
it?.device?.origin == DeviceOrigin.STEAMVR
}
} else {
trackers.any {
it != null && it.device?.origin != DeviceOrigin.STEAMVR
}
}
changeShareSettings(role, shouldShare)
}
return true
}
@@ -228,6 +207,7 @@ abstract class SteamVRBridge(
override fun createNewTracker(trackerAdded: TrackerAdded): Tracker {
val device = instance.deviceManager
.createDevice(
DeviceOrigin.STEAMVR,
trackerAdded.trackerName,
null,
trackerAdded.manufacturer.ifEmpty { "OpenVR" },
@@ -0,0 +1,84 @@
package dev.slimevr.desktop.platform.linux
import io.eiren.util.logging.LogManager
import java.io.BufferedReader
import java.io.FileReader
import java.nio.file.Path
import kotlin.io.path.Path
import kotlin.io.path.exists
class SteamUtils {
companion object {
val STEAM_PATH = System.getenv("HOME")?.let { home ->
Path(home, ".steam", "root").takeIf { it.exists() }
?: Path(home, ".steam", "debian-installation").takeIf { it.exists() }
?: Path(home, ".var", "app", "com.valvesoftware.Steam", "data", "Steam").takeIf { it.exists() }
}
val VDF_KEY_VALUES_PATTERN = Regex(""""(\w+)"[ \t]*(?:"(.+)")?""")
fun findAppLibraryLocation(appId: Int): Path? {
if (STEAM_PATH == null) return null
try {
BufferedReader(FileReader(STEAM_PATH.resolve("config/libraryfolders.vdf").toFile())).use { reader ->
var depth = 0
var currentLibraryPath: Path? = null
while (reader.ready()) {
val line = reader.readLine().trim()
if (line == "{") {
depth += 1
continue
}
if (line == "}") {
depth -= 1
continue
}
VDF_KEY_VALUES_PATTERN.matchEntire(line)?.let {
val key = it.groupValues[1]
val value = it.groupValues[2]
when (depth) {
0 -> {
require(key == "libraryfolders") { "root key must be libraryfolders" }
}
1 -> {
// start of a library node
}
2 -> {
// in a library node
if (key == "path") {
currentLibraryPath = Path(value)
} else if (key == "apps") {
// start of apps node
require(currentLibraryPath != null) { "path must come before apps in node" }
}
}
3 -> {
// in apps node
val curAppId = try {
key.toInt()
} catch (_: NumberFormatException) {
null
}
if (curAppId != null && curAppId == appId) {
check(currentLibraryPath != null) { "path must come before apps in node" }
return currentLibraryPath
}
}
}
}
}
LogManager.warning("[RegEdit] Couldn't find library folder for appid $appId")
}
} catch (e: Exception) {
LogManager.severe("[RegEdit] Error parsing Steam libraryfolders", e)
}
return null
}
}
}
@@ -5,6 +5,7 @@ import com.fazecast.jSerialComm.SerialPortEvent
import com.fazecast.jSerialComm.SerialPortMessageListener
import dev.slimevr.serial.SerialHandler
import dev.slimevr.serial.SerialListener
import dev.slimevr.tracking.trackers.hid.HIDCommon
import io.eiren.util.logging.LogManager
import java.io.IOException
import java.io.OutputStreamWriter
@@ -88,13 +89,14 @@ class DesktopSerialHandler :
}
@Synchronized
override fun openSerial(portLocation: String?, auto: Boolean): Boolean {
override fun openSerial(portLocation: String?, auto: Boolean, autoIncludeHid: Boolean): Boolean {
LogManager.info("[SerialHandler] Trying to open: $portLocation, auto: $auto")
val ports = SerialPort.getCommPorts()
lastKnownPorts = ports.map { SerialPortWrapper(it) }.toSet()
val newPort: SerialPort? = ports.find {
(!auto && it.portLocation == portLocation) ||
(auto && isKnownBoard(SerialPortWrapper(it)))
(auto && isKnownBoard(SerialPortWrapper(it))) ||
(auto && autoIncludeHid && HIDCommon.matchesAny(it.vendorID, it.productID))
}
if (newPort == null) {
LogManager.info(
@@ -244,7 +246,7 @@ class DesktopSerialHandler :
get() = SerialPort.getCommPorts()
.asSequence()
.map { SerialPortWrapper(it) }
.filter { isKnownBoard(it) }
.filter { isKnownBoard(it) || HIDCommon.matchesAny(it.vendorId, it.productId) }
.asStream()
private fun detectNewPorts() {
@@ -261,7 +263,7 @@ class DesktopSerialHandler :
}
}
override fun getCurrentPort(): dev.slimevr.serial.SerialPort? {
override fun getCurrentPort(): SlimeSerialPort? {
val port = this.currentPort ?: return null
return SerialPortWrapper(port)
}
@@ -54,6 +54,23 @@ class DesktopHIDManager(name: String, private val trackersConsumer: Consumer<Tra
}
}
private fun onHidDeviceReattached(hidDevice: HidDevice, deviceList: MutableList<Int>, serial: String) {
this.devicesByHID[hidDevice] = deviceList
this.lastDataByHID[hidDevice] = 0
synchronized(this.devices) {
for (id in deviceList) {
val device = this.devices[id]
for (value in device.trackers.values) {
if (value.status == TrackerStatus.DISCONNECTED) {
value.status = TrackerStatus.OK
}
value.heartbeat()
}
}
}
LogManager.info("[TrackerServer] Linked HID device reattached: $serial")
}
private fun checkConfigureDevice(hidDevice: HidDevice) {
if (HIDCommon.matchesAny(hidDevice.vendorId, hidDevice.productId)) {
val serial = hidDevice.serialNumber ?: "Unknown HID Device"
@@ -67,16 +84,7 @@ class DesktopHIDManager(name: String, private val trackersConsumer: Consumer<Tra
// val product = hidDevice.product
// val manufacturer = hidDevice.manufacturer
this.devicesBySerial[serial]?.let {
this.devicesByHID[hidDevice] = it
synchronized(this.devices) {
for (id in it) {
val device = this.devices[id]
for (value in device.trackers.values) {
if (value.status == TrackerStatus.DISCONNECTED) value.status = TrackerStatus.OK
}
}
}
LogManager.info("[TrackerServer] Linked HID device reattached: $serial")
onHidDeviceReattached(hidDevice, it, serial)
return
}
@@ -118,7 +126,11 @@ class DesktopHIDManager(name: String, private val trackersConsumer: Consumer<Tra
currentThread().interrupt()
break
}
dataRead() // not in try catch?
try {
dataRead()
} catch (e: Exception) {
LogManager.severe("[TrackerServer] HID data read failed: ${e.message}", e)
}
}
}
@@ -138,7 +150,11 @@ class DesktopHIDManager(name: String, private val trackersConsumer: Consumer<Tra
currentThread().interrupt()
break
}
deviceEnumerate() // not in try catch?
try {
deviceEnumerate()
} catch (e: Exception) {
LogManager.severe("[TrackerServer] HID device enumerate failed: ${e.message}", e)
}
}
}
@@ -198,7 +214,7 @@ class DesktopHIDManager(name: String, private val trackersConsumer: Consumer<Tra
}
// LogManager.info("[TrackerServer] HID received $packetCount tracker packets")
} else {
lastDataByHID[hidDevice] = lastDataByHID[hidDevice]!! + 1 // increment last data received
lastDataByHID[hidDevice] = lastDataByHID.getOrDefault(hidDevice, 0) + 1
}
}
if (!devicesPresent) {
@@ -242,12 +258,13 @@ class DesktopHIDManager(name: String, private val trackersConsumer: Consumer<Tra
}
// Quickly reattaching a device may not be detected, so always try to open existing devices
for (device in devicesByHID.keys) {
val lastData = lastDataByHID.getOrDefault(device, 0)
// a receiver sends keep-alive data at 10 packets/s
if (lastDataByHID[device]!! > 100) { // try to reopen device if no data was received recently (about >100ms)
if (lastDataByHID[device]!! < 10000) {
if (lastData > 100) { // try to reopen device if no data was received recently (about >100ms)
if (lastData < 10000) {
LogManager.info("[TrackerServer] Reopening device ${device.serialNumber} after no data received")
lastDataByHID[device] = 10000 // flag once
} else if (lastDataByHID[device]!! < 20000) {
} else if (lastData < 20000) {
LogManager.info("[TrackerServer] Repeatedly reopening device ${device.serialNumber}")
lastDataByHID[device] = 20000 // flag twice
}
-2
View File
@@ -20,7 +20,6 @@ pluginManagement {
val spotlessVersion: String by settings
val shadowJarVersion: String by settings
val buildconfigVersion: String by settings
val grgitVersion: String by settings
plugins {
kotlin("plugin.serialization") version kotlinVersion
kotlin("jvm") version kotlinVersion
@@ -28,7 +27,6 @@ pluginManagement {
id("com.diffplug.spotless") version spotlessVersion
id("com.gradleup.shadow") version shadowJarVersion
id("com.github.gmazzo.buildconfig") version buildconfigVersion
id("org.ajoberstar.grgit") version grgitVersion
}
}