mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-12-06 00:32:35 -08:00
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc8538a332 | ||
|
|
f9d619f93a | ||
|
|
471714afd0 | ||
|
|
91ce0ed734 | ||
|
|
a35d2a77a2 | ||
|
|
ea31d58fb8 | ||
|
|
e74dee1892 | ||
|
|
d84fc40b23 | ||
|
|
0dd004825d | ||
|
|
9f36444169 | ||
|
|
52509c7950 | ||
|
|
868c441220 | ||
|
|
5ad408f61d | ||
|
|
9b30f9800c | ||
|
|
07e5ef647a |
No files matched your search
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
@@ -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.
@@ -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
|
||||
|
||||
@@ -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]}`}
|
||||
|
||||
@@ -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,
|
||||
})),
|
||||
[]
|
||||
);
|
||||
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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')}
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
@@ -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
@@ -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');
|
||||
|
||||
Generated
+8
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+45
-8
@@ -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)
|
||||
}
|
||||
|
||||
+1
-1
Submodule solarxr-protocol updated: 3e87ab0a33...8e9be687c7.
Reference in new issue
Block a user