Compare commits

..
Author SHA1 Message Date
Aleksandra M cc8538a332 Add note to update gui dependencies when change SolarXR protocol (#1432) 2025-05-12 21:26:36 +02:00
lucas lelievre f9d619f93a Show warnings when network is set to public on windows (#1425) 2025-05-12 22:24:18 +03:00
Butterscotch! 471714afd0 Tracking pause unit test (#1360) 2025-05-12 21:08:06 +03:00
Aleksandra M 91ce0ed734 Add magnetic field vector (#1416) 2025-05-12 18:59:44 +03:00
sctanf a35d2a77a2 TrackersHID clearly define acceleration axes (#1431) 2025-05-12 18:53:02 +03:00
sctanf ea31d58fb8 IMUVisualizerWidget accel replace three arrows with one vector (#1430) 2025-05-12 18:52:50 +03:00
sctanf e74dee1892 TrackersHID report magnetometer packet (#1428) 2025-05-12 18:52:41 +03:00
sctanf d84fc40b23 TrackersHID keep opening existing devices (#1429) 2025-05-12 18:52:29 +03:00
Uriel 0dd004825d Fix macOS heap error in CI (#1426) 2025-05-06 20:08:36 +02:00
lucas lelievre 9f36444169 Allow to mute vrc warnings (#1420) 2025-05-06 12:07:51 +03:00
sctanf 52509c7950 Tracker display names (#1417) 2025-05-06 12:02:16 +03:00
Uriel 868c441220 Stop using Twemoji and just use SVGs for it (#1364) 2025-05-06 12:01:46 +03:00
jabberrock 5ad408f61d Reduce log entry size when logging invalid UDP packets (#1424) 2025-05-06 11:46:39 +03:00
sctanf 9b30f9800c TrackersHID fix exception from null magStatus (#1419) 2025-05-04 21:18:14 +02:00
lucas lelievre 07e5ef647a Make sure Global mag setting is saved (#1421) 2025-05-02 21:50:27 +03:00
lucas lelievre 47909ad46c Fix battery resistances being sent as string instead of numbers (#1413) 2025-04-28 17:59:11 +02:00
sctanfandlucas lelievre 99c92fad9e make tracker entry borders consistent with no border (#1411)
Co-authored-by: lucas lelievre <[email protected]>
2025-04-28 16:51:06 +02:00
sctanfandlucas lelievre d7861614b7 Better battery and wifi statuses behavior (#1410)
Co-authored-by: lucas lelievre <[email protected]>
2025-04-28 16:44:27 +02:00
unlogisch04 b4a3e9cbd5 fix Firewall Rules for java.exe (#1415) 2025-04-28 14:56:43 +02:00
lucas lelievre e58946f622 Bring back onboarding (#1414) 2025-04-28 14:55:52 +02:00
Erimel c8532c76c2 Fix lower_leg-desc and elbow_offset-desc typos (#1412) 2025-04-27 01:29:57 +02:00
Butterscotch! 6f26ea7b50 Add OTA port to firewall uninstall script (#1409) 2025-04-26 16:01:22 +02:00
43 changed files with 793 additions and 412 deletions

No files matched your search

+1
View File
@@ -87,6 +87,7 @@ jobs:
shell: bash
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
NODE_OPTIONS: ${{ matrix.os == 'macos-latest' && '--max-old-space-size=4096' || '' }}
run: pnpm run skipbundler --config $( ./gui/scripts/gitversion.mjs )
- if: matrix.os == 'windows-latest'
+1
View File
@@ -280,6 +280,7 @@ jobs:
- name: Build
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
NODE_OPTIONS: --max-old-space-size=4096
run: pnpm run tauri build --target universal-apple-darwin --config $( ./gui/scripts/gitversion.mjs )
- name: Modify Application
+1
View File
@@ -105,6 +105,7 @@ When touching SolarXR:
- After editing files, you should run `cd solarxr-protocol`, then either run
`./generate-flatbuffer.ps1` (Windows) or `./generate-flatbuffer.sh` (Linux/OSX)
- Make sure to commit your changes inside the submodule.
- To make sure the gui use the latest generated code, run `pnpm i`.
## Code Licensing
SlimeVR uses dual MIT and Apache-2.0 license. Be sure that any code that you reference,
+2 -1
View File
@@ -22,6 +22,7 @@
"@tauri-apps/plugin-os": "^2.0.0",
"@tauri-apps/plugin-shell": "^2.0.0",
"@tauri-apps/plugin-store": "^2.0.0",
"@twemoji/svg": "^15.0.0",
"browser-fs-access": "^0.35.0",
"classnames": "^2.5.1",
"flatbuffers": "22.10.26",
@@ -98,4 +99,4 @@
"typescript-eslint": "^8.8.0",
"vite": "^5.4.8"
}
}
}
Binary file not shown.
Binary file not shown.
+7 -2
View File
@@ -163,7 +163,7 @@ skeleton_bone-UPPER_LEG-desc =
until your virtual knees are at the same level as your real ones.
skeleton_bone-LOWER_LEG = Lower Leg Length
skeleton_bone-LOWER_LEG-desc =
This is the distance from your hips to your knees.
This is the distance from your knees to your ankles.
To adjust it, adjust your Leg Length properly and modify it
until your virtual knees are at the same level as your real ones.
skeleton_bone-FOOT_LENGTH = Foot Length
@@ -222,7 +222,7 @@ skeleton_bone-HAND_Z-desc =
skeleton_bone-ELBOW_OFFSET = Elbow Offset
skeleton_bone-ELBOW_OFFSET-desc =
This can be adjusted to move your virtual elbow trackers up or down in order to aid
with VRChat accidentally binding and elbow tracker to the chest.
with VRChat accidentally binding an elbow tracker to the chest.
## Tracker reset buttons
reset-reset_all = Reset all proportions
@@ -458,6 +458,7 @@ settings-sidebar-appearance = Appearance
settings-sidebar-notifications = Notifications
settings-sidebar-behavior = Behavior
settings-sidebar-firmware-tool = DIY Firmware Tool
settings-sidebar-vrc_warnings = VRChat Config Warnings
settings-sidebar-advanced = Advanced
## SteamVR settings
@@ -1241,6 +1242,7 @@ status_system-StatusSteamVRDisconnected = { $type ->
}
status_system-StatusTrackerError = The { $trackerName } tracker has an error.
status_system-StatusUnassignedHMD = The VR headset should be assigned as a head tracker.
status_system-StatusPublicNetwork = Your network profile is currently set to Public. This is not recomended for SlimeVR to function properly. <PublicFixLink>See how to fix it here.</PublicFixLink>
## Firmware tool globals
@@ -1442,6 +1444,9 @@ vrc_config-show_more = Show more
vrc_config-setting_name = VRChat Setting name
vrc_config-recommended_value = Recommended Value
vrc_config-current_value = Current Value
vrc_config-mute = Mute Warning
vrc_config-mute-btn = Mute
vrc_config-unmute-btn = Unmute
vrc_config-legacy_mode = Use Legacy IK Solving
vrc_config-disable_shoulder_tracking = Disable Shoulder Tracking
vrc_config-shoulder_width_compensation = Shoulder Width Compensation
+8 -1
View File
@@ -1,9 +1,10 @@
import { useLayoutEffect } from 'react';
import { useConfig } from './hooks/config';
import { Outlet } from 'react-router-dom';
import { Outlet, useNavigate } from 'react-router-dom';
export function AppLayout() {
const { config } = useConfig();
const navigate = useNavigate();
useLayoutEffect(() => {
if (!config) return;
@@ -26,6 +27,12 @@ export function AppLayout() {
}
}, [config]);
useLayoutEffect(() => {
if (config && !config.doneOnboarding) {
navigate('/onboarding/home');
}
}, [config?.doneOnboarding]);
return (
<>
<Outlet />
+6
View File
@@ -21,6 +21,7 @@ import { ClearMountingButton } from './ClearMountingButton';
import { ToggleableSkeletonVisualizerWidget } from './widgets/SkeletonVisualizerWidget';
import { useAtomValue } from 'jotai';
import { flatTrackersAtom } from '@/store/app-store';
import { A } from './commons/A';
function UnprioritizedStatuses() {
const { l10n } = useLocalization();
@@ -38,6 +39,11 @@ function UnprioritizedStatuses() {
id={`status_system-${StatusData[status.dataType]}`}
vars={parseStatusToLocale(status, trackers, l10n)}
key={status.id}
elems={{
PublicFixLink: (
<A href="https://docs.slimevr.dev/common-issues.html#the-trackers-are-connected-to-my-wi-fi-but-dont-turn-up-on-slimevr"></A>
),
}}
>
<TipBox whitespace={false} hideIcon>
{`Warning, you should fix ${StatusData[status.dataType]}`}
+17 -2
View File
@@ -2,7 +2,8 @@ import { useLocalization } from '@fluent/react';
import { useEffect, useMemo, useContext } from 'react';
import { useForm } from 'react-hook-form';
import { useConfig } from '@/hooks/config';
import { langs, LangContext } from '@/i18n/config';
import { LangContext } from '@/i18n/config';
import { langs } from '@/i18n/names';
import { Dropdown, DropdownDirection } from './Dropdown';
export function LangSelector({
@@ -20,7 +21,21 @@ export function LangSelector({
});
const languagesItems = useMemo(
() => langs.map(({ key, name }) => ({ label: name, value: key })),
() =>
langs.map(({ key, name, emoji }) => ({
component: (
<div>
<img
draggable="false"
className="inline-block w-auto h-[1em] -translate-y-[0.05em]"
src={emoji}
/>
{' ' + name}
</div>
),
label: name,
value: key,
})),
[]
);
+3 -3
View File
@@ -5,12 +5,12 @@ export function WifiIcon({
value,
disabled = false,
}: {
value: number;
value: number | null;
disabled?: boolean;
}) {
const percent = useMemo(
() =>
value
value != null
? Math.max(
Math.min(((value - -95) * (100 - 0)) / (-40 - -95) + 0, 100)
) / 100
@@ -18,7 +18,7 @@ export function WifiIcon({
[value]
);
const y = useMemo(() => (percent ? (1 - percent) * 13 : 0), [percent]);
const y = useMemo(() => (1 - percent) * 13, [percent]);
const col = useMemo(() => {
const colorsMap: { [key: number]: string } = {
@@ -55,8 +55,8 @@ export function checkForUpdate(
if (
canUpdate &&
device.hardwareStatus?.batteryPctEstimate &&
device.hardwareStatus?.batteryPctEstimate < 50
device.hardwareStatus?.batteryPctEstimate != null &&
device.hardwareStatus.batteryPctEstimate < 50
) {
return 'low-battery';
}
@@ -5,6 +5,7 @@ import { useNavigate } from 'react-router-dom';
import {
RpcMessage,
StartWifiProvisioningRequestT,
StatusData,
StopWifiProvisioningRequestT,
WifiProvisioningStatus,
WifiProvisioningStatusResponseT,
@@ -15,7 +16,7 @@ import { ArrowLink } from '@/components/commons/ArrowLink';
import { Button } from '@/components/commons/Button';
import { LoaderIcon, SlimeState } from '@/components/commons/icon/LoaderIcon';
import { ProgressBar } from '@/components/commons/ProgressBar';
import { TipBox } from '@/components/commons/TipBox';
import { TipBox, WarningBox } from '@/components/commons/TipBox';
import { Typography } from '@/components/commons/Typography';
import { TrackerCard } from '@/components/tracker/TrackerCard';
import { useIsRestCalibrationTrackers } from '@/hooks/imu-logic';
@@ -23,6 +24,8 @@ import './ConnectTracker.scss';
import { useAtomValue } from 'jotai';
import { connectedIMUTrackersAtom } from '@/store/app-store';
import { BaseModal } from '@/components/commons/BaseModal';
import { useStatusContext } from '@/hooks/status-system';
import { A } from '@/components/commons/A';
const statusLabelMap = {
[WifiProvisioningStatus.NONE]:
@@ -72,6 +75,8 @@ const statusProgressMap = {
export function ConnectTrackersPage() {
const { l10n } = useLocalization();
const { statuses } = useStatusContext();
const connectedIMUTrackers = useAtomValue(connectedIMUTrackersAtom);
const { applyProgress, state } = useOnboarding();
const navigate = useNavigate();
@@ -159,6 +164,12 @@ export function ConnectTrackersPage() {
[connectedIMUTrackers.length]
);
const filteredStatuses = useMemo(() => {
return Object.entries(statuses).filter(
([, value]) => value.dataType == StatusData.StatusPublicNetwork
);
}, [statuses]);
return (
<>
<BaseModal
@@ -231,7 +242,23 @@ export function ConnectTrackersPage() {
>
<TipBox>Conditional tip</TipBox>
</Localized>
{filteredStatuses.map(([, status]) => (
<div className="pt-4">
<Localized
key={status.id}
id={`status_system-${StatusData[status.dataType]}`}
elems={{
PublicFixLink: (
<A href="https://docs.slimevr.dev/common-issues.html#the-trackers-are-connected-to-my-wi-fi-but-dont-turn-up-on-slimevr"></A>
),
}}
>
<WarningBox whitespace={false}>
{`Warning, you should fix ${StatusData[status.dataType]}`}
</WarningBox>
</Localized>
</div>
))}
<div
className={classNames(
'rounded-xl h-24 flex gap-2 p-3 lg:w-full mt-4 relative',
@@ -4,6 +4,7 @@ import { DEFAULT_LOCALE, LangContext } from '@/i18n/config';
import { getSentryOrCompute } from '@/utils/sentry';
const config = await loadConfig();
if (config?.errorTracking !== undefined) {
// load sentry ASAP to catch early errors
getSentryOrCompute(config.errorTracking ?? false);
@@ -44,6 +44,10 @@ export function SettingSelectorMobile() {
label: l10n.getString('settings-sidebar-firmware-tool'),
value: { url: '/settings/firmware-tool' },
},
{
label: l10n.getString('settings-sidebar-vrc_warnings'),
value: { url: '/vrc-warnings' },
},
{
label: l10n.getString('settings-sidebar-advanced'),
value: { url: '/settings/advanced' },
@@ -107,6 +107,11 @@ export function SettingsSidebar() {
{l10n.getString('settings-sidebar-firmware-tool')}
</SettingsLink>
</div>
<div className="flex flex-col gap-2">
<SettingsLink to="/vrc-warnings">
{l10n.getString('settings-sidebar-vrc_warnings')}
</SettingsLink>
</div>
<div className="flex flex-col gap-2">
<SettingsLink to="/settings/advanced">
{l10n.getString('settings-sidebar-advanced')}
+22 -15
View File
@@ -27,25 +27,32 @@ export function TrackerBattery({
minimumFractionDigits: 2,
});
const charging = (voltage || 0) > 4.3;
const showVoltage = voltage && config?.debug;
return (
<div className="flex gap-2">
<div className="flex flex-col justify-around">
<BatteryIcon
value={value}
disabled={disabled}
charging={(voltage || 0) > 4.3}
/>
</div>
<div className="w-10">
<Typography color={textColor}>
{percentFormatter.format(value)}
</Typography>
{voltage && config?.debug && (
<Typography color={textColor}>
{voltageFormatter.format(voltage)}V
</Typography>
)}
<BatteryIcon value={value} disabled={disabled} charging={charging} />
</div>
{((!charging || showVoltage) && (
<div className="w-10">
{!charging && (
<Typography color={textColor}>
{percentFormatter.format(value)}
</Typography>
)}
{showVoltage && (
<Typography color={textColor}>
{voltageFormatter.format(voltage)}V
</Typography>
)}
</div>
)) || (
<div className="flex flex-col justify-center w-10">
<div className="w-5 h-1 bg-background-30 rounded-full"></div>
</div>
)}
</div>
);
}
+13 -8
View File
@@ -1,3 +1,4 @@
import { useConfig } from '@/hooks/config';
import { MouseEventHandler } from 'react';
import {
DeviceDataT,
@@ -69,6 +70,8 @@ function TrackerBig({
tracker: TrackerDataT;
device?: DeviceDataT;
}) {
const { config } = useConfig();
const { useName } = useTracker(tracker);
const trackerName = useName();
@@ -86,10 +89,10 @@ function TrackerBig({
<div className="flex justify-center">
<TrackerStatus status={tracker.status}></TrackerStatus>
</div>
<div className="flex text-default justify-center gap-5 flex-wrap">
<div className="min-h-9 flex text-default justify-center gap-5 flex-wrap items-center">
{device && device.hardwareStatus && (
<>
{device.hardwareStatus.batteryPctEstimate && (
{device.hardwareStatus.batteryPctEstimate != null && (
<TrackerBattery
voltage={device.hardwareStatus.batteryVoltage}
value={device.hardwareStatus.batteryPctEstimate / 100}
@@ -100,8 +103,9 @@ function TrackerBig({
{(device.hardwareStatus.rssi != null ||
device.hardwareStatus.ping != null) && (
<TrackerWifi
rssi={device.hardwareStatus.rssi || 0}
ping={device.hardwareStatus.ping || 0}
rssi={device.hardwareStatus.rssi}
rssiShowNumeric={config?.debug}
ping={device.hardwareStatus.ping}
disabled={tracker.status === TrackerStatusEnum.DISCONNECTED}
></TrackerWifi>
)}
@@ -138,7 +142,7 @@ function TrackerSmol({
{device && device.hardwareStatus && (
<>
<div className="flex flex-col justify-center items-center">
{device.hardwareStatus.batteryPctEstimate && (
{device.hardwareStatus.batteryPctEstimate != null && (
<TrackerBattery
voltage={device.hardwareStatus.batteryVoltage}
value={device.hardwareStatus.batteryPctEstimate / 100}
@@ -150,8 +154,8 @@ function TrackerSmol({
{(device.hardwareStatus.rssi != null ||
device.hardwareStatus.ping != null) && (
<TrackerWifi
rssi={device.hardwareStatus.rssi || 0}
ping={device.hardwareStatus.ping || 0}
rssi={device.hardwareStatus.rssi}
ping={device.hardwareStatus.ping}
disabled={tracker.status === TrackerStatusEnum.DISCONNECTED}
></TrackerWifi>
)}
@@ -203,7 +207,8 @@ export function TrackerCard({
'rounded-lg overflow-hidden transition-[box-shadow] duration-200 ease-linear',
interactable && 'hover:bg-background-50 cursor-pointer',
outlined && 'outline outline-2 outline-accent-background-40',
warning && 'border-status-warning border-solid border-2',
warning &&
'outline outline-2 -outline-offset-2 outline-status-warning',
bg
)}
style={
+10 -9
View File
@@ -8,8 +8,8 @@ export function TrackerWifi({
disabled,
textColor = 'secondary',
}: {
rssi: number;
ping: number;
rssi: number | null;
ping: number | null;
rssiShowNumeric?: boolean;
disabled?: boolean;
textColor?: string;
@@ -19,19 +19,20 @@ export function TrackerWifi({
<div className="flex flex-col justify-around">
<WifiIcon value={rssi} disabled={disabled} />
</div>
{!disabled && (
{(!disabled && (ping != null || (rssiShowNumeric && rssi != null)) && (
<div className="w-12">
<Typography color={textColor} whitespace="whitespace-nowrap">
{ping} ms
</Typography>
{rssiShowNumeric && (
{ping != null && (
<Typography color={textColor} whitespace="whitespace-nowrap">
{ping} ms
</Typography>
)}
{rssiShowNumeric && rssi != null && (
<Typography color={textColor} whitespace="whitespace-nowrap">
{rssi} dBm
</Typography>
)}
</div>
)}
{disabled && (
)) || (
<div className="flex flex-col justify-center w-12">
<div className="w-7 h-1 bg-background-30 rounded-full"></div>
</div>
+9 -9
View File
@@ -142,12 +142,12 @@ export function RowContainer({
}}
className={classNames(
'h-[50px] flex flex-col justify-center px-3 transition-[box-shadow] duration-200 ease-linear',
rounded === 'left' && 'rounded-l-lg',
rounded === 'right' && 'rounded-r-lg',
rounded === 'left' && 'rounded-l-lg border-l-2',
rounded === 'right' && 'rounded-r-lg border-r-2',
hover ? 'bg-background-50 cursor-pointer' : 'bg-background-60',
warning && 'border-status-warning border-solid border-t-2 border-b-2',
rounded === 'left' && warning && 'border-l-2',
rounded === 'right' && warning && 'border-r-2'
(warning &&
'border-status-warning border-solid border-t-2 border-b-2') ||
'border-transparent'
)}
>
{children}
@@ -273,10 +273,10 @@ export function TrackersTable({
id: DisplayColumn.BATTERY,
label: l10n.getString('tracker-table-column-battery'),
row: ({ device, tracker }) =>
device?.hardwareStatus?.batteryPctEstimate && (
device?.hardwareStatus?.batteryPctEstimate != null && (
<TrackerBattery
value={device.hardwareStatus.batteryPctEstimate / 100}
voltage={device.hardwareStatus?.batteryVoltage}
voltage={device.hardwareStatus.batteryVoltage}
disabled={tracker.status === TrackerStatusEnum.DISCONNECTED}
textColor={fontColor}
/>
@@ -290,9 +290,9 @@ export function TrackersTable({
(device?.hardwareStatus?.rssi != null ||
device?.hardwareStatus?.ping != null) && (
<TrackerWifi
rssi={device?.hardwareStatus?.rssi || 0}
rssi={device?.hardwareStatus?.rssi}
rssiShowNumeric
ping={device?.hardwareStatus?.ping || 0}
ping={device?.hardwareStatus?.ping}
disabled={tracker.status === TrackerStatusEnum.DISCONNECTED}
textColor={fontColor}
></TrackerWifi>
+196 -185
View File
@@ -1,6 +1,5 @@
import { Typography } from '@/components/commons/Typography';
import { ReactNode } from 'react';
import {} from 'solarxr-protocol';
import { CheckIcon } from '@/components/commons/icon/CheckIcon';
import { WarningIcon } from '@/components/commons/icon/WarningIcon';
import {
@@ -8,22 +7,28 @@ import {
spineModeTranslationMap,
trackerModelTranslationMap,
useVRCConfig,
VRCConfigStateSupported,
} from '@/hooks/vrc-config';
import { Localized, useLocalization } from '@fluent/react';
import classNames from 'classnames';
import { useLocaleConfig } from '@/i18n/config';
import { A } from '@/components/commons/A';
import { Button } from '@/components/commons/Button';
export function SettingRow({
function SettingRow({
name,
valid,
value,
recommendedValue,
muted,
mute,
}: {
valid: boolean;
name: string;
recommendedValue: ReactNode;
value: ReactNode;
valid: boolean;
muted: boolean;
mute: () => void;
}) {
return (
<tr className="group border-b border-background-60">
@@ -41,21 +46,65 @@ export function SettingRow({
<td
className={classNames(
'px-6 py-4 text-end items-center',
!valid && 'text-status-warning'
!valid && !muted && 'text-status-warning'
)}
>
{value}
</td>
<td
className={classNames('px-6 py-4 text-end items-end justify-end flex')}
>
<Localized id={muted ? 'vrc_config-unmute-btn' : 'vrc_config-mute-btn'}>
<Button
variant="secondary"
className="min-w-24"
onClick={mute}
></Button>
</Localized>
</td>
</tr>
);
}
function Table({ children }: { children: ReactNode }) {
return (
<table className="min-w-full divide-y divide-background-50">
<thead>
<tr>
<th scope="col" className="px-6 py-3 text-start">
<Localized id={'vrc_config-setting_name'}>
<Typography />
</Localized>
</th>
<th scope="col" className="px-6 py-3 text-end">
<Localized id={'vrc_config-recommended_value'}>
<Typography />
</Localized>
</th>
<th scope="col" className="px-6 py-3 text-end">
<Localized id={'vrc_config-current_value'}>
<Typography />
</Localized>
</th>
<th scope="col" className="px-6 py-3 text-end">
<Localized id={'vrc_config-mute'}>
<Typography />
</Localized>
</th>
</tr>
</thead>
<tbody>{children}</tbody>
</table>
);
}
const onOffKey = (value: boolean) =>
value ? 'vrc_config-on' : 'vrc_config-off';
export function VRCWarningsPage() {
const { l10n } = useLocalization();
const { state } = useVRCConfig();
const { state, toggleMutedSettings, mutedSettings } = useVRCConfig();
const { currentLocales } = useLocaleConfig();
const meterFormat = Intl.NumberFormat(currentLocales, {
@@ -68,6 +117,12 @@ export function VRCWarningsPage() {
return <></>;
}
const settingRowProps = (key: keyof VRCConfigStateSupported['validity']) => ({
mute: () => toggleMutedSettings(key),
muted: mutedSettings.includes(key),
valid: state.validity[key] == true,
});
return (
<div className="flex flex-col p-4 w-full">
<div className="flex flex-col max-w-lg mobile:w-full gap-3">
@@ -89,126 +144,104 @@ export function VRCWarningsPage() {
<Localized id="vrc_config-page-big_menu-desc">
<Typography color="secondary" />
</Localized>
<table className="min-w-full divide-y divide-background-50">
<thead>
<tr>
<th scope="col" className="px-6 py-3 text-start">
<Localized id={'vrc_config-setting_name'}>
<Typography />
</Localized>
</th>
<th scope="col" className="px-6 py-3 text-end">
<Localized id={'vrc_config-recommended_value'}>
<Typography />
</Localized>
</th>
<th scope="col" className="px-6 py-3 text-end">
<Localized id={'vrc_config-current_value'}>
<Typography />
</Localized>
</th>
</tr>
</thead>
<tbody>
<SettingRow
name="vrc_config-user_height"
recommendedValue={meterFormat.format(
state.recommended.userHeight
)}
value={meterFormat.format(state.state.userHeight)}
valid={state.validity.userHeightOk}
></SettingRow>
<SettingRow
name="vrc_config-legacy_mode"
recommendedValue={
<Localized
id={onOffKey(state.recommended.legacyMode)}
></Localized>
}
value={
<Localized
id={onOffKey(state.state.legacyMode)}
></Localized>
}
valid={state.validity.legacyModeOk}
></SettingRow>
<SettingRow
name="vrc_config-disable_shoulder_tracking"
recommendedValue={
<Localized
id={onOffKey(
state.recommended.shoulderTrackingDisabled
)}
></Localized>
}
value={
<Localized
id={onOffKey(state.state.shoulderTrackingDisabled)}
></Localized>
}
valid={state.validity.shoulderTrackingOk}
></SettingRow>
<SettingRow
name="vrc_config-shoulder_width_compensation"
recommendedValue={
<Localized
id={onOffKey(
state.recommended.shoulderWidthCompensation
)}
></Localized>
}
value={
<Localized
id={onOffKey(state.state.shoulderWidthCompensation)}
></Localized>
}
valid={state.validity.shoulderWidthCompensationOk}
></SettingRow>
<SettingRow
name="vrc_config-calibration_visuals"
recommendedValue={
<Localized
id={onOffKey(state.recommended.calibrationVisuals)}
></Localized>
}
value={
<Localized
id={onOffKey(state.state.calibrationVisuals)}
></Localized>
}
valid={state.validity.calibrationVisualsOk}
></SettingRow>
<SettingRow
name="vrc_config-calibration_range"
recommendedValue={meterFormat.format(
state.recommended.calibrationRange
)}
value={meterFormat.format(state.state.calibrationRange)}
valid={state.validity.calibrationRangeOk}
></SettingRow>
<SettingRow
name="vrc_config-tracker_model"
recommendedValue={
<Localized
id={
trackerModelTranslationMap[
state.recommended.trackerModel
]
}
></Localized>
}
value={
<Localized
id={
trackerModelTranslationMap[state.state.trackerModel]
}
></Localized>
}
valid={state.validity.trackerModelOk}
></SettingRow>
</tbody>
</table>
<Table>
<SettingRow
{...settingRowProps('userHeightOk')}
name="vrc_config-user_height"
recommendedValue={meterFormat.format(
state.recommended.userHeight
)}
value={meterFormat.format(state.state.userHeight)}
></SettingRow>
<SettingRow
{...settingRowProps('legacyModeOk')}
name="vrc_config-legacy_mode"
recommendedValue={
<Localized
id={onOffKey(state.recommended.legacyMode)}
></Localized>
}
value={
<Localized
id={onOffKey(state.state.legacyMode)}
></Localized>
}
></SettingRow>
<SettingRow
{...settingRowProps('shoulderTrackingOk')}
name="vrc_config-disable_shoulder_tracking"
recommendedValue={
<Localized
id={onOffKey(
state.recommended.shoulderTrackingDisabled
)}
></Localized>
}
value={
<Localized
id={onOffKey(state.state.shoulderTrackingDisabled)}
></Localized>
}
></SettingRow>
<SettingRow
{...settingRowProps('shoulderWidthCompensationOk')}
name="vrc_config-shoulder_width_compensation"
recommendedValue={
<Localized
id={onOffKey(
state.recommended.shoulderWidthCompensation
)}
></Localized>
}
value={
<Localized
id={onOffKey(state.state.shoulderWidthCompensation)}
></Localized>
}
></SettingRow>
<SettingRow
{...settingRowProps('calibrationVisualsOk')}
name="vrc_config-calibration_visuals"
recommendedValue={
<Localized
id={onOffKey(state.recommended.calibrationVisuals)}
></Localized>
}
value={
<Localized
id={onOffKey(state.state.calibrationVisuals)}
></Localized>
}
></SettingRow>
<SettingRow
{...settingRowProps('calibrationRangeOk')}
name="vrc_config-calibration_range"
recommendedValue={meterFormat.format(
state.recommended.calibrationRange
)}
value={meterFormat.format(state.state.calibrationRange)}
></SettingRow>
<SettingRow
{...settingRowProps('trackerModelOk')}
name="vrc_config-tracker_model"
recommendedValue={
<Localized
id={
trackerModelTranslationMap[
state.recommended.trackerModel
]
}
></Localized>
}
value={
<Localized
id={
trackerModelTranslationMap[state.state.trackerModel]
}
></Localized>
}
></SettingRow>
</Table>
</div>
<div className="flex flex-col gap-2">
<Localized id="vrc_config-page-wrist_menu">
@@ -217,67 +250,45 @@ export function VRCWarningsPage() {
<Localized id="vrc_config-page-wrist_menu-desc">
<Typography color="secondary" />
</Localized>
<table className="min-w-full divide-y divide-background-50">
<thead>
<tr>
<th scope="col" className="px-6 py-3 text-start">
<Localized id={'vrc_config-setting_name'}>
<Typography />
</Localized>
</th>
<Table>
<SettingRow
{...settingRowProps('spineModeOk')}
name="vrc_config-spine_mode"
recommendedValue={state.recommended.spineMode
.map((mode) =>
l10n.getString(spineModeTranslationMap[mode])
)
.join(', ')}
value={
<Localized
id={spineModeTranslationMap[state.state.spineMode]}
></Localized>
}
></SettingRow>
<th scope="col" className="px-6 py-3 text-end">
<Localized id={'vrc_config-recommended_value'}>
<Typography />
</Localized>
</th>
<th scope="col" className="px-6 py-3 text-end">
<Localized id={'vrc_config-current_value'}>
<Typography />
</Localized>
</th>
</tr>
</thead>
<tbody>
<SettingRow
name="vrc_config-spine_mode"
recommendedValue={state.recommended.spineMode
.map((mode) =>
l10n.getString(spineModeTranslationMap[mode])
)
.join(', ')}
value={
<Localized
id={spineModeTranslationMap[state.state.spineMode]}
></Localized>
}
valid={state.validity.spineModeOk}
></SettingRow>
<SettingRow
name="vrc_config-avatar_measurement_type"
recommendedValue={
<Localized
id={
avatarMeasurementTypeTranslationMap[
state.recommended.avatarMeasurementType
]
}
></Localized>
}
value={
<Localized
id={
avatarMeasurementTypeTranslationMap[
state.state.avatarMeasurementType
]
}
></Localized>
}
valid={state.validity.avatarMeasurementTypeOk}
></SettingRow>
</tbody>
</table>
<SettingRow
{...settingRowProps('avatarMeasurementTypeOk')}
name="vrc_config-avatar_measurement_type"
recommendedValue={
<Localized
id={
avatarMeasurementTypeTranslationMap[
state.recommended.avatarMeasurementType
]
}
></Localized>
}
value={
<Localized
id={
avatarMeasurementTypeTranslationMap[
state.state.avatarMeasurementType
]
}
></Localized>
}
></SettingRow>
</Table>
</div>
</div>
</div>
@@ -9,7 +9,7 @@ import { PerspectiveCamera, Vector3 } from 'three';
import { Button } from '@/components/commons/Button';
import { QuatObject } from '@/maths/quaternion';
import { useLocalization } from '@fluent/react';
import { Vector3Object } from '@/maths/vector3';
import { Vector3Object, Vector3FromVec3fT } from '@/maths/vector3';
import { Gltf } from '@react-three/drei';
import { ErrorBoundary } from 'react-error-boundary';
@@ -28,12 +28,19 @@ export function TrackerModel({ model }: { model: string }) {
function SceneRenderer({
quat,
vec,
mag,
model,
}: {
quat: QuatObject;
vec: Vector3Object;
mag: Vector3Object;
model: string;
}) {
const magDir = new Vector3(mag.x, mag.y, mag.z);
const magLen = magDir.length();
const magMag = Math.sqrt(magLen / 100); // normalize magnituge
if (magLen > 0) magDir.multiplyScalar(1 / magLen);
return (
<Canvas
className="container"
@@ -56,23 +63,17 @@ function SceneRenderer({
<arrowHelper
args={[
new Vector3(-Math.sign(vec.x), 0, 0),
Vector3FromVec3fT(vec).normalize(),
new Vector3(0, 0, 0),
Math.sqrt(Math.abs(vec.x)) * 2,
Math.sqrt(Vector3FromVec3fT(vec).length()) * 2,
]}
/>
<arrowHelper
args={[
new Vector3(0, Math.sign(vec.y), 0),
new Vector3(0, 0, 0),
Math.sqrt(Math.abs(vec.y)) * 2,
]}
/>
<arrowHelper
args={[
new Vector3(0, 0, -Math.sign(vec.z)),
new Vector3(0, 0, 0),
Math.sqrt(Math.abs(vec.z)) * 2,
magDir,
magDir.clone().multiplyScalar(-magMag),
2 * magMag,
THREE.Color.NAMES.aqua,
]}
/>
@@ -116,6 +117,7 @@ export function IMUVisualizerWidget({ tracker }: { tracker: TrackerDataT }) {
tracker?.linearAcceleration ||
tracker?.rawAcceleration ||
new THREE.Vector3();
const mag = tracker?.rawMagneticVector || new THREE.Vector3();
return (
<div className="bg-background-70 flex flex-col p-3 rounded-lg gap-2">
@@ -157,6 +159,15 @@ export function IMUVisualizerWidget({ tracker }: { tracker: TrackerDataT }) {
</div>
)}
{tracker.rawMagneticVector && (
<div className="flex justify-between">
<Typography color="secondary">
{l10n.getString('tracker-infos-magnetometer')}
</Typography>
<Typography>{formatVector3(tracker.rawMagneticVector, 1)}</Typography>
</div>
)}
{!enabled && (
<Button
variant="secondary"
@@ -189,6 +200,7 @@ export function IMUVisualizerWidget({ tracker }: { tracker: TrackerDataT }) {
<SceneRenderer
quat={{ ...quat }}
vec={{ ...vec }}
mag={{ ...mag }}
model={
isExtension ? '/models/extension.gltf' : '/models/tracker.gltf'
}
+2
View File
@@ -41,6 +41,7 @@ export interface Config {
errorTracking: boolean | null;
decorations: boolean;
showNavbarOnboarding: boolean;
vrcMutedWarnings: string[];
}
export interface ConfigContext {
@@ -67,6 +68,7 @@ export const defaultConfig: Omit<Config, 'devSettings'> = {
errorTracking: null,
decorations: false,
showNavbarOnboarding: true,
vrcMutedWarnings: [],
};
interface CrossStorage {
+1
View File
@@ -17,6 +17,7 @@ export function useDataFeedConfig() {
trackerData.rotationReferenceAdjusted = true;
trackerData.rotationIdentityAdjusted = true;
trackerData.tps = true;
trackerData.rawMagneticVector = true;
const dataMask = new DeviceDataMaskT();
dataMask.deviceData = true;
+1
View File
@@ -188,6 +188,7 @@ export function useFirmwareToolContext(): FirmwareToolContext {
boardConfig: {
...currConfig.boardConfig,
...form,
batteryResistances: form.batteryResistances.map((r) => Number(r)),
},
};
});
+1
View File
@@ -124,6 +124,7 @@ export function parseStatusToLocale(
case StatusData.NONE:
case StatusData.StatusTrackerReset:
case StatusData.StatusUnassignedHMD:
case StatusData.StatusPublicNetwork:
return {};
case StatusData.StatusSteamVRDisconnected: {
const data = status.data as StatusSteamVRDisconnectedT;
+26 -7
View File
@@ -8,16 +8,16 @@ import {
VRCSpineMode,
VRCTrackerModel,
} from 'solarxr-protocol';
import { useConfig } from './config';
type NonNull<T> = {
[P in keyof T]: NonNullable<T[P]>;
};
export type VRCConfigState =
| { isSupported: false }
| ({ isSupported: true } & NonNull<
Pick<VRCConfigStateChangeResponseT, 'recommended' | 'state' | 'validity'>
>);
export type VRCConfigStateSupported = { isSupported: true } & NonNull<
Pick<VRCConfigStateChangeResponseT, 'recommended' | 'state' | 'validity'>
>;
export type VRCConfigState = { isSupported: false } | VRCConfigStateSupported;
export const spineModeTranslationMap: Record<VRCSpineMode, string> = {
[VRCSpineMode.UNKNOWN]: 'vrc_config-spine_mode-UNKNOWN',
@@ -45,6 +45,7 @@ export const avatarMeasurementTypeTranslationMap: Record<
export function useVRCConfig() {
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
const { config, setConfig } = useConfig();
const [state, setState] = useState<VRCConfigState | null>(null);
useEffect(() => {
@@ -58,13 +59,31 @@ export function useVRCConfig() {
}
);
const mutedSettings = useMemo(() => {
if (!state?.isSupported) return [];
return Object.keys(state.validity).filter((k) =>
config?.vrcMutedWarnings.includes(k)
);
}, [state, config]);
const invalidConfig = useMemo(() => {
if (!state?.isSupported) return false;
return Object.values(state.validity).some((v) => !v);
}, [state]);
return Object.entries(state.validity)
.filter(([k]) => !config?.vrcMutedWarnings.includes(k))
.some(([, v]) => !v);
}, [state, config]);
return {
state,
invalidConfig,
mutedSettings,
toggleMutedSettings: async (key: keyof VRCConfigStateSupported['validity']) => {
if (!config) return;
const index = config.vrcMutedWarnings.findIndex((v) => v === key);
if (index === -1) config.vrcMutedWarnings.push(key);
else config?.vrcMutedWarnings.splice(index, 1);
await setConfig(config);
console.log(config.vrcMutedWarnings);
},
};
}
+1 -95
View File
@@ -13,106 +13,12 @@ import { exists, readTextFile, BaseDirectory } from '@tauri-apps/plugin-fs';
import { error } from '@/utils/logging';
import { invoke } from '@tauri-apps/api/core';
import { isTrayAvailable } from '@/utils/tauri';
import { langs } from './names';
export const defaultNS = 'translation';
export const DEFAULT_LOCALE = 'en';
const OVERRIDE_FILENAME = 'override.ftl';
export const langs = [
{
name: '🇦🇪 عربى',
key: 'ar',
},
{
name: '🇨🇿 Čeština',
key: 'cs',
},
{
name: '🇩🇰 Dansk',
key: 'da',
},
{
name: '🇩🇪 Deutsch',
key: 'de',
},
{
name: '🇺🇸 English',
key: 'en',
},
{
name: '🌎 Español Latinoamericano',
key: 'es-419',
},
{
name: '🇪🇸 Español España',
key: 'es-ES',
},
{
name: '🇪🇪 Eesti',
key: 'et',
},
{
name: '🇫🇮 Suomi',
key: 'fi',
},
{
name: '🇫🇷 Français',
key: 'fr',
},
{
name: '🇮🇹 Italiano',
key: 'it',
},
{
name: '🇯🇵 日本語',
key: 'ja',
},
{
name: '🇰🇷 한국어',
key: 'ko',
},
{
name: '🇳🇴 Norsk bokmål',
key: 'nb-NO',
},
{
name: '🇳🇱 Nederlands',
key: 'nl',
},
{
name: '🇵🇱 Polski',
key: 'pl',
},
{
name: '🇧🇷 Português Brasileiro',
key: 'pt-BR',
},
{
name: '🇷🇺 Русский',
key: 'ru',
},
{
name: '🇺🇦 Українська',
key: 'uk',
},
{
name: '🇻🇳 Tiếng Việt',
key: 'vi',
},
{
name: '🇨🇳 简体中文',
key: 'zh-Hans',
},
{
name: '🧋 繁體中文',
key: 'zh-Hant',
},
{
name: '🥺 Engwish~ OwO',
key: 'en-x-owo',
},
];
// AppConfig path: https://docs.rs/tauri/1.2.4/tauri/api/path/fn.config_dir.html
// We doing this only once, don't want an override check to be done on runtime,
// only on launch :P
+141
View File
@@ -0,0 +1,141 @@
import ar from '@twemoji/svg/1f1e6-1f1ea.svg';
import cs from '@twemoji/svg/1f1e8-1f1ff.svg';
import da from '@twemoji/svg/1f1e9-1f1f0.svg';
import de from '@twemoji/svg/1f1e9-1f1ea.svg';
import en from '@twemoji/svg/1f1fa-1f1f8.svg';
import americas from '@twemoji/svg/1f30e.svg';
import es from '@twemoji/svg/1f1ea-1f1f8.svg';
import et from '@twemoji/svg/1f1ea-1f1ea.svg';
import fi from '@twemoji/svg/1f1eb-1f1ee.svg';
import fr from '@twemoji/svg/1f1eb-1f1f7.svg';
import it from '@twemoji/svg/1f1ee-1f1f9.svg';
import ja from '@twemoji/svg/1f1ef-1f1f5.svg';
import ko from '@twemoji/svg/1f1f0-1f1f7.svg';
import nb from '@twemoji/svg/1f1f3-1f1f4.svg';
import nl from '@twemoji/svg/1f1f3-1f1f1.svg';
import pl from '@twemoji/svg/1f1f5-1f1f1.svg';
import br from '@twemoji/svg/1f1e7-1f1f7.svg';
import ru from '@twemoji/svg/1f1f7-1f1fa.svg';
import uk from '@twemoji/svg/1f1fa-1f1e6.svg';
import vi from '@twemoji/svg/1f1fb-1f1f3.svg';
import cn from '@twemoji/svg/1f1e8-1f1f3.svg';
import bubble from '@twemoji/svg/1f9cb.svg';
import plead from '@twemoji/svg/1f97a.svg';
export const langs = [
{
emoji: ar,
name: 'عربى',
key: 'ar',
},
{
emoji: cs,
name: 'Čeština',
key: 'cs',
},
{
emoji: da,
name: 'Dansk',
key: 'da',
},
{
emoji: de,
name: 'Deutsch',
key: 'de',
},
{
emoji: en,
name: 'English',
key: 'en',
},
{
emoji: americas,
name: 'Español Latinoamericano',
key: 'es-419',
},
{
emoji: es,
name: 'Español España',
key: 'es-ES',
},
{
emoji: et,
name: 'Eesti',
key: 'et',
},
{
emoji: fi,
name: 'Suomi',
key: 'fi',
},
{
emoji: fr,
name: 'Français',
key: 'fr',
},
{
emoji: it,
name: 'Italiano',
key: 'it',
},
{
emoji: ja,
name: '日本語',
key: 'ja',
},
{
emoji: ko,
name: '한국어',
key: 'ko',
},
{
emoji: nb,
name: 'Norsk bokmål',
key: 'nb-NO',
},
{
emoji: nl,
name: 'Nederlands',
key: 'nl',
},
{
emoji: pl,
name: 'Polski',
key: 'pl',
},
{
emoji: br,
name: 'Português Brasileiro',
key: 'pt-BR',
},
{
emoji: ru,
name: 'Русский',
key: 'ru',
},
{
emoji: uk,
name: 'Українська',
key: 'uk',
},
{
emoji: vi,
name: 'Tiếng Việt',
key: 'vi',
},
{
emoji: cn,
name: '简体中文',
key: 'zh-Hans',
},
{
emoji: bubble,
name: '繁體中文',
key: 'zh-Hant',
},
{
emoji: plead,
name: 'Engwish~ OwO',
key: 'en-x-owo',
},
];
+1 -25
View File
@@ -4,8 +4,7 @@
body {
font-variant-numeric: tabular-nums;
font-family: var(--font-name), 'Noto Sans CJK', sans-serif, 'Twemoji Chromium',
emoji;
font-family: var(--font-name), 'Noto Sans CJK', sans-serif, emoji;
width: 100vw;
height: 100vh;
user-select: none;
@@ -16,29 +15,6 @@ body {
scrollbar-width: thin;
}
@media (-webkit-animation) {
body {
font-family: var(--font-name), 'Noto Sans CJK', sans-serif, 'Twemoji Webkit',
emoji;
}
body.linux {
font-family: var(--font-name), 'Noto Sans CJK', sans-serif, emoji;
}
}
@font-face {
font-family: 'Twemoji Webkit';
src: url('/fonts/twemoji-picosvg.woff2') format('woff2');
font-display: swap;
}
@font-face {
font-family: 'Twemoji Chromium';
src: url('/fonts/twemoji-glyf_colr_1.woff2') format('woff2');
font-display: swap;
}
@font-face {
font-family: 'OpenDyslexic';
src: url('/fonts/OpenDyslexic-Regular.woff') format('woff');
+8
View File
@@ -71,6 +71,9 @@ importers:
'@tauri-apps/plugin-store':
specifier: ^2.0.0
version: 2.0.0
'@twemoji/svg':
specifier: ^15.0.0
version: 15.0.0
browser-fs-access:
specifier: ^0.35.0
version: 0.35.0
@@ -1255,6 +1258,9 @@ packages:
'@tweenjs/[email protected]':
resolution: {integrity: sha512-kMCNaZCJugWI86xiEHaY338CU5JpD0B97p1j1IKNn/Zto8PgACjQx0UxbHjmOcLl/dDOBnItwD07KmCs75pxtQ==}
'@twemoji/[email protected]':
resolution: {integrity: sha512-ZSPef2B6nBaYnfgdTbAy4jgW95o7pi2xPGwGCU+WMTxo7J6B1lMPTWwSq/wTuiMq+N0khQ90CcvYp1wFoQpo/w==}
'@types/[email protected]':
resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==}
@@ -5457,6 +5463,8 @@ snapshots:
'@tweenjs/[email protected]': {}
'@twemoji/[email protected]': {}
'@types/[email protected]':
dependencies:
'@babel/parser': 7.24.7
+6 -4
View File
@@ -4,7 +4,7 @@ net session >nul 2>&1
if %errorlevel% == 0 (
echo Running with administrative privileges! - Needed for firewall modification!
) else (
echo Requesting administrative privileges - Needed for firewall modification!
echo Requesting administrative privileges - Needed for firewall modification!
:: Temp script to request admin... Works and doesn't leave a mess.
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "%~dp0", "runas", 1 >> "%temp%\getadmin.vbs"
@@ -21,8 +21,8 @@ rem WebSocket server default port
call :AddRule "SlimeVR TCP 21110 incoming" "dir=in action=allow protocol=TCP localport=21110 enable=yes"
call :AddRule "SlimeVR TCP 21110 outgoing" "dir=out action=allow protocol=TCP localport=21110 enable=yes"
rem OpenJDK Platform Binary access
call :AddRule "SlimeVR OpenJDK Platform incoming" "dir=in action=allow program=%~dp0jre\bin\java.exe enable=yes"
call :AddRule "SlimeVR OpenJDK Platform outgoing" "dir=out action=allow program=%~dp0jre\bin\java.exe enable=yes"
call :AddRule "SlimeVR OpenJDK Platform incoming" "dir=in action=allow program=""%~dp0jre\bin\java.exe"" enable=yes"
call :AddRule "SlimeVR OpenJDK Platform outgoing" "dir=out action=allow program=""%~dp0jre\bin\java.exe"" enable=yes"
rem ESP8266 OTA default port
call :AddRule "SlimeVR UDP 8266 incoming" "dir=in action=allow protocol=UDP localport=8266 enable=yes"
call :AddRule "SlimeVR UDP 8266 outgoing" "dir=out action=allow protocol=UDP localport=8266 enable=yes"
@@ -35,7 +35,9 @@ exit /B
:AddRule
setlocal
set "ruleName=%~1"
set "ruleParams=%~2"
set "rulePara=%~2"
:: Change from "" to "
set "ruleParams=%rulePara:""="%"
netsh advfirewall firewall show rule name="%ruleName%" >nul 2>&1
if %errorlevel% neq 0 (
@@ -26,6 +26,9 @@ call :DeleteRule "SlimeVR TCP 21110 outgoing"
rem OpenJDK Platform Binary access
call :DeleteRule "SlimeVR OpenJDK Platform incoming"
call :DeleteRule "SlimeVR OpenJDK Platform outgoing"
rem ESP8266 OTA default port
call :DeleteRule "SlimeVR UDP 8266 incoming"
call :DeleteRule "SlimeVR UDP 8266 outgoing"
echo Done!
pause
@@ -58,6 +58,7 @@ class ServerConfig {
}.awaitAll()
useMagnetometerOnAllTrackers = state
VRServer.instance.configManager.saveConfig()
} finally {
magMutex.unlock()
}
@@ -3,6 +3,7 @@ package dev.slimevr.protocol.datafeed;
import com.google.flatbuffers.FlatBufferBuilder;
import dev.slimevr.tracking.trackers.Device;
import dev.slimevr.tracking.trackers.Tracker;
import dev.slimevr.tracking.trackers.udp.MagnetometerStatus;
import dev.slimevr.tracking.trackers.udp.UDPDevice;
import io.github.axisangles.ktmath.Quaternion;
import io.github.axisangles.ktmath.Vector3;
@@ -80,6 +81,16 @@ public class DataFeedBuilder {
return TrackerId.endTrackerId(fbb);
}
public static int createVec3(FlatBufferBuilder fbb, Vector3 vec) {
return Vec3f
.createVec3f(
fbb,
vec.getX(),
vec.getY(),
vec.getZ()
);
}
public static int createQuat(FlatBufferBuilder fbb, Quaternion quaternion) {
return Quat
.createQuat(
@@ -146,14 +157,7 @@ public class DataFeedBuilder {
}
public static int createTrackerPosition(FlatBufferBuilder fbb, Tracker tracker) {
Vector3 pos = tracker.getPosition();
return Vec3f
.createVec3f(
fbb,
pos.getX(),
pos.getY(),
pos.getZ()
);
return createVec3(fbb, tracker.getPosition());
}
public static int createTrackerRotation(FlatBufferBuilder fbb, Tracker tracker) {
@@ -161,14 +165,11 @@ public class DataFeedBuilder {
}
public static int createTrackerAcceleration(FlatBufferBuilder fbb, Tracker tracker) {
Vector3 accel = tracker.getAcceleration();
return Vec3f
.createVec3f(
fbb,
accel.getX(),
accel.getY(),
accel.getZ()
);
return createVec3(fbb, tracker.getAcceleration());
}
public static int createTrackerMagneticVector(FlatBufferBuilder fbb, Tracker tracker) {
return createVec3(fbb, tracker.getMagVector());
}
public static int createTrackerTemperature(FlatBufferBuilder fbb, Tracker tracker) {
@@ -233,6 +234,9 @@ public class DataFeedBuilder {
if (mask.getTps()) {
TrackerData.addTps(fbb, (int) tracker.getTps());
}
if (mask.getRawMagneticVector() && tracker.getMagStatus() == MagnetometerStatus.ENABLED) {
TrackerData.addRawMagneticVector(fbb, createTrackerMagneticVector(fbb, tracker));
}
return TrackerData.endTrackerData(fbb);
}
@@ -92,6 +92,7 @@ class Tracker @JvmOverloads constructor(
private var timeAtLastUpdate: Long = System.currentTimeMillis()
private var _rotation = Quaternion.IDENTITY
private var _acceleration = Vector3.NULL
private var _magVector = Vector3.NULL
var position = Vector3.NULL
val resetsHandler: TrackerResetsHandler = TrackerResetsHandler(this)
val filteringHandler: TrackerFilteringHandler = TrackerFilteringHandler()
@@ -424,6 +425,22 @@ class Tracker @JvmOverloads constructor(
}
}
/**
* Gets the magnetic field vector, in mGauss.
*/
fun getMagVector() = if (needsReset) {
resetsHandler.getReferenceAdjustedAccel(_rotation, _magVector)
} else {
_magVector
}
/**
* Sets the magnetic field vector.
*/
fun setMagVector(vec: Vector3) {
this._magVector = vec
}
/**
* Gets the current TPS of the tracker
*/
@@ -12,7 +12,6 @@ import io.eiren.util.logging.LogManager
import io.github.axisangles.ktmath.Quaternion.Companion.fromRotationVector
import io.github.axisangles.ktmath.Vector3
import kotlinx.coroutines.*
import org.apache.commons.lang3.ArrayUtils
import solarxr_protocol.rpc.ResetType
import java.net.DatagramPacket
import java.net.DatagramSocket
@@ -193,14 +192,17 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
if (imuTracker == null) {
var formattedHWID = connection.hardwareIdentifier.replace(":", "").takeLast(5)
if (trackerId != 0) {
formattedHWID += "_$trackerId"
formattedHWID += " Extension"
if (trackerId > 1) {
formattedHWID += " $trackerId"
}
}
imuTracker = Tracker(
connection,
VRServer.getNextLocalTrackerId(),
connection.name + "/" + trackerId,
"IMU Tracker $formattedHWID",
"Tracker $formattedHWID",
trackerPosition,
trackerNum = trackerId,
hasRotation = true,
@@ -612,11 +614,14 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
sb.append("null")
} else {
sb.append(packet.address.toString())
sb.append(':')
sb.append(packet.port)
sb.append(',')
sb.append(packet.length)
sb.append(',')
sb.append(ArrayUtils.toString(packet.data))
sb.append('{')
sb.append(HexFormat.ofDelimiter(",").formatHex(packet.data, 0, packet.length))
sb.append('}')
}
sb.append('}')
return sb.toString()
@@ -3,6 +3,7 @@ package dev.slimevr.unit
import com.jme3.math.FastMath
import io.github.axisangles.ktmath.EulerOrder
import io.github.axisangles.ktmath.Quaternion
import io.github.axisangles.ktmath.Vector3
import org.junit.jupiter.api.AssertionFailureBuilder
import kotlin.math.abs
@@ -80,4 +81,9 @@ object TrackerTestUtils {
FastMath.isApproxEqual(q1.x, q2.x, tolerance) &&
FastMath.isApproxEqual(q1.y, q2.y, tolerance) &&
FastMath.isApproxEqual(q1.z, q2.z, tolerance)
fun vectorApproxEqual(v1: Vector3, v2: Vector3, tolerance: Float = FastMath.ZERO_TOLERANCE): Boolean =
FastMath.isApproxEqual(v1.x, v2.x, tolerance) &&
FastMath.isApproxEqual(v1.y, v2.y, tolerance) &&
FastMath.isApproxEqual(v1.z, v2.z, tolerance)
}
@@ -0,0 +1,62 @@
package dev.slimevr.unit
import dev.slimevr.tracking.processor.HumanPoseManager
import dev.slimevr.unit.TrackerTestUtils.quatApproxEqual
import dev.slimevr.unit.TrackerTestUtils.vectorApproxEqual
import io.github.axisangles.ktmath.Quaternion
import io.github.axisangles.ktmath.Vector3
import org.junit.jupiter.api.Test
import kotlin.test.assertNotNull
class TrackingPauseTests {
val resetSource = "Unit Test"
@Test
fun testTrackingPause() {
val trackers = TestTrackerSet()
// Initialize skeleton and everything
val hpm = HumanPoseManager(trackers.allL)
// TODO: This being enabled makes waist position infinity initially but not
// later? Something weird is going on here...
hpm.setLegTweaksEnabled(false)
hpm.update()
// Store expected tracker data
val expected = mutableMapOf<Int, Pair<Quaternion, Vector3>>()
for (tracker in hpm.computedTrackers) {
expected.put(tracker.id, Pair(tracker.getRotation(), tracker.position))
}
// Pause tracking, nothing should move after this
hpm.setPauseTracking(true, resetSource)
// Randomize tracker orientations, this should not affect the skeleton!
for ((i, tracker) in trackers.set.withIndex()) {
tracker.setRotation(TrackerTestUtils.testRotFromIndex(i))
}
// Tick the skeleton with random tracker rotations
hpm.update()
// Since we paused before moving anything, the output should still be identity
for (tracker in hpm.computedTrackers) {
val trackerExpected = expected[tracker.id]
assertNotNull(trackerExpected)
val expectedRot = trackerExpected.first
val expectedPos = trackerExpected.second
val actualRot = tracker.getRotation()
val actualPos = tracker.position
assert(quatApproxEqual(expectedRot, actualRot)) {
"\"${tracker.name}\" moved after being paused. Expected <$expectedRot>, actual <$actualRot>."
}
assert(vectorApproxEqual(expectedPos, actualPos)) {
"\"${tracker.name}\" moved after being paused. Expected <$expectedPos>, actual <$actualPos>."
}
}
}
}
@@ -129,6 +129,8 @@ fun main(args: Array<String>) {
)
vrServer.start()
NetworkProfileChecker(vrServer)
// Start service for USB HID trackers
TrackersHID(
"Sensors HID service",
@@ -143,6 +145,7 @@ fun main(args: Array<String>) {
}
}
}
vrServer.join()
scanner.join()
LogManager.closeLogger()
@@ -0,0 +1,76 @@
package dev.slimevr.desktop
import dev.slimevr.VRServer
import io.eiren.util.OperatingSystem
import solarxr_protocol.rpc.StatusData
import solarxr_protocol.rpc.StatusDataUnion
import solarxr_protocol.rpc.StatusPublicNetworkT
import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.*
import kotlin.concurrent.scheduleAtFixedRate
enum class NetworkProfile {
PRIVATE,
PUBLIC,
}
fun checkNetworkProfile(): NetworkProfile? {
if (OperatingSystem.currentPlatform != OperatingSystem.WINDOWS) {
return null
}
try {
// Full command as a single string
val command = "powershell.exe -Command \"(Get-NetConnectionProfile).NetworkCategory\""
// Use ProcessBuilder with the full command passed through the shell
val processBuilder = ProcessBuilder(command.split(" "))
processBuilder.redirectErrorStream(true)
val process = processBuilder.start()
// Capture the output
val output = BufferedReader(InputStreamReader(process.inputStream)).useLines { lines ->
lines.joinToString("\n")
}
val exitCode = process.waitFor()
if (exitCode != 0) {
return null
}
return when (output.trim()) {
"Private" -> NetworkProfile.PRIVATE
"Public" -> NetworkProfile.PUBLIC
else -> null
}
} catch (e: Exception) {
return null
}
}
class NetworkProfileChecker(private val server: VRServer) {
private val updateTickTimer = Timer("NetworkProfileCheck")
private var lastPublicNetworkStatus: UInt = 0u
private var currentNetworkProfile: NetworkProfile? = null
init {
if (OperatingSystem.currentPlatform == OperatingSystem.WINDOWS) {
this.updateTickTimer.scheduleAtFixedRate(0, 3000) {
val profile = checkNetworkProfile()
if (profile != currentNetworkProfile) {
currentNetworkProfile = profile
if (lastPublicNetworkStatus == 0u && profile == NetworkProfile.PUBLIC) {
lastPublicNetworkStatus = server.statusSystem.addStatus(
StatusDataUnion().apply {
type = StatusData.StatusPublicNetwork
value = StatusPublicNetworkT()
},
false,
)
} else if (lastPublicNetworkStatus != 0u && profile != NetworkProfile.PUBLIC) {
server.statusSystem.removeStatus(lastPublicNetworkStatus)
lastPublicNetworkStatus = 0u
}
}
}
}
}
}
@@ -118,11 +118,12 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
// LogManager.info("[TrackerServer] Sensor $trackerId for ${device.name}, status $sensorStatus")
var imuTracker = device.getTracker(trackerId)
if (imuTracker == null) {
var formattedHWID = device.hardwareIdentifier.replace(":", "").takeLast(5)
imuTracker = Tracker(
device,
VRServer.getNextLocalTrackerId(),
device.name + "/" + trackerId,
"IMU Tracker #" + VRServer.currentLocalTrackerId,
"Tracker $formattedHWID",
null,
trackerNum = trackerId,
hasRotation = true,
@@ -216,6 +217,7 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
var devicesDataReceived = false
val q = intArrayOf(0, 0, 0, 0)
val a = intArrayOf(0, 0, 0)
val m = intArrayOf(0, 0, 0)
for ((hidDevice, deviceList) in devicesByHID) {
val dataReceived: ByteArray = try {
hidDevice.readAll(0) // multiples 64 bytes
@@ -265,8 +267,8 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
val sensorType = IMUType.getById(imu_id.toUInt())
// only able to register magnetometer status, not magnetometer type
val magStatus = MagnetometerStatus.getById(mag_id.toUByte())
if (sensorType != null) {
setUpSensor(device, trackerId, sensorType!!, TrackerStatus.OK, magStatus!!)
if (sensorType != null && magStatus != null) {
setUpSensor(device, trackerId, sensorType, TrackerStatus.OK, magStatus)
}
}
@@ -317,7 +319,7 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
// Q15 as short big endian
q[j] = dataReceived[i + 2 + j * 2 + 1].toInt() shl 8 or dataReceived[i + 2 + j * 2].toUByte().toInt()
}
for (j in 0..2) { // accel received as fixed 7, in m/s
for (j in 0..2) { // accel received as fixed 7, in m/s^2
// Q7 as short big endian
a[j] = dataReceived[i + 10 + j * 2 + 1].toInt() shl 8 or dataReceived[i + 10 + j * 2].toUByte().toInt()
}
@@ -335,7 +337,7 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
q[0] = (q_buf and 1023u).toInt()
q[1] = (q_buf shr 10 and 2047u).toInt()
q[2] = (q_buf shr 21 and 2047u).toInt()
for (j in 0..2) { // accel received as fixed 7, in m/s
for (j in 0..2) { // accel received as fixed 7, in m/s^2
// Q7 as short big endian
a[j] = dataReceived[i + 9 + j * 2 + 1].toInt() shl 8 or dataReceived[i + 9 + j * 2].toUByte().toInt()
}
@@ -348,6 +350,17 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
rssi = dataReceived[i + 15].toUByte().toInt()
}
4 -> { // full precision quat and mag, no extra data
for (j in 0..3) { // quat received as fixed Q15
// Q15 as short big endian
q[j] = dataReceived[i + 2 + j * 2 + 1].toInt() shl 8 or dataReceived[i + 2 + j * 2].toUByte().toInt()
}
for (j in 0..2) { // mag received as fixed 10, in gauss
// Q10 as short big endian
m[j] = dataReceived[i + 10 + j * 2 + 1].toInt() shl 8 or dataReceived[i + 10 + j * 2].toUByte().toInt()
}
}
else -> {
}
}
@@ -394,7 +407,7 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
}
// Assign rotation and acceleration
if (packetType == 1) {
if (packetType == 1 || packetType == 4) {
// The data comes in the same order as in the UDP protocol
// x y z w -> w x y z
var rot = Quaternion(q[3].toFloat(), q[0].toFloat(), q[1].toFloat(), q[2].toFloat())
@@ -422,10 +435,30 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
tracker.setRotation(rot)
}
if (packetType == 1 || packetType == 2) {
// TODO: Acceleration "was" wrong
// Acceleration is in local device frame
// On flat surface / face up:
// Right side of the device is +X
// Front side (facing up) is +Z
// Mounted on body / standing up:
// Top side of the device is +Y
// Front side (facing out) is +Z
val scaleAccel = 1 / (1 shl 7).toFloat() // compile time evaluation
var acceleration = Vector3(a[0].toFloat(), a[1].toFloat(), a[2].toFloat()).times(scaleAccel) // no division
tracker.setAcceleration(acceleration)
}
if (packetType == 4) {
// Magnetometer is in local device frame
// On flat surface / face up:
// Right side of the device is +X
// Front side (facing up) is +Z
// Mounted on body / standing up:
// Top side of the device is +Y
// Front side (facing out) is +Z
val scaleMag = 1000 / (1 shl 10).toFloat() // compile time evaluation, and change gauss to milligauss
var magnetometer = Vector3(m[0].toFloat(), m[1].toFloat(), m[2].toFloat()).times(scaleMag) // no division
tracker.setMagVector(magnetometer)
}
if (packetType == 1 || packetType == 2 || packetType == 4) {
tracker.dataTick() // only data tick if there is rotation data
}
@@ -462,10 +495,14 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
// Work on devicesByHid and add/remove as necessary
val removeList: MutableList<HidDevice> = devicesByHID.keys.toMutableList()
removeList.removeAll(hidDeviceList)
hidDeviceList.removeAll(devicesByHID.keys) // addList
for (device in removeList) {
removeDevice(device)
}
// Quickly reattaching a device may not be detected, so always try to open existing devices
for (device in devicesByHID.keys) {
device.open()
}
hidDeviceList.removeAll(devicesByHID.keys) // addList
for (device in hidDeviceList) {
checkConfigureDevice(device)
}