mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-12-06 08:42:32 -08:00
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62188a8473 | ||
|
|
dbae1e27eb | ||
|
|
e27df69a04 | ||
|
|
d09ad6e18d | ||
|
|
0ebf7be578 | ||
|
|
64261eee6e | ||
|
|
23aa47fc6c | ||
|
|
02e2a00e4f | ||
|
|
aa9fdbe9ee | ||
|
|
4869a5fdfa | ||
|
|
be8eb4ff80 | ||
|
|
49016f4ca3 | ||
|
|
b81fa39499 | ||
|
|
8750da0855 | ||
|
|
6232492ffb |
No files matched your search
@@ -207,6 +207,8 @@ jobs:
|
||||
- name: Run Electron Builder
|
||||
shell: bash
|
||||
run: |
|
||||
set -eo pipefail
|
||||
|
||||
mkdir -p gui/electron/dist/artifacts/linux/ \
|
||||
gui/electron/dist/artifacts/win \
|
||||
gui/electron/dist/artifacts/mac
|
||||
@@ -215,11 +217,51 @@ jobs:
|
||||
VERSION="${VERSION#v}"
|
||||
echo "Building version: $VERSION"
|
||||
pnpm i
|
||||
cd gui/electron
|
||||
pnpm exec electron-builder --${{ matrix.platform }} \
|
||||
cd "${{ github.workspace }}/gui/electron"
|
||||
|
||||
COMMON_ELECTRON_BUILDER_ARGS=(--config.extraMetadata.version="$VERSION" --publish never)
|
||||
# If Linux, build rpm and deb before AppImage (so we don't bundle jre for system packages)
|
||||
pnpm exec electron-builder --${{ matrix.platform }} \
|
||||
${{ matrix.platform == 'macos' && '--universal' || '' }} \
|
||||
--config.extraMetadata.version="$VERSION" \
|
||||
--publish never
|
||||
${{ matrix.platform == 'linux' && 'rpm deb' || ''}} \
|
||||
${COMMON_ELECTRON_BUILDER_ARGS[@]}
|
||||
|
||||
# Fetch JRE from Adoptium and build AppImage
|
||||
# We have to do this afterward because electron-builder does not have a mechanism to
|
||||
# only include a file in extraFiles for a specific target (i.e. only for AppImage)
|
||||
if [[ "${{ matrix.platform }}" == linux ]]; then
|
||||
pushd resources
|
||||
|
||||
# Fetch JRE from Adoptium
|
||||
JRE_ARCHITECTURE="${{ endsWith(matrix.os, '-arm') && 'aarch64' || 'x64' }}"
|
||||
LATEST_JRE_INFO="$(curl -f "https://api.adoptium.net/v3/assets/latest/25/hotspot?architecture=$JRE_ARCHITECTURE&image_type=jre&os=linux&vendor=eclipse")"
|
||||
|
||||
JRE_VERSION="$(echo "$LATEST_JRE_INFO" | jq -r '.[0].release_name')"
|
||||
JRE_ARCHIVE_URL="$(echo "$LATEST_JRE_INFO" | jq -r '.[0].binary.package.link')"
|
||||
JRE_ARCHIVE_NAME="$(echo "$LATEST_JRE_INFO" | jq -r '.[0].binary.package.name')"
|
||||
EXPECTED_JRE_ARCHIVE_CHECKSUM="$(echo "$LATEST_JRE_INFO" | jq -r '.[0].binary.package.checksum')"
|
||||
echo "Downloading Adoptium Eclipse JRE version $JRE_VERSION ($JRE_ARCHIVE_URL)"
|
||||
|
||||
# Make sure name is not a weird relative path
|
||||
[[ "$(dirname "$(realpath "$JRE_ARCHIVE_NAME")")" != "$(pwd)" ]] && { echo "JRE archive name is a weird path, refusing to continue" >&2; exit 1; }
|
||||
# Same with version
|
||||
[[ "$(dirname "$(realpath "$JRE_VERSION")")" != "$(pwd)" ]] && { echo "JRE version is a weird path, refusing to continue" >&2; exit 1; }
|
||||
|
||||
curl -Lf "$JRE_ARCHIVE_URL" -O
|
||||
[[ ! -f "$JRE_ARCHIVE_NAME" ]] && { echo "JRE archive does not exist with filename $JRE_ARCHIVE_NAME" >&2; exit 1; }
|
||||
|
||||
# Make sure checksum matches
|
||||
JRE_ARCHIVE_CHECKSUM="$(sha256sum "$JRE_ARCHIVE_NAME" | cut -d' ' -f1)"
|
||||
[[ "$JRE_ARCHIVE_CHECKSUM" != "$EXPECTED_JRE_ARCHIVE_CHECKSUM" ]] && { echo "JRE checksum does not match ($JRE_ARCHIVE_CHECKSUM != $EXPECTED_JRE_ARCHIVE_CHECKSUM)" >&2; exit 1; }
|
||||
|
||||
tar -xzf "$JRE_ARCHIVE_NAME"
|
||||
mv "${JRE_VERSION}-jre" jre
|
||||
|
||||
popd
|
||||
|
||||
# Now run AppImage build
|
||||
pnpm exec electron-builder --${{ matrix.platform }} appimage ${COMMON_ELECTRON_BUILDER_ARGS[@]}
|
||||
fi
|
||||
- name: Collect and Rename Artifacts
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
#include <tuple>
|
||||
|
||||
// These must be included before Windows.h because of some macro collisions.
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
#include "solarxr_protocol/generated/all_generated.h"
|
||||
#include <solarxr_protocol/generated/all_generated.h>
|
||||
|
||||
#include "bridge/BridgeClient.hpp"
|
||||
#include "logger.hpp"
|
||||
@@ -19,7 +18,7 @@
|
||||
#define NOMINMAX
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <cstdlib>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
@@ -216,8 +215,18 @@ int main() {
|
||||
|
||||
constexpr auto interval = 1000ms / 30;
|
||||
|
||||
// Install signal handlers.
|
||||
// Windows does not provide sigaction
|
||||
#ifdef _WIN32
|
||||
signal(SIGINT, OnSignal);
|
||||
signal(SIGTERM, OnSignal);
|
||||
#else
|
||||
struct sigaction action{};
|
||||
action.sa_handler = OnSignal;
|
||||
sigaction(SIGINT, &action, nullptr);
|
||||
sigaction(SIGTERM, &action, nullptr);
|
||||
#endif
|
||||
|
||||
while (!should_exit) {
|
||||
vr::VREvent_t event{};
|
||||
while (sys->PollNextEvent(&event, sizeof(event))) {
|
||||
|
||||
@@ -242,10 +242,10 @@ reset-mounting-feet = Feet Calibration
|
||||
reset-mounting-toes = Toes Calibration
|
||||
reset-mounting-fingers = Fingers Calibration
|
||||
reset-yaw = Yaw Reset
|
||||
reset-error-mounting-need_full_reset = Need a full reset before mounting
|
||||
reset-error-yaw-need_full_reset = Need a full reset before yaw reset
|
||||
reset-error-need_positional_head = Step mounting needs a VR headset or a positional tracker
|
||||
reset-error-no_trackers = No tracker available
|
||||
reset-error-mounting-need_full_reset = Full reset required before before mounting calibration
|
||||
reset-error-yaw-need_full_reset = Full reset required before yaw reset
|
||||
reset-error-need_positional_head = Step mounting requires a VR headset or a positional tracker
|
||||
reset-error-no_trackers = No trackers available
|
||||
reset-error-no_feet_tracker = No feet tracker assigned / available
|
||||
|
||||
## Navigation bar
|
||||
@@ -514,7 +514,7 @@ settings-routing-description =
|
||||
SteamVR/Monado, VRChat OSC and VMC can each get a different set of body parts.
|
||||
settings-routing-mode = Routing mode
|
||||
settings-routing-automatic-label = Automatic routing
|
||||
settings-routing-automatic-description = Sends each bone to the best output so nothing is sent twice. Turn it off to choose the outputs for every bone yourself.
|
||||
settings-routing-automatic-description = Sends each bone to the best output to avoid duplicates. Disable this to manually pick where bones are routed.
|
||||
settings-routing-bone = Bone
|
||||
settings-routing-cell-required = Mandatory for this output
|
||||
settings-routing-cell-unavailable = Output is unavailable on this platform
|
||||
@@ -743,7 +743,7 @@ settings-general-fk_settings-leg_tweak-foot_plant = Foot plant
|
||||
settings-general-fk_settings-leg_tweak-skating_correction-amount = Skating correction strength
|
||||
settings-general-fk_settings-leg_tweak-skating_correction-amount-description = A higher value will result in more aggressive correction at the cost of accuracy during certain movements.
|
||||
settings-general-fk_settings-leg_tweak-skating_correction-description = Corrects for foot sliding, but can decrease accuracy during certain movements.
|
||||
settings-general-fk_settings-leg_tweak-floor_clip-description = Prevents feet clipping through the floor by shifting them up when they do.
|
||||
settings-general-fk_settings-leg_tweak-floor_clip-description = Pushes your feet upwards when they sink below the floor to prevent clipping.
|
||||
settings-general-fk_settings-leg_tweak-toe_snap-description = When not using feet trackers, guesses the rotation of your feet when going on your tippy toes.
|
||||
settings-general-fk_settings-leg_tweak-foot_plant-description = When not using feet trackers, keeps your feet parallel to the ground when they touch it.
|
||||
settings-general-fk_settings-leg_fk = Leg tracking
|
||||
@@ -804,7 +804,7 @@ settings-general-gesture_control-fullReset-name = Full reset
|
||||
settings-general-gesture_control-mountingReset-name = Mounting calibration
|
||||
# The number of trackers that can have higher acceleration before a tap is rejected
|
||||
settings-general-gesture_control-tapsTrackersOverThreshold = Taps 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 it work in order to prevent false positives.
|
||||
settings-general-gesture_control-numberTrackersOverThreshold-description = Increase this value if tap detection is not working. Do not increase this higher than necessary, to prevent false positives.
|
||||
|
||||
## Appearance settings
|
||||
settings-interface-appearance = Appearance
|
||||
@@ -826,20 +826,20 @@ settings-general-interface-crowdin_in_context-enable = Open in-context translati
|
||||
settings-general-interface-crowdin_in_context-close = Close in-context translation
|
||||
# Keep the font name untranslated
|
||||
settings-interface-appearance-font = GUI font
|
||||
settings-interface-appearance-font-description = This changes the font used by the interface.
|
||||
settings-interface-appearance-font-description = Change the font used by the interface.
|
||||
settings-interface-appearance-font-placeholder = Default font
|
||||
settings-interface-appearance-font-os_font = OS font
|
||||
settings-interface-appearance-font-slime_font = Default font
|
||||
settings-interface-appearance-font_size = Base font scaling
|
||||
settings-interface-appearance-font_size-description = This affects the font size of the whole interface except this settings panel.
|
||||
settings-interface-appearance-font_size-description = Control the font size used throughout the whole interface, except for this settings panel.
|
||||
|
||||
## Notification settings
|
||||
settings-general-interface-feedback_sound = Feedback sound
|
||||
settings-general-interface-feedback_sound-description = This option plays a sound when a reset is triggered.
|
||||
settings-general-interface-feedback_sound-description = Play feedback sounds when performing a reset.
|
||||
settings-general-interface-feedback_sound-volume = Feedback sound volume
|
||||
settings-general-interface-feedback_sound-volume-description = How loud the reset sound is.
|
||||
settings-general-interface-connected_trackers_warning = Connected trackers warning
|
||||
settings-general-interface-connected_trackers_warning-description = This option will show a pop-up every time you try exiting SlimeVR while having one or more connected trackers. It reminds you to turn off your trackers when you are done to preserve battery life.
|
||||
settings-general-interface-connected_trackers_warning-description = Show a pop-up every time you try exiting SlimeVR while having one or more trackers connected, reminding you to preserve battery life by turning off your trackers first.
|
||||
|
||||
## Behavior settings
|
||||
settings-interface-behavior = Behaviour
|
||||
@@ -877,7 +877,7 @@ settings-interface-behavior-skeleton_mesh-label = Use 3D shapes
|
||||
settings-interface-behavior-skeleton_mesh-lines = Lines
|
||||
settings-interface-behavior-skeleton_mesh-mesh = 3D shapes
|
||||
settings-interface-behavior-controller_nav = Game controller navigation
|
||||
settings-interface-behavior-controller_nav-description = Move focus around the interface with a game controller: the D-pad or left stick move between controls, A activates, B goes back, only while a controller is connected. Holding Ctrl or Alt with the arrow keys always moves focus the same way.
|
||||
settings-interface-behavior-controller_nav-description = Allow usage of a game controller to navigate the interface, or a keyboard by holding Ctrl or Alt while pressing the arrow keys. Use the D-pad or left stick to move between controls, A to activate the selected control, and B to go back.
|
||||
|
||||
## Serial settings
|
||||
settings-serial = USB Serial Console
|
||||
@@ -1153,7 +1153,7 @@ settings-home-table_columns-desc = Choose which columns are shown in the tracker
|
||||
|
||||
settings-home-display_group = Display
|
||||
settings-home-tracker_display = Tracker info
|
||||
settings-home-tracker_display-desc = Choose which extra details are shown on trackers
|
||||
settings-home-tracker_display-desc = Choose which extra details are shown on trackers.
|
||||
settings-home-tracker_display-battery_runtime_estimate = Battery runtime estimate
|
||||
settings-home-tracker_display-battery_voltage = Battery voltage
|
||||
settings-home-tracker_display-numeric_signal = Numeric signal strength
|
||||
@@ -1305,7 +1305,7 @@ onboarding-connect_tracker-next = I connected all my trackers
|
||||
|
||||
## Tracker assignment setup
|
||||
onboarding-assign_trackers-title = Assign trackers
|
||||
onboarding-assign_trackers-description = Let's choose which tracker goes where. Click on a location where you want to place a tracker.
|
||||
onboarding-assign_trackers-description = Let's choose where your trackers are placed. Click where you want to place a tracker, or drag the tracker from the list.
|
||||
onboarding-assign_trackers-reset_assignments = Reset all assignments
|
||||
# Look at translation of onboarding-connect_tracker-connected_trackers on how to use plurals
|
||||
# $assigned (Number) - Trackers that have been assigned a body part
|
||||
@@ -1582,7 +1582,7 @@ home-new_trackers-adding = Connecting…
|
||||
home-new_trackers-ignore = Ignore until SlimeVR restarts
|
||||
home-new_trackers-official_board = SlimeVR Tracker
|
||||
home-no_trackers-title = No trackers connected
|
||||
home-no_trackers-description = Connect a tracker or turn on your existing trackers to get started
|
||||
home-no_trackers-description = Connect a tracker, or turn on your existing trackers to get started
|
||||
home-no_trackers-connect = Connect trackers
|
||||
home-no_trackers-guide = View setup guide
|
||||
# Accessible names and tooltips for the icon-only buttons in a connection group's toolbox
|
||||
|
||||
@@ -52,49 +52,49 @@ export function PersonFrontIcon({
|
||||
/>
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
cx="82"
|
||||
cx="81.8"
|
||||
cy="105"
|
||||
r={CIRCLE_RADIUS}
|
||||
id={BodyPart[BodyPart.UPPER_CHEST]}
|
||||
/>
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
cx="82"
|
||||
cx="81.8"
|
||||
cy="120"
|
||||
r={CIRCLE_RADIUS}
|
||||
id={BodyPart[BodyPart.LOWER_CHEST]}
|
||||
/>
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
cx="82"
|
||||
cx="81.8"
|
||||
cy="181"
|
||||
r={CIRCLE_RADIUS}
|
||||
id={BodyPart[BodyPart.HIP]}
|
||||
/>
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
cx="82"
|
||||
cx="81.8"
|
||||
cy="155"
|
||||
r={CIRCLE_RADIUS}
|
||||
id={BodyPart[BodyPart.UPPER_WAIST]}
|
||||
/>
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
cx="82"
|
||||
cx="81.8"
|
||||
cy="169"
|
||||
r={CIRCLE_RADIUS}
|
||||
id={BodyPart[BodyPart.LOWER_WAIST]}
|
||||
/>
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
cx="82"
|
||||
cx="81.8"
|
||||
cy="80"
|
||||
r={CIRCLE_RADIUS}
|
||||
id={BodyPart[BodyPart.NECK]}
|
||||
/>
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
cx="82"
|
||||
cx="81.8"
|
||||
cy="35"
|
||||
r={CIRCLE_RADIUS}
|
||||
id={BodyPart[BodyPart.HEAD]}
|
||||
@@ -149,14 +149,6 @@ export function PersonFrontIcon({
|
||||
id={BodyPart[SIDES[right].foot]}
|
||||
/>
|
||||
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
cx="102"
|
||||
cy="393"
|
||||
r={CIRCLE_RADIUS}
|
||||
id="right-toes"
|
||||
/>
|
||||
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
cx="15"
|
||||
@@ -208,13 +200,6 @@ export function PersonFrontIcon({
|
||||
r={CIRCLE_RADIUS}
|
||||
id={BodyPart[SIDES[left].foot]}
|
||||
/>
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
cx="62"
|
||||
cy="393"
|
||||
r={CIRCLE_RADIUS}
|
||||
id="left-toes"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -52,6 +52,7 @@ import { UpperArmIcon } from '@/components/commons/icon/UpperArmIcon';
|
||||
import { Tooltip } from '@/components/commons/Tooltip';
|
||||
import { WarningBox } from '@/components/commons/TipBox';
|
||||
import { HandsWarningModal } from './components/HandsWarningModal';
|
||||
import { useSettingsDefaults } from '@/hooks/settings-defaults';
|
||||
|
||||
const OUTPUT_LABEL_ID: Record<number, string> = {
|
||||
[RoutingOutput.DRIVER]: 'settings-routing-output-driver',
|
||||
@@ -398,6 +399,7 @@ export function BoneRoutingSettings() {
|
||||
const { currentLocales } = useLocaleConfig();
|
||||
const { sendRPCPacket, useRPCPacket, useConnectedEffect } = useWebsocketAPI();
|
||||
const [settings, setSettings] = useState(new BoneRoutingSettingsResponseT());
|
||||
const defaults = useSettingsDefaults().boneRouting;
|
||||
|
||||
const [automatic, setAutomatic] = useState(true);
|
||||
const [routes, setRoutes] = useState<RouteMap>(new Map());
|
||||
@@ -608,6 +610,10 @@ export function BoneRoutingSettings() {
|
||||
<SettingRow
|
||||
setting={groups.mode.rows.automatic}
|
||||
controlId="routing-automatic"
|
||||
reset={{
|
||||
modified: automatic != defaults.automatic,
|
||||
onReset: () => setMode(defaults.automatic),
|
||||
}}
|
||||
control={
|
||||
<CheckboxInternal
|
||||
variant="toggle"
|
||||
|
||||
@@ -53,6 +53,9 @@ linux:
|
||||
to: "."
|
||||
- from: "./resources/firewall"
|
||||
to: "firewall"
|
||||
# Exists in CI when building for AppImage
|
||||
- from: "./resources/jre"
|
||||
to: "jre"
|
||||
icon: "./resources/icons"
|
||||
|
||||
deb:
|
||||
|
||||
@@ -185,7 +185,13 @@ export function captureServerExit(
|
||||
}
|
||||
|
||||
export function sendCrashReport(kind: CrashReportKind) {
|
||||
if (!Sentry.isInitialized()) return false;
|
||||
if (!Sentry.isInitialized()) {
|
||||
logger.warn(
|
||||
{ kind },
|
||||
'Tried to send Sentry crash report before Sentry has initialised'
|
||||
);
|
||||
return false;
|
||||
}
|
||||
const failure = lastServerFailure;
|
||||
Sentry.withScope((scope) => {
|
||||
scope.setTag(USER_REQUESTED_TAG, 'true');
|
||||
|
||||
@@ -32,8 +32,6 @@ val DRIVER_SUPPORTED_BONES = setOf(
|
||||
BodyPart.RIGHT_UPPER_LEG,
|
||||
BodyPart.LEFT_FOOT,
|
||||
BodyPart.RIGHT_FOOT,
|
||||
BodyPart.LEFT_SHOULDER,
|
||||
BodyPart.RIGHT_SHOULDER,
|
||||
BodyPart.LEFT_HAND,
|
||||
BodyPart.RIGHT_HAND,
|
||||
)
|
||||
@@ -51,8 +49,6 @@ class DriverOutgoingTrackersBehaviour(
|
||||
BodyPart.RIGHT_UPPER_LEG to setOf(BodyPart.RIGHT_UPPER_LEG),
|
||||
BodyPart.LEFT_FOOT to setOf(BodyPart.LEFT_FOOT, BodyPart.LEFT_LOWER_LEG),
|
||||
BodyPart.RIGHT_FOOT to setOf(BodyPart.RIGHT_FOOT, BodyPart.RIGHT_LOWER_LEG),
|
||||
BodyPart.LEFT_SHOULDER to setOf(BodyPart.LEFT_SHOULDER, BodyPart.LEFT_UPPER_ARM, BodyPart.LEFT_LOWER_ARM),
|
||||
BodyPart.RIGHT_SHOULDER to setOf(BodyPart.RIGHT_SHOULDER, BodyPart.RIGHT_UPPER_ARM, BodyPart.RIGHT_LOWER_ARM),
|
||||
BodyPart.LEFT_UPPER_ARM to setOf(BodyPart.LEFT_UPPER_ARM, BodyPart.LEFT_SHOULDER, BodyPart.LEFT_LOWER_ARM),
|
||||
BodyPart.RIGHT_UPPER_ARM to setOf(BodyPart.RIGHT_UPPER_ARM, BodyPart.RIGHT_SHOULDER, BodyPart.RIGHT_LOWER_ARM),
|
||||
BodyPart.LEFT_HAND to setOf(BodyPart.LEFT_HAND, BodyPart.LEFT_LOWER_ARM),
|
||||
|
||||
@@ -68,11 +68,14 @@ class BoneRoutingBehaviour(
|
||||
).distinctUntilChanged()
|
||||
|
||||
receiver.onRpc<BoneRoutingSettingsRequest> { _, txId ->
|
||||
// TODO: is .first() right here? It seems to return a very outdated value.
|
||||
// This causes issues in the driver where, on some launches, trackers will
|
||||
// simply not show up if they were all connected prior to launching SteamVR
|
||||
receiver.sendRpc(responses.first(), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
responses
|
||||
.drop(1)
|
||||
// .drop(1) // FIXME: Commented out as a workaround for the mentioned bug
|
||||
.onEach(receiver::sendRpc)
|
||||
.launchIn(receiver.context.scope)
|
||||
|
||||
|
||||
@@ -81,14 +81,35 @@ private fun tailLogFile(source: LogSource, path: Path): Flow<LogEvent> = flow {
|
||||
return complete.drop(1)
|
||||
}
|
||||
|
||||
readNewLines().takeLast(BACKLOG_SIZE).forEach { line -> lineEvent(source, line)?.let { emit(it) } }
|
||||
// If a line is invalid, it is likely from a single event that has newlines in the message
|
||||
// Reuse the time and log level from the last line event
|
||||
var lastEvent: LogEvent? = null
|
||||
val emitLogEvent = suspend emitLogEvent@{ raw: String ->
|
||||
val line = raw.trimEnd('\r')
|
||||
if (line.isEmpty()) return@emitLogEvent
|
||||
|
||||
val event = lineEvent(source, line)?.also { lastEvent = it } ?: run {
|
||||
lastEvent?.let { event ->
|
||||
LogEvent(
|
||||
source = source,
|
||||
timeMs = event.timeMs,
|
||||
level = event.level,
|
||||
logger = event.logger,
|
||||
message = line,
|
||||
)
|
||||
} ?: return@emitLogEvent
|
||||
}
|
||||
|
||||
emit(event)
|
||||
}
|
||||
|
||||
readNewLines().takeLast(BACKLOG_SIZE).forEach { line -> emitLogEvent(line) }
|
||||
while (true) {
|
||||
val key = runInterruptible { watcher.take() }
|
||||
val touched = key.pollEvents().any { (it.context() as? Path)?.fileName == path.fileName }
|
||||
key.reset()
|
||||
if (!touched) continue
|
||||
readNewLines().forEach { line -> lineEvent(source, line)?.let { emit(it) } }
|
||||
readNewLines().forEach { line -> emitLogEvent(line) }
|
||||
}
|
||||
}
|
||||
}.flowOn(Dispatchers.IO)
|
||||
@@ -114,14 +135,10 @@ private fun readFrom(path: Path, offset: Long): Pair<String, Long> {
|
||||
}
|
||||
}
|
||||
|
||||
private fun lineEvent(source: LogSource, raw: String): LogEvent? {
|
||||
val line = raw.trimEnd('\r')
|
||||
if (line.isEmpty()) return null
|
||||
|
||||
val match = DRIVER_LINE.matchEntire(line)
|
||||
?: return LogEvent(source = source, timeMs = System.currentTimeMillis().toULong(), level = LogLevel.INFO, logger = "", message = line)
|
||||
|
||||
private fun lineEvent(source: LogSource, line: String): LogEvent? {
|
||||
val match = DRIVER_LINE.matchEntire(line) ?: return null
|
||||
val (time, offset, level, message) = match.destructured
|
||||
|
||||
val zone = if (offset.isEmpty()) ZoneId.systemDefault() else ZoneOffset.of(offset)
|
||||
return LogEvent(
|
||||
source = source,
|
||||
|
||||
@@ -101,8 +101,15 @@ suspend fun handleSolarXRBridge(
|
||||
// share: this collector handles one bundle at a time, and send drains the buffer
|
||||
val fbb = FlatBufferBuilder(256)
|
||||
val sendBuffer = Buffer()
|
||||
// If a client connected, sent a message, then immediately disconnected, we want to
|
||||
// stop trying to write but still read the last message, so we can't cancel immediately.
|
||||
// We'll end up dropping the connection since the messages flow finishes collection
|
||||
// when an error happens
|
||||
var writeFailed = false
|
||||
|
||||
bridge.outbound.on<MessageBundle> { bundle ->
|
||||
if (writeFailed) return@on
|
||||
|
||||
fbb.clear()
|
||||
fbb.finish(bundle.encode(JvmFlatBufferWriter(fbb)))
|
||||
sendBuffer.write(fbb.dataBuffer())
|
||||
@@ -110,7 +117,7 @@ suspend fun handleSolarXRBridge(
|
||||
send(sendBuffer)
|
||||
} catch (e: IOException) {
|
||||
AppLogger.solarxr.warn("Exception when sending bundle to $name: ${e.message}")
|
||||
cancel()
|
||||
writeFailed = true
|
||||
}
|
||||
}.launchIn(this)
|
||||
|
||||
|
||||
@@ -147,7 +147,20 @@ suspend fun startBindingsProvider() = withContext(Dispatchers.IO) {
|
||||
// For some users, starting the executable immediately may cause startup failures
|
||||
delay(3000L)
|
||||
val proc = try {
|
||||
ProcessBuilder(path.toString()).start()
|
||||
val b = ProcessBuilder(path.toString())
|
||||
|
||||
// Make the dynamic linker able to find bundled libopenvr_api.so
|
||||
if (CURRENT_PLATFORM == Platform.LINUX) {
|
||||
val parent = path.parent
|
||||
if (parent.resolve("libopenvr_api.so").exists()) {
|
||||
val libraryPath = System.getenv("LD_LIBRARY_PATH")?.let { curLibraryPath ->
|
||||
"$curLibraryPath:$parent"
|
||||
} ?: parent.toString()
|
||||
b.environment()["LD_LIBRARY_PATH"] = libraryPath
|
||||
}
|
||||
}
|
||||
|
||||
b.start()
|
||||
} catch (e: Exception) {
|
||||
AppLogger.steamvr.error(e, "Failed to start bindings provider")
|
||||
return@withContext
|
||||
|
||||
Reference in new issue
Block a user