Compare commits

..
Author SHA1 Message Date
sctanf f68f80eb21 Update solarxr-protocol 2026-04-12 07:54:02 -05:00
sctanf c587af33f4 Testing send HID commands to receiver 2026-04-12 07:54:01 -05:00
sctanf dcd2d131d3 HIDManager extend HIDCommon 2026-04-12 07:54:01 -05:00
128 changed files with 4038 additions and 5031 deletions

No files matched your search

+19 -24
View File
@@ -37,7 +37,7 @@ jobs:
- name: Get tags
run: git fetch --tags origin --recurse-submodules=no --force
- name: Setup PNPM
uses: pnpm/action-setup@v6
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v6
with:
@@ -60,7 +60,7 @@ jobs:
java-version: '17'
distribution: 'adopt'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
uses: gradle/actions/setup-gradle@v5
- name: Java Spotless Check
run: ./gradlew spotlessCheck --build-cache
@@ -81,13 +81,13 @@ jobs:
java-version: '17'
distribution: 'adopt'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
uses: gradle/actions/setup-gradle@v5
- name: Build ShadowJar
run: ./gradlew :server:desktop:shadowJar --build-cache
- name: Test with Gradle
run: ./gradlew :server:desktop:test
- name: Upload Server Jar
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@v6
with:
name: server-jar
path: |
@@ -105,7 +105,7 @@ jobs:
- name: Get tags
run: git fetch --tags origin --recurse-submodules=no --force
- name: Setup PNPM
uses: pnpm/action-setup@v6
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v6
with:
@@ -118,7 +118,7 @@ jobs:
- name: Tar GUI Dist
run: tar -czf slimevr-gui-dist.tar.gz -C gui/out .
- name: Upload GUI Dist
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@v6
with:
name: gui-dist
path: slimevr-gui-dist.tar.gz
@@ -138,19 +138,19 @@ jobs:
- name: Get tags
run: git fetch --tags origin --recurse-submodules=no --force
- name: Setup PNPM
uses: pnpm/action-setup@v6
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: '.node-version'
cache: 'pnpm'
- name: Download Server Jar
uses: actions/download-artifact@v8
uses: actions/download-artifact@v6
with:
name: server-jar
path: server
- name: Download GUI Dist
uses: actions/download-artifact@v8
uses: actions/download-artifact@v6
with:
name: gui-dist
- name: Extract GUI for Electron
@@ -164,15 +164,10 @@ jobs:
mkdir -p gui/dist/artifacts/linux/ \
gui/dist/artifacts/win \
gui/dist/artifacts/mac
VERSION=$(git --no-pager tag --sort -taggerdate --points-at HEAD | head -1)
[ -z "$VERSION" ] && VERSION="0.0.0"
VERSION="${VERSION#v}"
echo "Building version: $VERSION"
pnpm i
cd gui
pnpm i
pnpm exec electron-builder --${{ matrix.platform }} \
${{ matrix.platform == 'macos' && '--universal' || '' }} \
--config.extraMetadata.version="$VERSION" \
--publish never
- name: Collect and Rename Artifacts
shell: bash
@@ -200,7 +195,7 @@ jobs:
echo "Collected files:"
ls -lh "$DEST_DIR"
- name: Upload For Release
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@v6
with:
name: release-${{ matrix.platform }}-${{ matrix.os }}
path: release-out/*
@@ -222,9 +217,9 @@ jobs:
java-version: '17'
distribution: 'adopt'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
uses: gradle/actions/setup-gradle@v5
- name: Download GUI Dist
uses: actions/download-artifact@v8
uses: actions/download-artifact@v6
with:
name: gui-dist
- name: Extract GUI for Android
@@ -241,7 +236,7 @@ jobs:
- name: Prepare APK
run: cp server/android/build/outputs/apk/release/*.apk ./SlimeVR-android.apk
- name: Upload APK
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@v6
with:
name: release-android
path: SlimeVR-android.apk
@@ -256,7 +251,7 @@ jobs:
ANDROID_KEY_PASSWD: ${{ secrets.ANDROID_GPLAY_KEY_PASSWD }}
- name: Upload the Google Play artifact
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@v6
if: startsWith(github.ref, 'refs/tags/')
with:
# Artifact name
@@ -271,22 +266,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download All Release Artifacts
uses: actions/download-artifact@v8
uses: actions/download-artifact@v6
with:
pattern: release-*
path: release-out
merge-multiple: true
- name: Download Server Jar
uses: actions/download-artifact@v8
uses: actions/download-artifact@v6
with:
name: server-jar
path: server
- name: Download GUI Dist
uses: actions/download-artifact@v8
uses: actions/download-artifact@v6
with:
name: gui-dist
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
@@ -20,13 +20,13 @@ jobs:
run: |
npx @slimevr/update-manifest-generator@latest
- uses: actions/upload-artifact@v7
- uses: actions/upload-artifact@v6
with:
name: "update-manifest.json"
path: ./update-manifest.json
- name: Upload update-manifest.json to release
uses: softprops/action-gh-release@v3
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ secrets.UPDATE_MANIFEST_RELEASE_TAG }}
files: ./update-manifest.json
+2 -10
View File
@@ -1,20 +1,12 @@
import { Option, program } from "commander";
import { program } from "commander";
program
.option('-p, --path <path>', 'set launch path')
.option('-s, --steam', 'steam mode')
.option('-i, --install', 'run the driver installer')
.option('-p --path <path>', 'set launch path')
.option(
'--skip-server-if-running',
'gui will not launch the server if it is already running'
)
.allowUnknownOption();
if (process.platform === "linux") {
const noUdevOption = new Option('--no-udev', 'disable udev warning');
noUdevOption.negate = false;
program.addOption(noUdevOption)
}
program.parse(process.argv);
export const options = program.opts();
+1 -13
View File
@@ -20,7 +20,6 @@ import { getPlatform, handleIpc, isPortAvailable } from './utils';
import {
findServerJar,
findSystemJRE,
getExeFolder,
getGuiDataFolder,
getLogsFolder,
getServerDataFolder,
@@ -183,8 +182,6 @@ handleIpc(IPC_CHANNELS.GET_FOLDER, (e, folder) => {
return getGuiDataFolder();
case 'logs':
return getLogsFolder();
case 'exe':
return getExeFolder();
}
});
@@ -397,16 +394,7 @@ const spawnServer = async () => {
logger.info({ javaBin, serverJar }, 'Found Java and server jar');
const platform = getPlatform();
const serverWorkdir = getServerDataFolder()
const serverArgs = ['-Xmx128M', '-jar', serverJar]
if (options.steam) serverArgs.push(`--steam`)
if (options.install) serverArgs.push(`--install`)
if (options.noUdev) serverArgs.push(`--no-udev`)
serverArgs.push('run')
const serverProcess = spawn(javaBin, serverArgs, {
const serverProcess = spawn(javaBin, ['-Xmx128M', '-jar', serverJar, 'run'], {
cwd: serverWorkdir,
shell: false,
env:
+2 -14
View File
@@ -48,21 +48,12 @@ export const getLogsFolder = () => {
return join(getGuiDataFolder(), 'logs');
};
export const getExeFolder = () => {
return path.dirname(app.getPath('exe'));
};
export const getWindowStateFile = () =>
join(getServerDataFolder(), '.window-state.json');
const localJavaBin = (sharedDir: string) => {
const platform = getPlatform();
switch (platform) {
case 'macos':
return join(sharedDir, '../../../../jre/Contents/Home/bin', javaBin);
default:
return join(sharedDir, 'jre/bin', javaBin);
}
const jre = join(sharedDir, 'jre/bin', javaBin);
return jre;
};
const javaHomeBin = () => {
@@ -121,9 +112,6 @@ export const findServerJar = () => {
// For flatpack container
path.resolve('/app/share/slimevr/'),
path.resolve('/usr/share/slimevr/'),
// For macos on steam
path.resolve(`${app.getPath('exe')}/../../../../`),
];
return paths
.filter((p) => !!p)
+1 -2
View File
@@ -36,6 +36,5 @@ contextBridge.exposeInMainWorld('electronAPI', {
openLogsFolder: async () => ipcRenderer.invoke(IPC_CHANNELS.OPEN_FILE, await ipcRenderer.invoke(IPC_CHANNELS.GET_FOLDER, 'logs')),
openFile: (path) => ipcRenderer.invoke(IPC_CHANNELS.OPEN_FILE, path),
ghGet: (req) => ipcRenderer.invoke(IPC_CHANNELS.GH_FETCH, req),
setPresence: (options) => ipcRenderer.invoke(IPC_CHANNELS.DISCORD_PRESENCE, options),
getInstallDir: () => ipcRenderer.invoke(IPC_CHANNELS.GET_FOLDER, 'exe')
setPresence: (options) => ipcRenderer.invoke(IPC_CHANNELS.DISCORD_PRESENCE, options)
} satisfies IElectronAPI);
-1
View File
@@ -56,7 +56,6 @@ export interface IElectronAPI {
openFile: (path: string) => void;
ghGet: <T extends GHGet>(options: T) => Promise<GHReturn[T['type']]>;
setPresence: (options: DiscordPresence) => void;
getInstallDir: () => Promise<string>;
}
declare global {
@@ -14,24 +14,24 @@
## QinHeng
# CH340
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7522", MODE="0660", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE="0660", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1A86", ATTRS{idProduct}=="7522", MODE="0660", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1A86", ATTRS{idProduct}=="7523", MODE="0660", TAG+="uaccess"
# CH341
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="5523", MODE="0660", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1A86", ATTRS{idProduct}=="5523", MODE="0660", TAG+="uaccess"
# CH343
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="55d3", MODE="0660", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1A86", ATTRS{idProduct}=="55D3", MODE="0660", TAG+="uaccess"
# CH9102x
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="55d4", MODE="0660", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1A86", ATTRS{idProduct}=="55D4", MODE="0660", TAG+="uaccess"
## Silabs
# CP210x
SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE="0660", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="10C4", ATTRS{idProduct}=="EA60", MODE="0660", TAG+="uaccess"
## Espressif
# ESP32-S3 / ESP32-C3 / ESP32-C5 / ESP32-C6 / ESP32-C61 / ESP32-H2 / ESP32-P4
SUBSYSTEMS=="usb", ATTRS{idVendor}=="303a", ATTRS{idProduct}=="1001", MODE="0660", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="303A", ATTRS{idProduct}=="1001", MODE="0660", TAG+="uaccess"
# ESP32-S2
SUBSYSTEMS=="usb", ATTRS{idVendor}=="303a", ATTRS{idProduct}=="0002", MODE="0660", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="303A", ATTRS{idProduct}=="0002", MODE="0660", TAG+="uaccess"
## FTDI
# FT232BM/L/Q, FT245BM/L/Q
+1 -1
View File
@@ -41,7 +41,7 @@ export interface IpcInvokeMap {
value?: unknown;
}) => Promise<unknown>;
[IPC_CHANNELS.OPEN_FILE]: (path: string) => void;
[IPC_CHANNELS.GET_FOLDER]: (folder: 'config' | 'logs' | 'exe') => string;
[IPC_CHANNELS.GET_FOLDER]: (folder: 'config' | 'logs') => string;
[IPC_CHANNELS.GH_FETCH]: <T extends GHGet>(
options: T
) => Promise<GHReturn[T['type']]>;
-2
View File
@@ -70,8 +70,6 @@
"electron": "^40.3.0",
"electron-builder": "^26.7.0",
"electron-vite": "^5.0.0",
"@eslint/eslintrc": "^3.3.5",
"@eslint/js": "^9.39.4",
"eslint": "^9.39.1",
"eslint-import-resolver-typescript": "^3.10.1",
"eslint-plugin-import": "^2.32.0",
+4 -81
View File
@@ -524,10 +524,8 @@ settings-general-steamvr-trackers-right_hand = Right hand
settings-general-steamvr-trackers-tracker_toggling = Automatic tracker assignment
settings-general-steamvr-trackers-tracker_toggling-description = Automatically handles toggling SteamVR trackers on or off depending on your current tracker assignments.
settings-general-steamvr-trackers-tracker_toggling-label = Automatic tracker assignment
settings-general-steamvr-trackers-hands-warning = <b>Warning:</b> Enabling the SteamVR hand trackers will disable inputs from real controllers.
This should only be enabled if you are using SlimeVR for hand tracking.
Are you sure you want to do this?
settings-general-steamvr-trackers-hands-warning = <b>Warning:</b> hand trackers will override your controllers.
Are you sure?
settings-general-steamvr-trackers-hands-warning-cancel = Cancel
settings-general-steamvr-trackers-hands-warning-done = Yes
@@ -605,29 +603,6 @@ settings-stay_aligned-debug-label = Debugging
settings-stay_aligned-debug-description = Please include your settings when reporting problems about Stay Aligned.
settings-stay_aligned-debug-copy-label = Copy settings to clipboard
settings-keybinds = Keybind settings
settings-keybinds_ = ''
settings-keybinds-description = Change keybinds for various shortcuts
keybind_config-keybind_name = Keybind
keybind_config-keybind_value = Combination
keybind_config-keybind_delay = Delay before trigger (s)
settings-keybinds_full-reset = Full Reset
settings-keybinds_yaw-reset = Yaw Reset
settings-keybinds_mounting-reset = Mounting Reset
settings-keybinds_feet-mounting-reset = Feet Mounting Reset
settings-keybinds_pause-tracking = Pause Tracking
settings-keybinds_record-keybind = Click to record
settings-keybinds_now-recording = Recording…
settings-keybinds_reset-button = Reset
settings-keybinds_reset-all-button = Reset all
settings-keybinds-wayland-description = You appear to be using wayland, Please change your shortcuts in your system settings.
settings-keybinds-wayland-open-system-settings-button = Open system settings
settings-sidebar-keybinds = Keybinds
settings-keybinds-recorder-modal-title = Assign keybind for
settings-keybinds-recorder-modal-reset-button = Reset
settings-keybinds-recorder-modal-unbind-button = Unbind
settings-keybinds-recorder-modal-done-button = Done
## FK/Tracking settings
settings-general-fk_settings = Tracking settings
@@ -959,50 +934,8 @@ onboarding-setup_warning =
onboarding-setup_warning-skip = Skip setup
onboarding-setup_warning-cancel = Continue setup
## Quiz
onboarding-quiz_continue = Continue
onboarding-quiz_back = Back
onboarding-quiz-more_sets_modal-title = Have you connected all of your trackers?
onboarding-quiz-more_sets_modal-desc = If you have sets of different models, we can connect them right now!
onboarding-quiz-more_sets_modal-confirm = I have connected all my trackers
onboarding-quiz-more_sets_modal-cancel = I want to connect more trackers
onboarding-quiz-slimeset-title = What type of trackers are you connecting?
onboarding-quiz-slimeset-description = If you have multiple sets, you will be asked again later in the process
onboarding-quiz-slimeset-official-sets = Official SlimeVR Trackers
onboarding-quiz-slimeset-thirdparty-sets = Third-party or DIY Trackers
onboarding-quiz-slimeset-answer-regular = SlimeVR V1.0 & V1.2
onboarding-quiz-slimeset-answer-butterfly = Butterfly
onboarding-quiz-slimeset-answer-wifi = WiFi-based Slime
onboarding-quiz-slimeset-answer-dongle = Dongle-based Slime
onboarding-quiz-usage-title = What are you using your trackers for?
onboarding-quiz-usage-description = If you plan on using SlimeVR for multiple purposes, you can change the affected settings later.
onboarding-quiz-usage-answer-VRC = VR Gaming (e.g. VRChat)
onboarding-quiz-usage-answer-mocap_vtubing = Mocap and VTubing
onboarding-quiz-runtime-title = Do you run games via SteamVR, or on the headset itself (standalone)?
onboarding-quiz-runtime-answer-steamvr = SteamVR
onboarding-quiz-runtime-answer-standalone = Standalone
onboarding-quiz-mocap_preferences-title = Mocap Preferences
onboarding-quiz-mocap_preferences-desc = Specify how you plan to use SlimeVR for mocap or VTubing
onboarding-quiz-mocap_preferences-playspace-title = What is your playspace?
onboarding-quiz-mocap_preferences-playspace-desc = If standing, SlimeVR will try to track walking movement instead of anchoring you in one spot.
onboarding-quiz-mocap_preferences-playspace-sitting = Sitting
onboarding-quiz-mocap_preferences-playspace-standing = Standing
onboarding-quiz-mocap_preferences-vrm_model-title = Do you have a VRM model? (Optional)
onboarding-quiz-mocap_preferences-vrm_model-desc = Loading a VRM model will improve tracking quality and compatibility with applications that use VMC.
onboarding-quiz-mocap_preferences-head_tracker-title = Are you wearing a tracker or VR headset on your head?
onboarding-quiz-mocap_preferences-head_tracker-yes = Yes
onboarding-quiz-mocap_preferences-head_tracker-no = No
onboarding-quiz-mocap_preferences-head_tracker_location-title = Where is your head tracker located?
onboarding-quiz-mocap_preferences-head_tracker_location-forehead = Forehead
onboarding-quiz-mocap_preferences-head_tracker_location-face = Face
## Wi-Fi setup
onboarding-wifi_creds-back-v2 = Go back
onboarding-wifi_creds-back = Go back to introduction
onboarding-wifi_creds-v2 = Trackers using Wi-Fi
# This cares about multilines
onboarding-wifi_creds-description-v2 =
@@ -1047,11 +980,6 @@ onboarding-reset_tutorial-2 = Tap the highlighted tracker { $taps } times to tri
You need to be in a pose like you are skiing as shown in the Automatic Mounting wizard, and you have a 3 second delay (configurable) before it gets triggered.
## Install info
install-info_udev-rules_modal_title = Hardware udev access rules not found
install-info_udev-rules_warning = Access rules via udev are required for serial console access & dongle connection. Paste the following command into your terminal to add the udev rules.
install-info_udev-rules_modal_button = Close
install-info_udev-rules_modal-dont-show-again_checkbox = Don't show again
## Setup start
onboarding-home = Welcome to SlimeVR
onboarding-home-start = Let's get set up!
@@ -1378,7 +1306,6 @@ onboarding-user_height-description = We need your height to calculate your body
onboarding-user_height-need_head_tracker = A headset and controllers with positional tracking are required to perform the calibration.
onboarding-user_height-calculate = Calculate my height automatically
onboarding-user_height-next_step = Continue and save
onboarding-user_height-prev_step = Back
onboarding-user_height-manual-proportions = Manual Proportions
onboarding-user_height-calibration-title = Calibration Progress
onboarding-user_height-calibration-RECORDING_FLOOR = Touch the floor with the tip of your controller
@@ -1541,7 +1468,6 @@ firmware_tool-flashing_step-description =
firmware_tool-flashing_step-warning-v2 = Do not unplug or turn off the tracker during the upload process unless told to, it may make your board unusable
firmware_tool-flashing_step-flash_more = Flash more trackers
firmware_tool-flashing_step-exit = Exit
firmware_tool-flashing_step-onboarding_continue = Continue
## firmware tool build status
firmware_tool-build-QUEUED = Waiting to build....
@@ -1675,11 +1601,8 @@ tracking_checklist-FULL_RESET-desc = Some trackers need a reset to be performed.
tracking_checklist-STEAMVR_DISCONNECTED = SteamVR not running
tracking_checklist-STEAMVR_DISCONNECTED-desc = SteamVR is not running. Are you using it for VR?
tracking_checklist-STEAMVR_DISCONNECTED-open = Launch SteamVR
tracking_checklist-STEAMVR_HANDS_ENABLED = Hand trackers toggled on
tracking_checklist-STEAMVR_HANDS_ENABLED-desc = You have enabled the SteamVR virtual hand trackers. This will cause button inputs to not work in SteamVR and in games.
tracking_checklist-STEAMVR_HANDS_ENABLED-go = Disable them
tracking_checklist-TRACKERS_REST_CALIBRATION = Calibrate your trackers
tracking_checklist-TRACKERS_REST_CALIBRATION-desc = You didn't perform tracker calibration. Please let your trackers (highlighted in yellow) rest on a stable surface for a few seconds.
tracking_checklist-TRACKERS_REST_CALIBRATION-desc = You didn't perform tracker calibration. Please let your trackers (highlighted in yellow) rest on a stable surface for a few secconds.
tracking_checklist-TRACKER_ERROR = Trackers with Errors
tracking_checklist-TRACKER_ERROR-desc = Some of your trackers have an error. Please restart the trackers highlighted in yellow.
tracking_checklist-VRCHAT_SETTINGS = Configure VRChat settings
Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

+1 -21
View File
@@ -11,18 +11,16 @@ import {
WebSocketApiContext,
} from './hooks/websocket-api';
import { OnboardingContextProvider } from './components/onboarding/OnboardingContextProvider';
import { OnboardingContextProvider } from './components/onboarding/OnboardingContextProvicer';
import { OnboardingLayout } from './components/onboarding/OnboardingLayout';
import { AutomaticProportionsPage } from './components/onboarding/pages/body-proportions/AutomaticProportions';
import { ManualProportionsPage } from './components/onboarding/pages/body-proportions/ManualProportions';
import { ConnectTrackersPage } from './components/onboarding/pages/ConnectTracker';
import { HomePage } from './components/onboarding/pages/Home';
import { ErrorCollectingConsentPage } from './components/onboarding/pages/ErrorCollectingConsent';
import { AutomaticMountingPage } from './components/onboarding/pages/mounting/AutomaticMounting';
import { ManualMountingPage } from './components/onboarding/pages/mounting/ManualMounting';
import { TrackersAssignPage } from './components/onboarding/pages/trackers-assign/TrackerAssignment';
import { WifiCredsPage } from './components/onboarding/pages/WifiCreds';
import { DonglePage } from './components/onboarding/pages/Dongle';
import { ConfigContextProvider } from './components/providers/ConfigContext';
import { SerialDetectionModal } from './components/SerialDetectionModal';
import { VRCOSCSettings } from './components/settings/pages/VRCOSCSettings';
@@ -52,15 +50,9 @@ import { StayAlignedSetup } from './components/onboarding/pages/stay-aligned/Sta
import { TrackingChecklistProvider } from './components/tracking-checklist/TrackingChecklistProvider';
import { HomeScreenSettings } from './components/settings/pages/HomeScreenSettings';
import { ChecklistPage } from './components/tracking-checklist/TrackingChecklist';
import { QuizSlimeSetQuestion } from './components/onboarding/pages/quiz/SlimeSetQuestion';
import { QuizUsageQuestion } from './components/onboarding/pages/quiz/UsageQuestion';
import { QuizRuntimeQuestion } from './components/onboarding/pages/quiz/RuntimeQuestion';
import { QuizMocapPosQuestion } from './components/onboarding/pages/quiz/MocapPreferencesQuestions';
import { KeybindSettings } from './components/settings/pages/KeybindSettings';
import { ElectronContextC, provideElectron } from './hooks/electron';
import { AppLocalizationProvider } from './i18n/config';
import { openUrl } from './hooks/crossplatform';
import { UdevRulesModal } from './components/onboarding/UdevRulesModal';
export const GH_REPO = 'SlimeVR/SlimeVR-Server';
export const VersionContext = createContext('');
@@ -78,7 +70,6 @@ function Layout() {
<SerialDetectionModal />
<VersionUpdateModal />
<UnknownDeviceModal />
<UdevRulesModal />
<SentryRoutes>
<Route element={<AppLayout />}>
<Route
@@ -146,7 +137,6 @@ function Layout() {
<Route path="interface" element={<InterfaceSettings />} />
<Route path="interface/home" element={<HomeScreenSettings />} />
<Route path="advanced" element={<AdvancedSettings />} />
<Route path="keybinds" element={<KeybindSettings />} />
</Route>
<Route
path="/onboarding"
@@ -157,17 +147,7 @@ function Layout() {
}
>
<Route path="home" element={<HomePage />} />
<Route
path="error-collecting-consent"
element={<ErrorCollectingConsentPage />}
/>
<Route path="wifi-creds" element={<WifiCredsPage />} />
<Route path="quiz/slime-set" element={<QuizSlimeSetQuestion />} />
<Route path="quiz/usage" element={<QuizUsageQuestion />} />
<Route path="quiz/runtime" element={<QuizRuntimeQuestion />} />
<Route path="quiz/mocap-pos" element={<QuizMocapPosQuestion />} />
<Route path="dongle" element={<DonglePage />} />
<Route path="firmware-tool" element={<FirmwareToolSettings />} />
<Route path="connect-trackers" element={<ConnectTrackersPage />} />
<Route path="trackers-assign" element={<TrackersAssignPage />} />
<Route path="mounting/choose" element={<MountingChoose />} />
+3 -8
View File
@@ -1,10 +1,9 @@
import { useLayoutEffect } from 'react';
import { useConfig } from './hooks/config';
import { Outlet, useLocation, useNavigate } from 'react-router-dom';
import { Outlet, useNavigate } from 'react-router-dom';
export function AppLayout() {
const { config } = useConfig();
const { pathname } = useLocation();
const navigate = useNavigate();
useLayoutEffect(() => {
@@ -29,14 +28,10 @@ export function AppLayout() {
}, [config]);
useLayoutEffect(() => {
if (
config &&
!config.doneOnboarding &&
!pathname.startsWith('/onboarding/')
) {
if (config && !config.doneOnboarding) {
navigate('/onboarding/home');
}
}, [config]);
}, [config?.doneOnboarding]);
return (
<>
+60
View File
@@ -0,0 +1,60 @@
import { Localized, useLocalization } from '@fluent/react';
import { BaseModal } from './commons/BaseModal';
import { Button } from './commons/Button';
import { Typography } from './commons/Typography';
export function ErrorConsentModal({
isOpen = true,
cancel,
accept,
}: {
/**
* Is the parent/sibling component opened?
*/
isOpen: boolean;
/**
* Function to trigger when you still want to close the app
*/
accept: () => void;
/**
* Function to trigger when cancelling app close
*/
cancel?: () => void;
}) {
const { l10n } = useLocalization();
return (
<BaseModal isOpen={isOpen} onRequestClose={cancel} closeable={false}>
<div className="flex flex-col gap-3">
<>
<div className="flex flex-col items-center gap-3 fill-accent-background-20">
<div className="flex flex-col items-center gap-2 max-w-[512px]">
<Typography variant="main-title">
{l10n.getString('error_collection_modal-title')}
</Typography>
<Localized
id={'error_collection_modal-description_v2'}
elems={{
b: <b />,
h1: <span className="text-lg font-bold" />,
}}
>
<Typography
variant="standard"
whitespace="whitespace-pre-line"
/>
</Localized>
</div>
</div>
<Button variant="primary" onClick={accept}>
{l10n.getString('error_collection_modal-confirm')}
</Button>
<Button variant="tertiary" onClick={cancel}>
{l10n.getString('error_collection_modal-cancel')}
</Button>
</>
</div>
</BaseModal>
);
}
+1 -2
View File
@@ -14,8 +14,7 @@
't t t' var(--topbar-h)
'n b s' var(--toolbar-h)
'n c s' calc(100% - var(--topbar-h) - var(--toolbar-h))
/ var(--navbar-w) calc(100% - var(--navbar-w) - var(--right-section-w))
var(--right-section-w);
/ var(--navbar-w) calc(100% - var(--navbar-w) - var(--right-section-w)) var(--right-section-w);
}
@screen nsm {
+6 -1
View File
@@ -22,6 +22,7 @@ import { GearIcon } from './commons/icon/GearIcon';
import { TrackersStillOnModal } from './TrackersStillOnModal';
import { useConfig } from '@/hooks/config';
import { TrayOrExitModal } from './TrayOrExitModal';
import { ErrorConsentModal } from './ErrorConsentModal';
import { useAtomValue } from 'jotai';
import { connectedIMUTrackersAtom } from '@/store/app-store';
import { useElectron } from '@/hooks/electron';
@@ -71,7 +72,6 @@ export function TopBar({
await saveConfig();
electron.api.close();
};
const tryCloseApp = async (dontTray = false) => {
if (!electron.isElectron) throw 'no electron';
@@ -286,6 +286,11 @@ export function TopBar({
setConnectedTrackerWarning(false);
}}
/>
<ErrorConsentModal
isOpen={config?.errorTracking === null}
accept={() => setConfig({ errorTracking: true })}
cancel={() => setConfig({ errorTracking: false })}
/>
</>
);
}
@@ -1,60 +0,0 @@
import { useState } from 'react';
import { BaseModal } from './BaseModal';
import { Button, ButtonProps } from './Button';
export type ButtonConfirmModal = Omit<ButtonProps, 'onClick' | 'to'> & {
onConfirm: () => void;
onCancel: (reason: 'cancel' | 'backdrop') => void;
confirmLabel: string;
cancelLabel: string;
};
export function ButtonConfirmModal(props: ButtonConfirmModal) {
const {
onConfirm,
onCancel,
cancelLabel,
confirmLabel,
children,
...buttonProps
} = props;
const [isOpen, setOpen] = useState(false);
return (
<>
<BaseModal
isOpen={isOpen}
onRequestClose={() => {
setOpen(false);
onCancel('backdrop');
}}
appendClasses="w-full max-w-2xl"
>
<div className="flex flex-col justify-between gap-4">
{children}
<div className="flex w-full justify-between gap-2 xs:flex-row flex-col">
<Button
id={cancelLabel}
variant="tertiary"
onClick={() => {
setOpen(false);
onCancel('cancel');
}}
/>
<Button
id={confirmLabel}
variant="primary"
onClick={() => {
setOpen(false);
onConfirm();
}}
/>
</div>
</div>
</BaseModal>
<Button {...buttonProps} onClick={() => setOpen(true)} />
</>
);
}
+4 -4
View File
@@ -1,6 +1,6 @@
import classNames from 'classnames';
import { forwardRef, useMemo } from 'react';
import { Control, Controller, FieldPath, FieldValues } from 'react-hook-form';
import { Control, Controller } from 'react-hook-form';
export const CHECKBOX_CLASSES = classNames(
'bg-background-50 border-background-50 cursor-pointer rounded-md w-5 h-5 text-accent-background-30 focus:border-accent-background-40 focus:ring-transparent focus:ring-offset-transparent focus:outline-transparent'
@@ -112,7 +112,7 @@ export const CheckboxInternal = forwardRef<
);
});
export function CheckBox<T extends FieldValues = FieldValues>({
export function CheckBox({
label,
variant = 'checkbox',
color = 'primary',
@@ -123,8 +123,8 @@ export function CheckBox<T extends FieldValues = FieldValues>({
disabled,
}: {
label: string;
control: Control<T>;
name: FieldPath<T>;
control: Control<any>;
name: string;
variant?: 'checkbox' | 'toggle';
color?: 'primary' | 'secondary' | 'tertiary';
outlined?: boolean;
+3 -6
View File
@@ -10,8 +10,6 @@ import {
import {
Control,
FieldError,
FieldPath,
FieldValues,
useController,
UseControllerProps,
} from 'react-hook-form';
@@ -417,15 +415,14 @@ export function DropdownInside({
);
}
export function Dropdown<T extends FieldValues = FieldValues>({
export function Dropdown({
control,
name,
rules,
...props
}: DropdownProps & {
control: Control<T>;
name: FieldPath<T>;
rules?: UseControllerProps<T, FieldPath<T>>['rules'];
control: Control<any>;
rules?: UseControllerProps<any>['rules'];
}) {
const {
field: { value, onChange },
+5 -12
View File
@@ -7,13 +7,7 @@ import {
useRef,
useState,
} from 'react';
import {
Control,
Controller,
FieldPath,
FieldValues,
UseControllerProps,
} from 'react-hook-form';
import { Control, Controller, UseControllerProps } from 'react-hook-form';
import { FileIcon } from './icon/FileIcon';
import { UploadFileIcon } from './icon/UploadFileIcon';
import { Typography } from './Typography';
@@ -199,7 +193,7 @@ export const FileInputInside = forwardRef<
);
});
export const FileInput = <T extends FieldValues = FieldValues>({
export const FileInput = ({
control,
name,
label,
@@ -210,9 +204,8 @@ export const FileInput = <T extends FieldValues = FieldValues>({
capture,
importedFileName,
}: {
rules: UseControllerProps<T, FieldPath<T>>['rules'];
control: Control<T>;
name: FieldPath<T>;
rules: UseControllerProps<any>['rules'];
control: Control<any>;
accept: string;
multiple?: boolean;
capture?: boolean | 'user' | 'environment';
@@ -221,7 +214,7 @@ export const FileInput = <T extends FieldValues = FieldValues>({
**/
label?: string;
importedFileName: string | null;
} & Omit<InputProps, 'name'> &
} & InputProps &
Partial<HTMLInputElement>) => {
return (
<Controller
+4 -7
View File
@@ -4,8 +4,6 @@ import {
Control,
Controller,
FieldError,
FieldPath,
FieldValues,
UseControllerProps,
} from 'react-hook-form';
import { EyeIcon } from './icon/EyeIcon';
@@ -119,7 +117,7 @@ export const InputInside = forwardRef<
);
});
export const Input = <T extends FieldValues = FieldValues>({
export const Input = ({
type = 'text',
control,
name,
@@ -130,11 +128,10 @@ export const Input = <T extends FieldValues = FieldValues>({
variant = 'primary',
rules,
}: {
rules?: UseControllerProps<T, FieldPath<T>>['rules'];
control: Control<T>;
name: FieldPath<T>;
rules?: UseControllerProps<any>['rules'];
control: Control<any>;
autocomplete?: boolean | string;
} & Omit<InputProps, 'name'> &
} & InputProps &
Partial<React.HTMLProps<HTMLInputElement>>) => {
return (
<Controller
@@ -1,119 +0,0 @@
import { useState, forwardRef, useRef } from 'react';
import { Typography } from './Typography';
import classNames from 'classnames';
import { useFormContext } from 'react-hook-form';
const excludedKeys = [' ', 'SPACE', 'META'];
const maxKeybindLength = 4;
export const KeybindRecorder = forwardRef<
HTMLInputElement,
{
keys: string[];
onKeysChange: (v: string[]) => void;
error?: string;
}
>(function KeybindRecorder({ keys, onKeysChange, error }) {
const [localKeys, setLocalKeys] = useState<string[]>(keys);
const [isRecording, setIsRecording] = useState(false);
const [oldKeys, setOldKeys] = useState<string[]>([]);
const [invalidSlot, setInvalidSlot] = useState<number | null>(null);
const [errorText, setErrorText] = useState<string>('');
const inputRef = useRef<HTMLInputElement>(null);
const displayKeys = isRecording ? localKeys : keys;
const activeIndex = isRecording ? displayKeys.length : -1;
const displayError = errorText || error;
const { clearErrors } = useFormContext();
const handleKeyDown = (e: React.KeyboardEvent) => {
e.preventDefault();
const key = e.key.toUpperCase();
const errorMsg = excludedKeys.includes(key)
? `Cannot use ${key}!`
: displayKeys.includes(key)
? `${key} is a Duplicate Key!`
: null;
if (errorMsg) {
setErrorText(errorMsg);
setInvalidSlot(activeIndex);
setTimeout(() => {
setInvalidSlot(null);
}, 350);
return;
}
if (displayKeys.length < maxKeybindLength) {
const updatedKeys = [...displayKeys, key];
setLocalKeys(updatedKeys);
onKeysChange(updatedKeys);
if (updatedKeys.length == maxKeybindLength) {
inputRef.current?.blur();
}
}
};
const handleOnBlur = () => {
setIsRecording(false);
if (displayKeys.length < maxKeybindLength - 2 || error) {
onKeysChange(oldKeys);
setLocalKeys(oldKeys);
}
};
const handleOnFocus = () => {
clearErrors('keybinds');
const initialKeys: string[] = [];
setOldKeys(keys);
setLocalKeys(initialKeys);
onKeysChange(initialKeys);
setIsRecording(true);
};
return (
<div className="w-full justify-center items-center flex flex-col gap-2">
<div className="flex gap-2 p-2 items-center rounded-lg relative">
<input
autoFocus
ref={inputRef}
className="opacity-0 absolute cursor-pointer w-full"
onFocus={handleOnFocus}
onBlur={handleOnBlur}
onKeyDown={handleKeyDown}
/>
<div className="flex flex-grow gap-2 justify-center h-full">
{Array.from({ length: maxKeybindLength }).map((_, i) => {
const key = displayKeys[i];
const isActive = isRecording && i === activeIndex;
const isInvalid = invalidSlot === i;
return (
<div key={i} className="flex flex-row">
<div
className={classNames(
'flex p-2 rounded-lg min-w-[50px] min-h-[50px] text-main-title justify-center items-center bg-background-80 mobile:text-sm',
{
'keyslot-invalid ring-2 ring-status-critical': isInvalid,
'keyslot-animate ring-2 ring-accent':
isActive && !isInvalid,
'ring-accent': !isInvalid && !isInvalid,
}
)}
>
{key ?? ''}
</div>
<div className="flex pl-2 text-main-title justify-center items-center mobile:text-sm">
{i < maxKeybindLength - 1 ? '+' : ''}
</div>
</div>
);
})}
</div>
</div>
{displayError && (
<div className="isInvalid keyslot-invalid">
<Typography color="text-status-critical">{`${errorText} ${error}`}</Typography>
</div>
)}
</div>
);
});
@@ -1,93 +0,0 @@
import { BaseModal } from './BaseModal';
import {
Controller,
Control,
useFormContext,
FieldValues,
FieldPath,
} from 'react-hook-form';
import { KeybindRecorder } from './KeybindRecorder';
import { Typography } from './Typography';
import { Button } from './Button';
import './KeybindRow.scss';
import { useLocalization } from '@fluent/react';
export function KeybindRecorderModal<T extends FieldValues = FieldValues>({
id,
control,
name,
isVisisble,
onClose,
onUnbind,
onSubmit,
}: {
id?: string;
control: Control<T>;
name: FieldPath<T>;
isVisisble: boolean;
onClose: () => void;
onUnbind: () => void;
onSubmit: () => void;
}) {
const { l10n } = useLocalization();
const keybindlocalization = 'settings-keybinds_' + id;
const {
formState: { errors },
resetField,
handleSubmit,
} = useFormContext();
return (
<BaseModal
isOpen={isVisisble}
onRequestClose={onClose}
appendClasses="w-full max-w-xl"
>
<div className="flex flex-col gap-3 w-full justify-between h-full">
<Typography variant="section-title">
{l10n.getString('settings-keybinds-recorder-modal-title')}{' '}
{l10n.getString(keybindlocalization)}
</Typography>
<Controller
control={control}
name={name}
render={({ field }) => (
<KeybindRecorder
keys={field.value ?? []}
onKeysChange={field.onChange}
ref={field.ref}
error={errors.keybinds?.message as string}
/>
)}
/>
<div className="flex flex-row justify-between w-full">
<div className="flex flex-row justify-start gap-4">
<Button
id="settings-keybinds-recorder-modal-reset-button"
variant="tertiary"
onClick={() => {
resetField(name);
handleSubmit(onSubmit)();
}}
/>
<Button
id="settings-keybinds-recorder-modal-unbind-button"
variant="tertiary"
onClick={() => {
onUnbind();
handleSubmit(onSubmit)();
}}
/>
</div>
<div className="flex flex-row justify-end">
<Button
id="settings-keybinds-recorder-modal-done-button"
variant="primary"
onClick={handleSubmit(onSubmit)}
/>
</div>
</div>
</div>
</BaseModal>
);
}
@@ -1,65 +0,0 @@
.keybind-row {
display: grid;
grid-column: 1 / -1;
grid-template-columns: subgrid;
height: auto;
align-items: center;
gap: 10px;
}
@keyframes keyslot {
0%,
100% {
transform: scale(1);
opacity: 0.6;
}
50% {
transform: scale(1.08);
opacity: 1;
}
}
@keyframes shake {
0% {
transform: translate(1px, 1px) rotate(0deg);
}
10% {
transform: translate(-1px, -2px) rotate(-1deg);
}
20% {
transform: translate(-3px, 0px) rotate(1deg);
}
30% {
transform: translate(3px, 2px) rotate(0deg);
}
40% {
transform: translate(1px, -1px) rotate(1deg);
}
50% {
transform: translate(-1px, 2px) rotate(-1deg);
}
60% {
transform: translate(-3px, 1px) rotate(0deg);
}
70% {
transform: translate(3px, 1px) rotate(-1deg);
}
80% {
transform: translate(-1px, -1px) rotate(1deg);
}
90% {
transform: translate(1px, 2px) rotate(0deg);
}
100% {
transform: translate(1px, -2px) rotate(-1deg);
}
}
.keyslot-animate {
animation: keyslot 1s ease-in-out infinite;
}
.keyslot-invalid {
animation: shake 0.35s ease;
}
@@ -1,88 +0,0 @@
import { Typography } from './Typography';
import './KeybindRow.scss';
import { useEffect, useState } from 'react';
import {
Control,
FieldPath,
FieldValues,
UseFormGetValues,
} from 'react-hook-form';
import { NumberSelector } from './NumberSelector';
import { useLocaleConfig } from '@/i18n/config';
function KeyBindKeyList({ keybind }: { keybind: string[] }) {
if (keybind.length <= 1) {
return (
<div className="flex h-full text-section-title items-center justifiy-center">
Click to edit keybind
</div>
);
}
return keybind.map((key, i) => {
return (
<div key={i} className="flex flex-row">
<div className="flex flex-wrap p-2 rounded-lg min-w-[50px] text-standard-bold justify-center items-center bg-background-80 mobile:text-sm">
{key ?? ''}
</div>
<div className="flex justify-center items-center text-section-title mobile:text-sm gap-2 pl-3">
{i < keybind.length - 1 ? '+' : ''}
</div>
</div>
);
});
}
export function KeybindsRow<T extends FieldValues = FieldValues>({
id,
control,
index,
getValue,
openKeybindRecorderModal,
}: {
id?: string;
control: Control<T>;
index: number;
getValue: UseFormGetValues<any>;
openKeybindRecorderModal: (index: number) => void;
}) {
const [binding, setBinding] = useState<string[]>();
const { currentLocales } = useLocaleConfig();
const secondsFormat = new Intl.NumberFormat(currentLocales, {
style: 'unit',
unit: 'second',
unitDisplay: 'narrow',
maximumFractionDigits: 2,
});
const handleOpenModal = () => {
openKeybindRecorderModal(index);
};
useEffect(() => {
setBinding(getValue(`keybinds.${index}.binding`));
});
return (
<div className="keybind-row bg-background-60 rounded-xl h-full keybinds-small:flex keybinds-small:flex-col keybinds-small:justify-center keybinds-small:items-center p-2">
<label className="text-sm font-medium text-background-10 keybinds-small:flex keybinds-small:py-2 keybinds-small:justify-center keybinds-small:align-middle">
<Typography id={`settings-keybinds_${id}`} />
</label>
<div
className="flex gap-2 h-full items-center rounded-lg bg-background-70 hover:bg-background-50 w-full"
onClick={handleOpenModal}
>
<div className="flex flex-grow gap-2 justify-center p-2 h-[50px]">
{binding != null && <KeyBindKeyList keybind={binding} />}
</div>
</div>
<NumberSelector
control={control}
name={`keybinds.${index}.delay` as FieldPath<T>}
valueLabelFormat={(value) => secondsFormat.format(value)}
min={0}
max={10}
step={0.2}
/>
</div>
);
}
+46 -48
View File
@@ -1,10 +1,10 @@
import { Control, Controller, FieldPath, FieldValues } from 'react-hook-form';
import { Control, Controller } from 'react-hook-form';
import { Button } from './Button';
import { Typography } from './Typography';
import { useCallback, useMemo } from 'react';
import { useLocaleConfig } from '@/i18n/config';
export function NumberSelector<T extends FieldValues = FieldValues>({
export function NumberSelector({
label,
valueLabelFormat,
control,
@@ -18,8 +18,8 @@ export function NumberSelector<T extends FieldValues = FieldValues>({
}: {
label?: string;
valueLabelFormat?: (value: number) => string;
control: Control<T>;
name: FieldPath<T>;
control: Control<any>;
name: string;
min: number;
max: number;
step: number | ((value: number, add: boolean) => number);
@@ -57,62 +57,60 @@ export function NumberSelector<T extends FieldValues = FieldValues>({
<Controller
control={control}
name={name}
render={({ field: { onChange, value } }) => {
return (
<div className="flex flex-col gap-1 w-full">
{label?.length != 0 ? <Typography bold>{label}</Typography> : <></>}
<div className="flex gap-5 bg-background-60 p-2 rounded-lg">
<div className="flex gap-1">
{doubleStep !== undefined && (
<Button
variant="tertiary"
rounded
onClick={() => onChange(doubleStepFn(value, false))}
disabled={doubleStepFn(value, false) < min || disabled}
>
{showButtonWithNumber
? decimalFormat.format(-doubleStep)
: '--'}
</Button>
)}
render={({ field: { onChange, value } }) => (
<div className="flex flex-col gap-1 w-full">
<Typography bold>{label}</Typography>
<div className="flex gap-5 bg-background-60 p-2 rounded-lg">
<div className="flex gap-1">
{doubleStep !== undefined && (
<Button
variant="tertiary"
rounded
onClick={() => onChange(stepFn(value, false))}
disabled={stepFn(value, false) < min || disabled}
onClick={() => onChange(doubleStepFn(value, false))}
disabled={doubleStepFn(value, false) < min || disabled}
>
-
{showButtonWithNumber
? decimalFormat.format(-doubleStep)
: '--'}
</Button>
</div>
<div className="flex flex-grow justify-center text-center items-center w-10 text-standard">
{valueLabelFormat ? valueLabelFormat(value) : value}
</div>
<div className="flex gap-1">
)}
<Button
variant="tertiary"
rounded
onClick={() => onChange(stepFn(value, false))}
disabled={stepFn(value, false) < min || disabled}
>
-
</Button>
</div>
<div className="flex flex-grow justify-center text-center items-center w-10 text-standard">
{valueLabelFormat ? valueLabelFormat(value) : value}
</div>
<div className="flex gap-1">
<Button
variant="tertiary"
rounded
onClick={() => onChange(stepFn(value, true))}
disabled={stepFn(value, true) > max || disabled}
>
+
</Button>
{doubleStep !== undefined && (
<Button
variant="tertiary"
rounded
onClick={() => onChange(stepFn(value, true))}
disabled={stepFn(value, true) > max || disabled}
onClick={() => onChange(doubleStepFn(value, true))}
disabled={doubleStepFn(value, true) > max || disabled}
>
+
{showButtonWithNumber
? decimalFormat.format(doubleStep)
: '++'}
</Button>
{doubleStep !== undefined && (
<Button
variant="tertiary"
rounded
onClick={() => onChange(doubleStepFn(value, true))}
disabled={doubleStepFn(value, true) > max || disabled}
>
{showButtonWithNumber
? decimalFormat.format(doubleStep)
: '++'}
</Button>
)}
</div>
)}
</div>
</div>
);
}}
</div>
)}
/>
);
}
+4 -4
View File
@@ -1,9 +1,9 @@
import classNames from 'classnames';
import { Control, Controller, FieldPath, FieldValues } from 'react-hook-form';
import { Control, Controller } from 'react-hook-form';
import { Typography } from './Typography';
import { ReactNode } from 'react';
export function Radio<T extends FieldValues = FieldValues>({
export function Radio({
control,
name,
label,
@@ -14,8 +14,8 @@ export function Radio<T extends FieldValues = FieldValues>({
disabled,
...props
}: {
control: Control<T>;
name: FieldPath<T>;
control: Control<any>;
name: string;
label?: string;
value: string;
description?: string | null;
+4 -4
View File
@@ -1,7 +1,7 @@
import classNames from 'classnames';
import { Control, Controller, FieldPath, FieldValues } from 'react-hook-form';
import { Control, Controller } from 'react-hook-form';
export function Range<T extends FieldValues = FieldValues>({
export function Range({
control,
name,
values,
@@ -11,8 +11,8 @@ export function Range<T extends FieldValues = FieldValues>({
// input props
...props
}: {
control: Control<T>;
name: FieldPath<T>;
control: Control<any>;
name: string;
max: number;
min: number;
step: number;
@@ -1,8 +1,6 @@
import {
Control,
Controller,
FieldPath,
FieldValues,
RefCallBack,
UseControllerProps,
} from 'react-hook-form';
@@ -50,20 +48,20 @@ export function InnerSystemFileInput({
);
}
export function SystemFileInput<T extends FieldValues = FieldValues>({
export function SystemFileInput({
control,
rules,
name,
label,
directory = false,
}: {
rules: UseControllerProps<T, FieldPath<T>>['rules'];
control: Control<T>;
rules: UseControllerProps<any>['rules'];
control: Control<any>;
/**
* Use a translation key!
**/
label: string;
name: FieldPath<T>;
name: string;
directory?: boolean;
disabled?: boolean;
}) {
+4 -4
View File
@@ -1,7 +1,7 @@
import classNames from 'classnames';
import { Control, Controller, FieldPath, FieldValues } from 'react-hook-form';
import { Control, Controller } from 'react-hook-form';
export function ThemeSelector<T extends FieldValues = FieldValues>({
export function ThemeSelector({
control,
name,
value,
@@ -10,8 +10,8 @@ export function ThemeSelector<T extends FieldValues = FieldValues>({
colors,
...props
}: {
control: Control<T>;
name: FieldPath<T>;
control: Control<any>;
name: string;
colors: string | undefined;
value: string;
} & React.HTMLProps<HTMLInputElement>) {
@@ -60,15 +60,15 @@ export function BatteryIcon({
/>
</mask>
<g mask="url(#mask0_4_39)" className={classNames(col, 'opacity-100')}>
<rect width={charging ? 18 : value > 2 ? 0 : value * 18} height="9" />
<rect width={charging ? 18 : value * 18} height="9" />
</g>
{charging && (value <= 1 || value > 2) && (
{charging && value <= 1 && (
<path
d="M 7.7638355,8.4189633 8.0112251,4.9834646 5.7712838,4.9834645 8.5644084,0.07977871 8.3170195,3.5152773 H 10.55696 Z"
fill="#081e30"
/>
)}
{charging && value > 1 && value <= 2 && (
{charging && value > 1 && (
<path
d="M 5.5342464,4.6225095 C 6.1777799,5.0106205 6.6131537,5.2516456 7.5253371,6.545223 8.4340868,4.4016445 8.7809738,3.661475 10.605195,1.5520288"
fill="none"
@@ -1,19 +1,10 @@
export function HeadsetIcon({
width = 24,
disabled = false,
}: {
width?: number;
disabled?: boolean;
}) {
export function HeadsetIcon({ width = 24 }: { width?: number }) {
return (
<svg xmlns="http://www.w3.org/2000/svg" width={width} viewBox="0 0 640 512">
<path
transform="scale(0.75, 0.75) translate(120, 96)"
d="M576 64H64C28.7 64 0 92.7 0 128v256c0 35.3 28.7 64 64 64h120.4c24.2 0 46.4-13.7 57.2-35.4l32-64c8.8-17.5 26.7-28.6 46.3-28.6s37.5 11.1 46.3 28.6l32 64c10.8 21.7 33 35.4 57.2 35.4H576c35.3 0 64-28.7 64-64V128c0-35.3-28.7-64-64-64zM96 240a64 64 0 11128 0 64 64 0 11-128 0zm384-64a64 64 0 110 128 64 64 0 110-128z"
/>
{disabled && (
<line x1="20" y1="20" x2="620" y2="492" stroke="red" strokeWidth="30" />
)}
</svg>
);
}
@@ -1,13 +0,0 @@
export function ResetSettingIcon({ size = 24 }: { size?: number }) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
height={size}
viewBox="0 -960 960 960"
width={size}
fill="#00000"
>
<path d="M520-330v-60h160v60H520Zm60 210v-50h-60v-60h60v-50h60v160h-60Zm100-50v-60h160v60H680Zm40-110v-160h60v50h60v60h-60v50h-60Zm111-280h-83q-26-88-99-144t-169-56q-117 0-198.5 81.5T200-480q0 72 32.5 132t87.5 98v-110h80v240H160v-80h94q-62-50-98-122.5T120-480q0-75 28.5-140.5t77-114q48.5-48.5 114-77T480-840q129 0 226.5 79.5T831-560Z" />
</svg>
);
}
@@ -1,12 +0,0 @@
export function SittingIcon({ size = 24 }: { size?: number }) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
height={size}
viewBox="0 -960 960 960"
width={size}
>
<path d="M600-160H320q-33 0-56.5-23.5T240-240v-440h80v440h280v80ZM460-720q-33 0-56.5-23.5T380-800q0-33 23.5-56.5T460-880q33 0 56.5 23.5T540-800q0 33-23.5 56.5T460-720ZM640-80v-200H440q-33 0-56.5-23.5T360-360v-220q0-42 29-71t71-29q42 0 71 29t29 71v180h80q33 0 56.5 23.5T720-320v240h-80Z" />
</svg>
);
}
@@ -1,9 +1,9 @@
export function SteamIcon({ size = 20 }) {
export function SteamIcon() {
return (
<svg
width={size}
height={size}
viewBox="0 0 20 20"
width="20"
height="18"
viewBox="0 0 20 18"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M17.6562 5.32031C17.6562 6.10938 17.3903 6.7832 16.8583 7.3418C16.3263 7.90039 15.6845 8.17969 14.933 8.17969C14.1815 8.17969 13.5398 7.90039 13.0078 7.3418C12.4758 6.7832 12.2098 6.10938 12.2098 5.32031C12.2098 4.53125 12.4758 3.85742 13.0078 3.29883C13.5398 2.74023 14.1815 2.46094 14.933 2.46094C15.6845 2.46094 16.3263 2.74023 16.8583 3.29883C17.3903 3.85742 17.6562 4.53125 17.6562 5.32031ZM9.0625 14.0156C9.0625 13.2031 8.79092 12.5117 8.24777 11.9414C7.70461 11.3711 7.04613 11.0859 6.27232 11.0859C6.07143 11.0859 5.87054 11.1094 5.66964 11.1562L6.83036 11.6484C7.40327 11.8906 7.81064 12.3066 8.05246 12.8965C8.29427 13.4863 8.29985 14.0781 8.0692 14.6719C7.83854 15.2734 7.44048 15.6992 6.875 15.9492C6.30952 16.1992 5.74405 16.2031 5.17857 15.9609C5.02232 15.8984 4.79167 15.8027 4.48661 15.6738C4.18155 15.5449 3.95461 15.4492 3.8058 15.3867C4.0439 15.8555 4.38244 16.2324 4.82143 16.5176C5.26042 16.8027 5.74405 16.9453 6.27232 16.9453C7.04613 16.9453 7.70461 16.6602 8.24777 16.0898C8.79092 15.5195 9.0625 14.8281 9.0625 14.0156ZM18.3259 5.33203C18.3259 4.34766 17.9929 3.50586 17.327 2.80664C16.6611 2.10742 15.8594 1.75781 14.9219 1.75781C13.9769 1.75781 13.1715 2.10742 12.5056 2.80664C11.8397 3.50586 11.5067 4.34766 11.5067 5.33203C11.5067 6.32422 11.8397 7.16797 12.5056 7.86328C13.1715 8.55859 13.9769 8.90625 14.9219 8.90625C15.8594 8.90625 16.6611 8.55859 17.327 7.86328C17.9929 7.16797 18.3259 6.32422 18.3259 5.33203ZM20 5.33203C20 6.80859 19.5033 8.06641 18.51 9.10547C17.5167 10.1445 16.3207 10.6641 14.9219 10.6641L10.0446 14.4023C9.95536 15.4102 9.54985 16.2617 8.82812 16.957C8.1064 17.6523 7.25446 18 6.27232 18C5.37202 18 4.57589 17.7031 3.88393 17.1094C3.19196 16.5156 2.75298 15.7656 2.56696 14.8594L0 13.7812V8.75391L4.34152 10.5938C4.92932 10.2188 5.57292 10.0312 6.27232 10.0312C6.36905 10.0312 6.49926 10.0391 6.66295 10.0547L9.83259 5.28516C9.84747 3.82422 10.3516 2.57812 11.3449 1.54688C12.3382 0.515625 13.5305 0 14.9219 0C16.3207 0 17.5167 0.521484 18.51 1.56445C19.5033 2.60742 20 3.86328 20 5.33203Z" />
@@ -7,7 +7,7 @@ import {
} from '@/hooks/firmware-tool';
import { useLocalization } from '@fluent/react';
import classNames from 'classnames';
import { Control, Controller, FieldPath, FieldValues } from 'react-hook-form';
import { Control, Controller } from 'react-hook-form';
import {
FirmwareUpdateStatus,
TrackerStatus as TrackerStatusEnum,
@@ -22,9 +22,9 @@ interface DeviceCardProps {
color?: string;
}
interface DeviceCardControlProps<T extends FieldValues = FieldValues> {
control?: Control<T>;
name?: FieldPath<T>;
interface DeviceCardControlProps {
control?: Control<any>;
name?: string;
progress?: number;
disabled?: boolean;
}
@@ -55,7 +55,7 @@ export function DeviceCardContent({ deviceNames, status }: DeviceCardProps) {
);
}
export function DeviceCardControl<T extends FieldValues = FieldValues>({
export function DeviceCardControl({
control,
name,
progress,
@@ -63,7 +63,7 @@ export function DeviceCardControl<T extends FieldValues = FieldValues>({
online = null,
color = 'bg-background-60',
...props
}: DeviceCardControlProps<T> & DeviceCardProps) {
}: DeviceCardControlProps & DeviceCardProps) {
const cardborder = useMemo(() => {
if (!props.status) return 'border-transparent';
@@ -36,7 +36,7 @@ export function FlashingStep({
const { l10n } = useLocalization();
const { selectedDevices, selectDevices, files, selectedDefault } =
useFirmwareTool();
const { state: onboardingState, state } = useOnboarding();
const { state: onboardingState } = useOnboarding();
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
const [status, setStatus] = useState<{
[key: string]: {
@@ -203,28 +203,15 @@ export function FlashingStep({
onClick={() => goTo('FlashingMethod')}
/>
</Localized>
{state.alonePage && (
<Localized id="firmware_tool-flashing_step-exit">
<Button
variant="primary"
onClick={() => {
clear();
nav('/');
}}
/>
</Localized>
)}
{!state.alonePage && (
<Localized id="firmware_tool-flashing_step-onboarding_continue">
<Button
variant="primary"
onClick={() => {
clear();
nav('/onboarding/trackers-assign');
}}
/>
</Localized>
)}
<Localized id="firmware_tool-flashing_step-exit">
<Button
variant="primary"
onClick={() => {
clear();
nav('/');
}}
/>
</Localized>
</div>
</div>
</div>
@@ -10,7 +10,6 @@ import {
} from '@/firmware-tool-api/firmwareToolComponents';
import { useEffect, useMemo, useState } from 'react';
import { useSafeLocalization } from '@/i18n/config';
import semver from 'semver';
function Selector({
text,
@@ -143,33 +142,16 @@ export function SelectSourceSetep({
!source.availableBoards.includes(partialBoard.board) ||
source.source !== partialBoard.source,
name: source.version,
isBranch: source.branch == source.version,
});
return curr;
},
[] as { name: string; disabled: boolean }[]
[] as { name: string; disabled: boolean; isBranch: boolean }[]
)
.sort((a, b) => {
// safeguard against inf loop
if (a == b) return 0;
const versionA = semver.valid(a.name);
const versionB = semver.valid(b.name);
// if both are not valid versions:
// if one is main, push that higher
// otherwise, push up the one which is alphabetically sooner
if (versionA == null && versionB == null) {
if (a.name == 'main') return -1;
return a.name.localeCompare(b.name);
}
// if one isn't valid, push the one that's valid up
if ((versionA == null) != (versionB == null))
return versionA == null ? 1 : -1;
// if A is lower, push B up
return semver.lt(versionA!, versionB!) ? 1 : -1;
if (a.isBranch !== b.isBranch) return a.isBranch ? 1 : -1;
return a.name.localeCompare(b.name);
}),
};
}, [sources, partialBoard]);
@@ -58,7 +58,7 @@ const DeviceList = ({
control,
devices,
}: {
control: Control<FirmwareUpdateForm>;
control: Control<any>;
devices: DeviceDataT[];
}) => {
const { l10n } = useLocalization();
@@ -1,97 +0,0 @@
import { useState, useEffect } from 'react';
import { Button } from '@/components/commons/Button';
import { BaseModal } from '@/components/commons/BaseModal';
import { CheckboxInternal } from '@/components/commons/Checkbox';
import { Typography } from '@/components/commons/Typography';
import { useElectron } from '@/hooks/electron';
import { useConfig } from '@/hooks/config';
import { useLocalization } from '@fluent/react';
import { useAppContext } from '@/hooks/app';
export function UdevRulesModal() {
const { config, setConfig } = useConfig();
const electron = useElectron();
const [udevContent, setUdevContent] = useState('');
const [showUdevWarning, setShowUdevWarning] = useState(false);
const [dontShowThisSession, setDontShowThisSession] = useState(false);
const [dontShowAgain, setDontShowAgain] = useState(false);
const { l10n } = useLocalization();
const { installInfo } = useAppContext();
const handleUdevContent = async () => {
if (electron.isElectron) {
const dir = await electron.api.getInstallDir();
const rulesPath = `${dir}/69-slimevr-devices.rules`;
setUdevContent(
`cat ${rulesPath} | sudo sh -c 'tee /etc/udev/rules.d/69-slimevr-devices.rules >/dev/null && udevadm control --reload-rules && udevadm trigger'`
);
}
};
useEffect(() => {
handleUdevContent();
}, []);
useEffect(() => {
if (!config) throw 'Invalid state!';
if (electron.isElectron) {
const isLinux = electron.data().os.type === 'linux';
const udevMissing = !installInfo?.isUdevInstalled;
const notHiddenGlobally = !config.dontShowUdevModal;
const notHiddenThisSession = !dontShowThisSession;
const shouldShow =
isLinux && udevMissing && notHiddenGlobally && notHiddenThisSession;
setShowUdevWarning(shouldShow);
}
}, [config, dontShowThisSession]);
const handleModalClose = () => {
if (!config) throw 'Invalid State!';
setConfig({ dontShowUdevModal: dontShowAgain });
setDontShowThisSession(true);
};
const copyToClipboard = () => {
navigator.clipboard.writeText(udevContent);
};
return (
<BaseModal isOpen={showUdevWarning} appendClasses="w-full max-w-2xl">
<div className="flex w-full h-full flex-col gap-4">
<div className="flex flex-col gap-3">
<div className="flex flex-col gap-2">
<Typography
variant="main-title"
id="install-info_udev-rules_modal_title"
/>
<Typography id="install-info_udev-rules_warning" />
</div>
<div className="relative w-full max-w-2xl">
<div className="absolute right-2 top-2">
<Button variant="secondary" onClick={copyToClipboard}>
Copy
</Button>
</div>
<div className="bg-background-80 rounded-lg overflow-auto p-2 w-full h-[300px]">
<pre className="text-wrap">{udevContent}</pre>
</div>
</div>
</div>
<div className="flex justify-between gap-2">
<CheckboxInternal
label={l10n.getString(
'install-info_udev-rules_modal-dont-show-again_checkbox'
)}
name="dismiss-udev-rules-checkbox"
onChange={(e) => setDontShowAgain(e.currentTarget.checked)}
/>
<Button
variant="primary"
onClick={handleModalClose}
id="install-info_udev-rules_modal_button"
/>
</div>
</div>
</BaseModal>
);
}
@@ -12,9 +12,9 @@
grid-template:
's t' var(--connect-tracker-layout-top)
's c' calc(100% - var(--connect-tracker-layout-top))
/ calc(var(--connect-tracker-layout-sidebar)) calc(
100% - var(--connect-tracker-layout-sidebar)
);
/ calc(var(--connect-tracker-layout-sidebar)) calc(100% - var(
--connect-tracker-layout-sidebar
));
@screen mobile {
grid-template:
@@ -26,7 +26,6 @@ import { connectedIMUTrackersAtom } from '@/store/app-store';
import { BaseModal } from '@/components/commons/BaseModal';
import { A } from '@/components/commons/A';
import { useTrackingChecklist } from '@/hooks/tracking-checklist';
import { MoreSetsConfirm } from './quiz/MoreSetsConfirm';
const statusLabelMap = {
[WifiProvisioningStatus.NONE]:
@@ -318,15 +317,13 @@ export function ConnectTrackersPage() {
? l10n.getString('onboarding-connect_tracker-back')
: l10n.getString('onboarding-previous_step')}
</Button>
{state.alonePage && (
<Button
variant="primary"
to={'/'}
className="ml-auto"
id="onboarding-connect_tracker-next"
/>
)}
{!state.alonePage && <MoreSetsConfirm />}
<Button
variant="primary"
to={state.alonePage ? '/' : '/onboarding/trackers-assign'}
className="ml-auto"
>
{l10n.getString('onboarding-connect_tracker-next')}
</Button>
</div>
</div>
<div style={{ gridArea: 't' }} className="flex items-center px-5 pt-5">
@@ -1,57 +0,0 @@
import { Localized } from '@fluent/react';
import { useOnboarding } from '@/hooks/onboarding';
import { Button } from '@/components/commons/Button';
import { Typography } from '@/components/commons/Typography';
import classNames from 'classnames';
import { USBIcon } from '@/components/commons/icon/UsbIcon';
import { WarningBox } from '@/components/commons/TipBox';
import { MoreSetsConfirm } from './quiz/MoreSetsConfirm';
export function DongleSectionContent() {
const { state } = useOnboarding();
return (
<div className="flex flex-col gap-2">
<div className="flex gap-2 items-center">
<div className="bg-accent-background-30 rounded-full p-2 fill-background-10">
<USBIcon size={24} />
</div>
<Typography
variant="main-title"
id="onboarding-wifi_creds-dongle-title"
/>
</div>
<div className={classNames('flex flex-col gap-2 flex-grow p-2')}>
<Typography
whitespace="whitespace-pre-wrap"
id="onboarding-wifi_creds-dongle-description"
/>
<Localized id="onboarding-wifi_creds-dongle-wip">
<WarningBox whitespace>WARNING</WarningBox>
</Localized>
</div>
<div className="flex px-2 p-6">
{state.alonePage && (
<Button
variant="primary"
to={'/'}
id="onboarding-wifi_creds-dongle-continue"
/>
)}
{!state.alonePage && <MoreSetsConfirm />}
</div>
</div>
);
}
export function DonglePage() {
const { applyProgress } = useOnboarding();
applyProgress(0.5);
return (
<div className="flex flex-col w-full h-full xs:justify-center items-center">
<DongleSectionContent />
</div>
);
}
@@ -1,49 +0,0 @@
import { Localized } from '@fluent/react';
import { Typography } from '@/components/commons/Typography';
import { Button } from '@/components/commons/Button';
import { useConfig } from '@/hooks/config';
export function ErrorCollectingConsentPage() {
const { setConfig } = useConfig();
const accept = () => {
setConfig({ errorTracking: true });
};
const cancel = () => {
setConfig({ errorTracking: false });
};
return (
<div className="flex items-center justify-center h-full flex-col gap-3 p-4">
<div className="max-w-2xl flex flex-col gap-4">
<div className="flex flex-col w-full gap-4">
<Typography variant="main-title" id="error_collection_modal-title" />
<Localized
id="error_collection_modal-description_v2"
elems={{
b: <b />,
h1: <span className="text-md font-bold" />,
}}
>
<Typography variant="standard" whitespace="whitespace-pre-line" />
</Localized>
</div>
<div className="flex flex-row gap-2 justify-between">
<Button
variant="tertiary"
to="/onboarding/wifi-creds"
onClick={cancel}
id="error_collection_modal-cancel"
/>
<Button
variant="primary"
to="/onboarding/wifi-creds"
onClick={accept}
id="error_collection_modal-confirm"
/>
</div>
</div>
</div>
);
}
+1 -1
View File
@@ -19,7 +19,7 @@ export function HomePage() {
<Typography variant="mobile-title">
{l10n.getString('onboarding-home')}
</Typography>
<Button variant="primary" to="/onboarding/quiz/slime-set">
<Button variant="primary" to="/onboarding/wifi-creds">
{l10n.getString('onboarding-home-start')}
</Button>
</div>
@@ -1,14 +1,16 @@
import { Localized } from '@fluent/react';
import { Localized, useLocalization } from '@fluent/react';
import { useOnboarding } from '@/hooks/onboarding';
import { useWifiForm } from '@/hooks/wifi-form';
import { Button } from '@/components/commons/Button';
import { Input } from '@/components/commons/Input';
import { Typography } from '@/components/commons/Typography';
import classNames from 'classnames';
import { USBIcon } from '@/components/commons/icon/UsbIcon';
import { WifiIcon } from '@/components/commons/icon/WifiIcon';
import { DongleSectionContent } from './Dongle';
import { WarningBox } from '@/components/commons/TipBox';
export function WifiCredsPage() {
const { l10n } = useLocalization();
const { applyProgress, state } = useOnboarding();
const { control, handleSubmit, submitWifiCreds, formState } = useWifiForm();
@@ -16,12 +18,34 @@ export function WifiCredsPage() {
return (
<div className="flex flex-col w-full h-full xs:justify-center items-center">
<div
className={classNames('grid gap-4 max-w-6xl p-4', {
'xs:grid-cols-2': state.alonePage,
})}
>
{state.alonePage && <DongleSectionContent />}
<div className="grid xs:grid-cols-2 gap-4 max-w-6xl p-4">
<div className="flex flex-col gap-2">
<div className="flex gap-2 items-center">
<div className="bg-accent-background-30 rounded-full p-2 fill-background-10">
<USBIcon size={24} />
</div>
<Typography
variant="main-title"
id="onboarding-wifi_creds-dongle-title"
/>
</div>
<div className={classNames('flex flex-col gap-2 flex-grow p-2')}>
<Typography
whitespace="whitespace-pre-wrap"
id="onboarding-wifi_creds-dongle-description"
/>
<Localized id="onboarding-wifi_creds-dongle-wip">
<WarningBox whitespace>WARNING</WarningBox>
</Localized>
</div>
<div className="flex px-2 p-6">
<Button
variant="primary"
to={state.alonePage ? '/' : '/onboarding/trackers-assign'}
id="onboarding-wifi_creds-dongle-continue"
/>
</div>
</div>
<form
className="flex flex-col gap-2"
onSubmit={handleSubmit(submitWifiCreds)}
@@ -81,22 +105,21 @@ export function WifiCredsPage() {
/>
</Localized>
<div className="flex flex-row gap-3 justify-between">
{!state.alonePage ? (
<Button
variant="secondary"
state={{ alonePage: state.alonePage }}
to={'/onboarding/quiz/slime-set'}
id="onboarding-wifi_creds-back-v2"
/>
) : (
<div />
)}
<Button
variant="secondary"
className={state.alonePage ? 'opacity-0' : ''}
state={{ alonePage: state.alonePage }}
to={'/onboarding/trackers-assign'}
>
{l10n.getString('onboarding-wifi_creds-skip')}
</Button>
<Button
type="submit"
variant="primary"
disabled={!formState.isValid}
id="onboarding-wifi_creds-submit"
/>
>
{l10n.getString('onboarding-wifi_creds-submit')}
</Button>
</div>
</div>
</div>
@@ -185,10 +185,6 @@ function ImportExportButtons() {
parseConfigImport(config).forEach((req) =>
sendRPCPacket(RpcMessage.ChangeSkeletonConfigRequest, req)
);
sendRPCPacket(
RpcMessage.SkeletonConfigRequest,
new SkeletonConfigRequestT()
);
setImportState(ImportStatus.SUCCESS);
setTimeout(() => {
setImportState(ImportStatus.OK);
@@ -478,7 +478,7 @@ export function ScaledProportionsPage() {
<Button
variant="primary"
id="onboarding-user_height-next_step"
to="/onboarding/quiz/usage"
to="/"
/>
)}
</div>
@@ -23,7 +23,7 @@ export function AutomaticMountingPage() {
const { l10n } = useLocalization();
const { applyProgress, state } = useOnboarding();
applyProgress(0.6);
applyProgress(0.7);
return (
<>
@@ -28,7 +28,7 @@ export function ManualMountingPage() {
const [selectedRole, setSelectRole] = useState<BodyPart>(BodyPart.NONE);
applyProgress(0.6);
applyProgress(0.7);
const assignedTrackers = useAtomValue(assignedTrackersAtom);
@@ -13,7 +13,7 @@ export function MountingChoose() {
const [animated, setAnimated] = useState(false);
const [showWarning, setShowWarning] = useState(false);
applyProgress(0.55);
applyProgress(0.65);
return (
<>
@@ -1,155 +0,0 @@
import { useOnboarding } from '@/hooks/onboarding';
import { Typography } from '@/components/commons/Typography';
import { Button } from '@/components/commons/Button';
import { HumanIcon } from '@/components/commons/icon/HumanIcon';
import { HeadsetIcon } from '@/components/commons/icon/HeadsetIcon';
import { useState } from 'react';
import { SittingIcon } from '@/components/commons/icon/SittingIcon';
import { VMCFileUpload } from '@/components/settings/pages/VMCSettings';
import { QuizButton } from './SlimeSetQuestion';
export function QuizMocapPosQuestion() {
const { applyProgress, setMocapPos, mocapPos, playspace, setPlayspace } =
useOnboarding();
const [headTracker, setHeadTracker] = useState(true);
applyProgress(0.9);
const canContinue = (!headTracker || mocapPos) && playspace;
return (
<div className="grid w-full h-full justify-center items-center">
<div className="flex flex-col gap-8 max-w-xl p-2">
<div className="flex flex-col gap-2">
<Typography
variant="main-title"
id="onboarding-quiz-mocap_preferences-title"
/>
<Typography
whitespace="whitespace-pre-wrap"
id="onboarding-quiz-mocap_preferences-desc"
/>
</div>
<div className="flex flex-col gap-6">
<div className="flex gap-2 flex-col">
<div className="flex flex-col gap-2">
<Typography
variant="section-title"
id="onboarding-quiz-mocap_preferences-head_tracker-title"
/>
</div>
<div className="grid grid-cols-2 gap-4">
<QuizButton
active={headTracker}
onClick={() => setHeadTracker(true)}
icon={<HeadsetIcon width={50} />}
name="onboarding-quiz-mocap_preferences-head_tracker-yes"
/>
<QuizButton
active={!headTracker}
onClick={() => {
setHeadTracker(false);
setMocapPos(undefined);
}}
icon={<HeadsetIcon width={50} disabled />}
name="onboarding-quiz-mocap_preferences-head_tracker-no"
/>
</div>
</div>
</div>
<div className="flex flex-col gap-6">
<div className="flex gap-2 flex-col">
<div className="flex flex-col gap-2">
<Typography
variant="section-title"
id="onboarding-quiz-mocap_preferences-vrm_model-title"
/>
<Typography id="onboarding-quiz-mocap_preferences-vrm_model-desc" />
</div>
<VMCFileUpload />
</div>
</div>
{headTracker && (
<>
<div className="flex flex-col gap-6">
<div className="flex gap-2 flex-col">
<div className="flex flex-col gap-2">
<Typography
variant="section-title"
id="onboarding-quiz-mocap_preferences-playspace-title"
/>
<Typography id="onboarding-quiz-mocap_preferences-playspace-desc" />
</div>
<div className="grid grid-cols-2 gap-4">
<QuizButton
active={playspace === 'sitting'}
onClick={() => setPlayspace('sitting')}
icon={<SittingIcon size={50} />}
name="onboarding-quiz-mocap_preferences-playspace-sitting"
/>
<QuizButton
active={playspace === 'standing'}
onClick={() => setPlayspace('standing')}
icon={<HumanIcon width={50} />}
name="onboarding-quiz-mocap_preferences-playspace-standing"
/>
</div>
</div>
</div>
<div className="flex flex-col gap-6">
<div className="flex gap-2 flex-col">
<div className="flex flex-col gap-2">
<Typography
variant="section-title"
id="onboarding-quiz-mocap_preferences-head_tracker_location-title"
/>
</div>
<div className="grid grid-cols-2 gap-4">
<QuizButton
active={mocapPos === 'forehead'}
onClick={() => setMocapPos('forehead')}
icon={
<img
src="/images/quiz/quiz_mocap-pos_forehead.webp"
className="w-44"
/>
}
name="onboarding-quiz-mocap_preferences-head_tracker_location-forehead"
/>
<QuizButton
active={mocapPos === 'face'}
onClick={() => setMocapPos('face')}
icon={
<img
src="/images/quiz/quiz_mocap-pos_face.webp"
className="w-44"
/>
}
name="onboarding-quiz-mocap_preferences-head_tracker_location-face"
/>
</div>
</div>
</div>
</>
)}
<div className="flex justify-between pb-4">
<Button
variant="secondary"
id="onboarding-quiz_back"
to="/onboarding/quiz/usage"
/>
<Button
variant="primary"
id="onboarding-quiz_continue"
disabled={!canContinue}
to="/"
/>
</div>
</div>
</div>
);
}
@@ -1,30 +0,0 @@
import { ButtonConfirmModal } from '@/components/commons/ButtonConfirmModal';
import { Typography } from '@/components/commons/Typography';
import { useNavigate } from 'react-router-dom';
export function MoreSetsConfirm() {
const navigate = useNavigate();
return (
<ButtonConfirmModal
variant="primary"
className="ml-auto"
id="onboarding-connect_tracker-next"
cancelLabel="onboarding-quiz-more_sets_modal-cancel"
confirmLabel="onboarding-quiz-more_sets_modal-confirm"
onConfirm={() => navigate('/onboarding/trackers-assign')}
onCancel={(reason) => {
if (reason === 'cancel') navigate('/onboarding/quiz/slime-set');
}}
>
<Typography
variant="main-title"
id="onboarding-quiz-more_sets_modal-title"
/>
<Typography
variant="vr-accessible"
id="onboarding-quiz-more_sets_modal-desc"
/>
</ButtonConfirmModal>
);
}
@@ -1,55 +0,0 @@
import { useOnboarding } from '@/hooks/onboarding';
import { Typography } from '@/components/commons/Typography';
import { QuizButton } from './SlimeSetQuestion';
import { SteamIcon } from '@/components/commons/icon/SteamIcon';
import { HeadsetIcon } from '@/components/commons/icon/HeadsetIcon';
import { useNavigate } from 'react-router-dom';
import { Button } from '@/components/commons/Button';
export function QuizRuntimeQuestion() {
const { applyProgress, setVrcOSC, vrcOsc } = useOnboarding();
const nav = useNavigate();
applyProgress(0.9);
const next = (type: typeof vrcOsc) => {
setVrcOSC(type);
nav('/');
};
return (
<div className="grid w-full h-full justify-center items-center">
<div className="flex flex-col gap-8 max-w-xl p-2">
<div className="flex flex-col gap-2">
<Typography variant="main-title" id="onboarding-quiz-runtime-title" />
</div>
<div className="flex flex-col gap-6">
<div className="flex gap-2 flex-col">
<div className="grid grid-cols-2 gap-4">
<QuizButton
active={!vrcOsc}
onClick={() => next(false)}
icon={<SteamIcon size={50} />}
name="onboarding-quiz-runtime-answer-steamvr"
/>
<QuizButton
active={vrcOsc}
onClick={() => next(true)}
icon={<HeadsetIcon width={80} />}
name="onboarding-quiz-runtime-answer-standalone"
/>
</div>
</div>
</div>
<div className="flex">
<Button
to={'/onboarding/quiz/usage'}
variant="secondary"
id="onboarding-quiz_back"
/>
</div>
</div>
</div>
);
}
@@ -1,136 +0,0 @@
import { useOnboarding } from '@/hooks/onboarding';
import { ReactNode } from 'react';
import { Typography } from '@/components/commons/Typography';
import classNames from 'classnames';
import { USBIcon } from '@/components/commons/icon/UsbIcon';
import { useNavigate } from 'react-router-dom';
export function QuizButton({
name,
active,
icon,
onClick,
}: {
active?: boolean;
name: string;
icon: ReactNode;
onClick: () => void;
}) {
return (
<div
onClick={onClick}
className={classNames(
'flex rounded-lg bg-background-60 hover:bg-background-50 cursor-pointer',
'p-4 outline outline-2 flex-col gap-4 items-center justify-between fill-background-20',
{
'outline-accent-background-30': active,
'outline-transparent': !active,
}
)}
>
{icon}
<Typography id={name} variant="section-title" />
</div>
);
}
export function QuizSlimeSetQuestion() {
const { applyProgress, setSlimeSet, slimeSet } = useOnboarding();
const nav = useNavigate();
applyProgress(0.2);
const next = (type: typeof slimeSet) => {
setSlimeSet(type);
switch (type) {
case 'butterfly':
case 'dongle-slime':
nav('/onboarding/dongle');
break;
case 'slime-v1':
case 'wifi-slime':
nav('/onboarding/wifi-creds');
break;
}
};
return (
<div className="grid w-full h-full justify-center items-center">
<div className="flex flex-col gap-8 max-w-xl p-2">
<div className="flex flex-col gap-2">
<Typography
variant="main-title"
id="onboarding-quiz-slimeset-title"
/>
<Typography id="onboarding-quiz-slimeset-description" />
</div>
<div className="flex flex-col gap-6">
<div className="flex gap-2 flex-col">
<Typography
variant="section-title"
id="onboarding-quiz-slimeset-official-sets"
/>
<div className="grid grid-cols-2 gap-4">
<QuizButton
active={slimeSet === 'slime-v1'}
onClick={() => next('slime-v1')}
icon={
<img
src="/images/trackers/v1_2_slime.webp"
className="w-60"
/>
}
name="onboarding-quiz-slimeset-answer-regular"
/>
<QuizButton
active={slimeSet === 'butterfly'}
onClick={() => next('butterfly')}
icon={
<img
src="/images/trackers/butterfly_slime.webp"
className="w-60"
/>
}
name="onboarding-quiz-slimeset-answer-butterfly"
/>
</div>
</div>
<div className="flex gap-2 flex-col">
<Typography
variant="section-title"
id="onboarding-quiz-slimeset-thirdparty-sets"
/>
<div className="grid grid-cols-2 gap-4">
<QuizButton
onClick={() => next('wifi-slime')}
icon={
<svg
xmlns="http://www.w3.org/2000/svg"
height="50"
viewBox="0 0 24 24"
width="50"
className="fill-background-20"
>
<path d="M0 0h24v24H0z" fill="none" />
<path d="M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z" />
</svg>
}
name="onboarding-quiz-slimeset-answer-wifi"
/>
<QuizButton
onClick={() => next('dongle-slime')}
icon={
<div className="fill-background-20">
<USBIcon size={50} />
</div>
}
name="onboarding-quiz-slimeset-answer-dongle"
/>
</div>
</div>
</div>
</div>
</div>
);
}
@@ -1,62 +0,0 @@
import { useOnboarding } from '@/hooks/onboarding';
import { Typography } from '@/components/commons/Typography';
import { Button } from '@/components/commons/Button';
import { QuizButton } from './SlimeSetQuestion';
import { useNavigate } from 'react-router-dom';
import { HeadsetIcon } from '@/components/commons/icon/HeadsetIcon';
import { HumanIcon } from '@/components/commons/icon/HumanIcon';
export function QuizUsageQuestion() {
const { applyProgress, setUsage, usage } = useOnboarding();
const nav = useNavigate();
applyProgress(0.8);
const next = (type: typeof usage) => {
setUsage(type);
if (type === 'vr-gaming') {
if (window.__ANDROID__) {
nav('/');
} else {
nav('/onboarding/quiz/runtime');
}
} else nav('/onboarding/quiz/mocap-pos');
};
return (
<div className="grid w-full h-full justify-center items-center">
<div className="flex flex-col gap-8 max-w-xl p-2">
<div className="flex flex-col gap-2">
<Typography variant="main-title" id="onboarding-quiz-usage-title" />
<Typography
whitespace="whitespace-pre-wrap"
id="onboarding-quiz-usage-description"
/>
</div>
<div className="flex flex-col gap-6">
<div className="grid grid-cols-2 gap-4">
<QuizButton
active={usage === 'vr-gaming'}
icon={<HeadsetIcon width={50} />}
name="onboarding-quiz-usage-answer-VRC"
onClick={() => next('vr-gaming')}
/>
<QuizButton
active={usage === 'mocap'}
icon={<HumanIcon width={50} />}
name="onboarding-quiz-usage-answer-mocap_vtubing"
onClick={() => next('mocap')}
/>
</div>
</div>
<div className="flex">
<Button
to={'/onboarding/quiz/slime-set'}
variant="secondary"
id="onboarding-quiz_back"
/>
</div>
</div>
</div>
);
}
@@ -11,7 +11,6 @@ import { ResetType } from 'solarxr-protocol';
export function PreparationStep({
nextStep,
prevStep,
isActive,
}: VerticalStepComponentProps) {
return (
<div className="flex flex-col flex-grow justify-between py-2 gap-2">
@@ -54,14 +53,7 @@ export function PreparationStep({
<Button variant={'secondary'} onClick={prevStep} />
</Localized>
<ResetButton
type={ResetType.Full}
onReseted={() => {
if (isActive) {
nextStep();
}
}}
/>
<ResetButton type={ResetType.Full} onReseted={nextStep} />
</div>
</div>
);
@@ -10,7 +10,6 @@ import { ManualMountingPageStayAligned } from '@/components/onboarding/pages/mou
export function VerifyMountingStep({
nextStep,
prevStep,
isActive,
}: VerticalStepComponentProps) {
const { isMobile } = useBreakpoint('mobile');
const [isOpen, setOpen] = useState(false);
@@ -80,11 +79,7 @@ export function VerifyMountingStep({
onClick={() => setDisableMounting(true)}
type={ResetType.Mounting}
group="default"
onReseted={() => {
if (isActive) {
nextStep();
}
}}
onReseted={goNextStep}
onFailed={() => setDisableMounting(false)}
/>
</div>
@@ -55,7 +55,7 @@ export function TrackersAssignPage() {
const { isMd } = useBreakpoint('md');
const { l10n } = useLocalization();
const { config, setConfig } = useConfig();
const { applyProgress, state, slimeSet } = useOnboarding();
const { applyProgress, state } = useOnboarding();
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
const defaultValues = {
mirrorView: config?.mirrorView ?? defaultConfig.mirrorView,
@@ -329,24 +329,9 @@ export function TrackersAssignPage() {
<div className="flex flex-row">
{!state.alonePage && (
<>
{state.alonePage && (
<Button variant="secondary" to="/onboarding/wifi-creds">
{l10n.getString('onboarding-previous_step')}
</Button>
)}
{!state.alonePage && (
<Button
variant="secondary"
to={
slimeSet &&
['butterfly', 'dongle-slime'].includes(slimeSet)
? '/onboarding/dongle'
: '/onboarding/wifi-creds'
}
>
{l10n.getString('onboarding-previous_step')}
</Button>
)}
<Button variant="secondary" to="/onboarding/wifi-creds">
{l10n.getString('onboarding-previous_step')}
</Button>
<Button
variant="primary"
to="/onboarding/mounting/choose"
@@ -7,9 +7,9 @@
grid-template:
't t t' var(--topbar-h)
'n s c' calc(100% - var(--topbar-h))
/ var(--navbar-w) var(--settings-sidebar-w) calc(
100% - var(--navbar-w) - var(--settings-sidebar-w)
);
/ var(--navbar-w) var(--settings-sidebar-w) calc(100% - var(--navbar-w) - var(
--settings-sidebar-w
));
@screen lg {
--settings-sidebar-w: 270px;
@@ -58,10 +58,6 @@ export function SettingSelectorMobile() {
label: l10n.getString('settings-sidebar-advanced'),
value: { url: '/settings/advanced' },
},
{
label: l10n.getString('settings-sidebar-keybinds'),
value: { url: '/settings/keybinds' },
},
{
label: l10n.getString('navbar-onboarding'),
value: { url: '/onboarding/home' },
@@ -73,13 +73,6 @@ export function SettingsSidebar() {
scrollTo="gestureControl"
id="settings-sidebar-gesture_control"
/>
{
<SettingsLink
to="/settings/keybinds"
scrollTo="keybinds"
id="settings-sidebar-keybinds"
/>
}
</div>
</div>
<div className="flex flex-col gap-3">
@@ -43,9 +43,6 @@ import {
loadResetSettings,
ResetSettingsForm,
} from '@/hooks/reset-settings';
import { atom, useAtomValue, useSetAtom } from 'jotai';
import { isEqual } from '@react-hookz/deep-equal';
import { selectAtom } from 'jotai/utils';
export type SettingsForm = {
trackers: {
@@ -166,16 +163,7 @@ const defaultValues: SettingsForm = {
hidSettings: { trackersOverHID: false },
};
const settingsAtom = atom(new SettingsResponseT());
const settingsValueAtom = selectAtom(
settingsAtom,
(settings) => settings,
isEqual
);
export function GeneralSettings() {
const setSettings = useSetAtom(settingsAtom);
const settings = useAtomValue(settingsValueAtom);
const { l10n } = useLocalization();
const { config } = useConfig();
const { currentLocales } = useLocaleConfig();
@@ -195,10 +183,7 @@ export function GeneralSettings() {
const { reset, control, watch, handleSubmit, getValues, setValue } =
useForm<SettingsForm>({
defaultValues,
mode: 'onChange',
reValidateMode: 'onChange',
});
const {
trackers: {
automaticTrackerToggle,
@@ -317,7 +302,10 @@ export function GeneralSettings() {
sendRPCPacket(RpcMessage.SettingsRequest, new SettingsRequestT());
}, []);
useEffect(() => {
// If null, we still haven't shown the hands warning
// if false then initially the hands warning was disabled
const [handsWarning, setHandsWarning] = useState<boolean | null>(null);
useRPCPacket(RpcMessage.SettingsResponse, (settings: SettingsResponseT) => {
const formData: DefaultValues<SettingsForm> = {};
if (settings.filtering) {
@@ -420,13 +408,6 @@ export function GeneralSettings() {
}
reset({ ...getValues(), ...formData });
}, [settings]);
// If null, we still haven't shown the hands warning
// if false then initially the hands warning was disabled
const [handsWarning, setHandsWarning] = useState<boolean | null>(null);
useRPCPacket(RpcMessage.SettingsResponse, (settings: SettingsResponseT) => {
setSettings(settings);
});
useEffect(() => {
@@ -440,6 +421,18 @@ export function GeneralSettings() {
}
}, [steamVrLeftHand, steamVrRightHand, handsWarning]);
// Handle scrolling to selected page
// useEffect(() => {
// const typedState: { scrollTo: string } = state as any;
// if (!pageRef.current || !typedState || !typedState.scrollTo) {
// return;
// }
// const elem = pageRef.current.querySelector(`#${typedState.scrollTo}`);
// if (elem) {
// elem.scrollIntoView({ behavior: 'smooth' });
// }
// }, [state]);
return (
<SettingsPageLayout>
<HandsWarningModal
@@ -1151,31 +1144,32 @@ export function GeneralSettings() {
/>
</div>
</div>
<div className="flex flex-col pt-2 pb-3">
<Typography variant="section-title">
{l10n.getString(
'settings-general-fk_settings-self_localization-title'
)}
</Typography>
<Typography>
{l10n.getString(
'settings-general-fk_settings-self_localization-description'
)}
</Typography>
</div>
<div className="grid sm:grid-cols-1 gap3 pb5">
<CheckBox
variant="toggle"
outlined
control={control}
name="toggles.selfLocalization"
label={l10n.getString(
'settings-general-fk_settings-self_localization-title'
)}
/>
</div>
</>
)}
<div className="flex flex-col pt-2 pb-3">
<Typography variant="section-title">
{l10n.getString(
'settings-general-fk_settings-self_localization-title'
)}
</Typography>
<Typography>
{l10n.getString(
'settings-general-fk_settings-self_localization-description'
)}
</Typography>
</div>
<div className="grid sm:grid-cols-1 gap3 pb5">
<CheckBox
variant="toggle"
outlined
control={control}
name="toggles.selfLocalization"
label={l10n.getString(
'settings-general-fk_settings-self_localization-title'
)}
/>
</div>
</>
</SettingsPagePaneLayout>
@@ -14,7 +14,7 @@ import {
import { useLocalization } from '@fluent/react';
import classNames from 'classnames';
import { ReactNode, useEffect } from 'react';
import { FieldPath, useForm } from 'react-hook-form';
import { useForm } from 'react-hook-form';
import { TrackingChecklistStepId } from 'solarxr-protocol';
import * as Sentry from '@sentry/react';
@@ -82,7 +82,7 @@ export function TrackingChecklistSettings({
<div key={step.id}>
<CheckBox
control={control}
name={`steps.${step.id}` as FieldPath<StepsForm>}
name={`steps.${step.id}`}
disabled={!step.ignorable || !step.enabled}
label={l10n.getString(trackingchecklistIdtoLabel[step.id])}
outlined
@@ -1,15 +0,0 @@
.keybind-settings {
display: grid;
grid-template:
'n v d ' auto
'k k k ' auto
'b . . ' auto
/ 1fr 1fr 90px;
grid-template-columns: subgrid;
grid-template-rows: subgrid;
align-items: left;
gap: 10px;
}
@@ -1,269 +0,0 @@
import { KeybindRecorderModal } from '@/components/commons/KeybindRecorderModal';
import {
SettingsPageLayout,
SettingsPagePaneLayout,
} from '@/components/settings/SettingsPageLayout';
import { WrenchIcon } from '@/components/commons/icon/WrenchIcons';
import { Typography } from '@/components/commons/Typography';
import { useLocalization } from '@fluent/react';
import './KeybindSettings.scss';
import { Button } from '@/components/commons/Button';
import { KeybindsRow } from '@/components/commons/KeybindsRow';
import { useWebsocketAPI } from '@/hooks/websocket-api';
import { ReactNode, useEffect, useRef, useState } from 'react';
import {
ChangeKeybindRequestT,
KeybindRequestT,
KeybindResponseT,
KeybindT,
OpenUriRequestT,
RpcMessage,
} from 'solarxr-protocol';
import {
FieldPath,
FormProvider,
useFieldArray,
useForm,
} from 'react-hook-form';
import { useAppContext } from '@/hooks/app';
import { useElectron } from '@/hooks/electron';
export type KeybindForm = {
keybinds: {
id: number;
name: string;
binding: string[];
delay: number;
}[];
};
export function KeybindSettings() {
const electron = useElectron();
const { l10n } = useLocalization();
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
const [isOpen, setIsOpen] = useState<boolean>(false);
const [defaultKeybindsState, setDefaultKeybindsState] = useState<KeybindForm>(
{
keybinds: [],
}
);
const currentIndex = useRef<number | null>(null);
const { installInfo } = useAppContext();
const methods = useForm<KeybindForm>({
defaultValues: defaultKeybindsState,
});
const {
control,
handleSubmit,
reset,
setValue,
getValues,
setError,
clearErrors,
resetField,
} = methods;
const { fields } = useFieldArray({
control,
name: 'keybinds',
});
const onSubmit = () => {
const value = getValues();
if (checkDuplicates(value)) {
return;
}
clearErrors('keybinds');
value.keybinds.forEach((kb) => {
const changeKeybindRequest = new ChangeKeybindRequestT();
const keybind = new KeybindT();
keybind.keybindId = kb.id;
keybind.keybindNameId = kb.name;
keybind.keybindValue = kb.binding.join('+');
keybind.keybindDelay = kb.delay;
changeKeybindRequest.keybind = keybind;
sendRPCPacket(RpcMessage.ChangeKeybindRequest, changeKeybindRequest);
setIsOpen(false);
});
};
const checkDuplicates = (value: KeybindForm) => {
const normalized = value.keybinds
.filter((kb) => kb.binding.length > 0)
.map((kb) => JSON.stringify([...kb.binding].sort()));
const unique = new Set(normalized);
if (unique.size !== normalized.length) {
setError('keybinds', {
type: 'manual',
message: 'Duplicate keybind combinations are not allowed',
});
return true;
}
return false;
};
const handleOpenSystemSettingsButton = () => {
sendRPCPacket(RpcMessage.OpenUriRequest, new OpenUriRequestT());
};
useRPCPacket(
RpcMessage.KeybindResponse,
({ keybind, defaultKeybinds }: KeybindResponseT) => {
if (!keybind) return;
const mappedDefaults = defaultKeybinds.map((kb) => ({
id: kb.keybindId,
name: typeof kb.keybindNameId === 'string' ? kb.keybindNameId : '',
binding:
typeof kb.keybindValue === 'string' ? kb.keybindValue.split('+') : [],
delay: kb.keybindDelay,
}));
setDefaultKeybindsState({ keybinds: mappedDefaults });
reset({ keybinds: mappedDefaults });
const mapped = keybind.map((kb) => ({
id: kb.keybindId,
name: typeof kb.keybindNameId === 'string' ? kb.keybindNameId : '',
binding:
typeof kb.keybindValue === 'string' ? kb.keybindValue.split('+') : [],
delay: kb.keybindDelay,
}));
mapped.forEach((keybind, index) => {
setValue(`keybinds.${index}.binding`, keybind.binding);
setValue(`keybinds.${index}.delay`, keybind.delay);
});
}
);
const handleOpenRecorderModal = (index: number) => {
currentIndex.current = index;
if (currentIndex !== null) {
setIsOpen(true);
}
};
const onClose = () => {
if (currentIndex.current != null) {
resetField(`keybinds.${currentIndex.current}.binding`);
}
setIsOpen(false);
};
const createKeybindRows = (): ReactNode => {
return fields.map((field, index) => {
return (
<div className="keybind-row" key={index}>
<KeybindsRow
id={typeof field.name === 'string' ? field.name : ''}
control={control}
index={index}
getValue={getValues}
openKeybindRecorderModal={handleOpenRecorderModal}
/>
</div>
);
});
};
useEffect(() => {
sendRPCPacket(RpcMessage.KeybindRequest, new KeybindRequestT());
}, []);
return (
<SettingsPageLayout>
<SettingsPagePaneLayout icon={<WrenchIcon />} id="keybinds">
<div className="flex flex-col gap-2">
<Typography variant="main-title" id="settings-keybinds" />
<div className="flex flex-col pt-2 pb-4">
{l10n
.getString('settings-keybinds-description')
.split('\n')
.map((line, i) => (
<Typography key={i}>{line}</Typography>
))}
</div>
{!installInfo?.isWayland ? (
<div className="flex flex-col gap-4">
<Typography id="settings-keybinds-wayland-description" />
<div>
<Button
id="settings-keybinds-wayland-open-system-settings-button"
className="flex flex-col"
onClick={handleOpenSystemSettingsButton}
variant="primary"
/>
</div>
</div>
) : (
electron.isElectron &&
electron.data().os.type !== 'windows' && (
<>
<FormProvider {...methods}>
<div className="keybind-settings">
<Typography
id="keybind_config-keybind_name"
variant="section-title"
/>
<Typography
id="keybind_config-keybind_value"
variant="section-title"
/>
<Typography
id="keybind_config-keybind_delay"
variant="section-title"
/>
{createKeybindRows()}
</div>
<div className="flex justify-end">
<Button
id="settings-keybinds_reset-all-button"
onClick={() => {
reset(defaultKeybindsState);
handleSubmit(onSubmit)();
}}
variant="primary"
/>
</div>
<KeybindRecorderModal
id={
currentIndex.current != null
? fields[currentIndex.current].name
: ''
}
control={control}
name={
(currentIndex.current != null
? `keybinds.${currentIndex.current}.binding`
: '') as FieldPath<KeybindForm>
}
isVisisble={isOpen}
onClose={onClose}
onUnbind={() => {
if (currentIndex.current != null)
setValue(
`keybinds.${currentIndex.current}.binding`,
[]
);
}}
onSubmit={onSubmit}
/>
</FormProvider>
</>
)
)}
</div>
</SettingsPagePaneLayout>
</SettingsPageLayout>
);
}
+41 -108
View File
@@ -31,6 +31,7 @@ import { boolean, object } from 'yup';
interface VMCSettingsForm {
vmc: {
oscSettings: OSCSettings;
vrmJson?: FileList;
anchorHip: boolean;
mirrorTracking: boolean;
};
@@ -49,92 +50,10 @@ const defaultValues = {
},
};
export function VMCFileUpload() {
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
const { l10n } = useLocalization();
const [modelName, setModelName] = useState<string | null>(null);
const [settings, setSettings] = useState<SettingsResponseT>();
const { control, watch } = useForm<{
vrmJson?: FileList;
}>({
defaultValues: { vrmJson: undefined },
reValidateMode: 'onChange',
mode: 'onChange',
});
const vrmJson = watch('vrmJson');
const updateVRMJson = async () => {
if (!settings?.vmcOsc) return;
const req = new ChangeSettingsRequestT();
const vmcOsc = new VMCOSCSettingsT();
vmcOsc.oscSettings = Object.assign(
new OSCSettingsT(),
settings.vmcOsc.oscSettings
);
if (vrmJson !== undefined) {
if (vrmJson.length > 0) {
const file = await parseVRMFile(vrmJson[0]);
if (file) {
vmcOsc.vrmJson = file.json;
setModelName(file.name);
}
} else {
vmcOsc.vrmJson = '';
setModelName(null);
}
}
req.vmcOsc = vmcOsc;
sendRPCPacket(RpcMessage.ChangeSettingsRequest, req);
};
useEffect(() => {
updateVRMJson();
}, [vrmJson]);
useEffect(() => {
sendRPCPacket(RpcMessage.SettingsRequest, new SettingsRequestT());
}, []);
useRPCPacket(RpcMessage.SettingsResponse, (settings: SettingsResponseT) => {
setSettings(settings);
const vrmJson = settings.vmcOsc?.vrmJson?.toString();
if (vrmJson) {
let data: any;
try {
data = JSON.parse(vrmJson);
setModelName(getVRMName(data) || '');
} catch (e) {
error('Failed to fetch VRM name: ' + e);
}
}
});
return (
<FileInput
control={control}
name="vrmJson"
rules={{
required: false,
}}
value="help"
importedFileName={
// if modelname is an empty string, it's an untitled model
modelName === ''
? l10n.getString('settings-osc-vmc-vrm-untitled_model')
: modelName
}
label="settings-osc-vmc-vrm-file_select"
accept="model/gltf-binary, model/gltf+json, model/vrml, .vrm, .glb, .gltf"
/>
);
}
export function VMCSettings() {
const { l10n } = useLocalization();
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
const [modelName, setModelName] = useState<string | null>(null);
const { oscValidator } = useOscSettingsValidator();
const { reset, control, watch, handleSubmit } = useForm<VMCSettingsForm>({
@@ -162,6 +81,18 @@ export function VMCSettings() {
new OSCSettingsT(),
values.vmc.oscSettings
);
if (values.vmc.vrmJson !== undefined) {
if (values.vmc.vrmJson.length > 0) {
const file = await parseVRMFile(values.vmc.vrmJson[0]);
if (file) {
vmcOsc.vrmJson = file.json;
setModelName(file.name);
}
} else {
vmcOsc.vrmJson = '';
setModelName(null);
}
}
vmcOsc.anchorHip = values.vmc.anchorHip;
vmcOsc.mirrorTracking = values.vmc.mirrorTracking;
@@ -193,6 +124,10 @@ export function VMCSettings() {
formData.vmc.oscSettings.address =
settings.vmcOsc.oscSettings.address.toString();
}
const vrmJson = settings.vmcOsc.vrmJson?.toString();
if (vrmJson) {
setModelName(getVRMName(vrmJson) || '');
}
formData.vmc.anchorHip = settings.vmcOsc.anchorHip;
formData.vmc.mirrorTracking = settings.vmcOsc.mirrorTracking;
@@ -303,7 +238,23 @@ export function VMCSettings() {
</Typography>
</div>
<div className="grid gap-3 pb-5">
<VMCFileUpload />
<FileInput
control={control}
name="vmc.vrmJson"
rules={{
required: false,
}}
value="help"
importedFileName={
// if modelname is an empty string, it's an untitled model
modelName === ''
? l10n.getString('settings-osc-vmc-vrm-untitled_model')
: modelName
}
label="settings-osc-vmc-vrm-file_select"
accept="model/gltf-binary, model/gltf+json, model/vrml, .vrm, .glb, .gltf"
/>
{/* For some reason, linux (GNOME) is detecting the VRM file is a VRML */}
</div>
<Typography variant="section-title">
{l10n.getString('settings-osc-vmc-anchor_hip')}
@@ -393,34 +344,16 @@ async function parseVRMFile(
.slice(gltfHeaderEnd, gltfHeaderEnd + jsonLength, 'application/json')
.text();
let data: any;
try {
data = JSON.parse(json);
} catch (e) {
error('Failed to parse VRM glTF header: ' + e);
return null;
}
const name = getVRMName(data);
const name = getVRMName(json);
if (name === null) return null;
// Only keep the fields we care about
/* eslint-disable camelcase */
const vrmJson = {
extensions: {
vrmV0: data.extensions.vrmV0,
VRMC_vrm: data.extensions.VRMC_vrm,
},
extensionsUsed: data.extensionsUsed,
nodes: data.nodes,
};
/* eslint-enable camelcase */
return { json: JSON.stringify(vrmJson), name };
return { json, name };
}
function getVRMName(data: any): string | null {
function getVRMName(json: string): string | null {
try {
const data = JSON.parse(json);
if (typeof data?.extensions?.VRMC_vrm?.specVersion === 'string') {
const name = data.extensions.VRMC_vrm.meta.name;
@@ -436,7 +369,7 @@ function getVRMName(data: any): string | null {
return data?.extensions?.VRM?.meta?.title || '';
}
} catch (e) {
error('Failed to fetch VRM name: ' + e);
error(e);
return null;
}
}
@@ -13,9 +13,7 @@ export function TrackerBattery({
textColor = 'primary',
}: {
/**
* Normally [0, 1] value range
* Values >1 indicate fully charged
* Values <0 or >2 (Byte was cast to UByte, so -1 -> 255) also indicate 0%
* a [0, 1] value range is expected
*/
value: number;
voltage?: number | null;
@@ -38,13 +36,11 @@ export function TrackerBattery({
const debug = config?.debug || config?.devSettings.moreInfo;
const showVoltage = moreInfo && voltage && debug;
const pct = value > 2 ? 0 : Math.min(Math.max(value, 0), 1);
return (
<Tooltip
disabled={charging || !runtime || debug}
preferedDirection="left"
content=<Typography>{percentFormatter.format(pct)}</Typography>
content=<Typography>{percentFormatter.format(value)}</Typography>
>
<div className="flex gap-2">
<div className="flex flex-col justify-around">
@@ -65,7 +61,7 @@ export function TrackerBattery({
)}
{!charging && (!runtime || debug) && (
<Typography color={textColor}>
{percentFormatter.format(pct)}
{percentFormatter.format(value)}
</Typography>
)}
{showVoltage && (
+1 -1
View File
@@ -1,5 +1,5 @@
import classNames from 'classnames';
import { IPv4 } from 'ip-num';
import { IPv4 } from 'ip-num/IPNumber';
import { createContext, ReactNode, useContext, useMemo } from 'react';
import { useConfig } from '@/hooks/config';
import { useTracker } from '@/hooks/tracker';
@@ -6,12 +6,7 @@ import {
} from '@/hooks/tracking-checklist';
import classNames from 'classnames';
import {
ChangeSettingsRequestT,
ResetType,
RpcMessage,
SettingsRequestT,
SettingsResponseT,
SteamVRTrackersSettingT,
TrackingChecklistPublicNetworksT,
TrackingChecklistStepId,
} from 'solarxr-protocol';
@@ -34,7 +29,6 @@ import { TrackingChecklistModal } from './TrackingChecklistModal';
import { NavLink, useNavigate } from 'react-router-dom';
import { useBreakpoint } from '@/hooks/breakpoint';
import { openUrl } from '@/hooks/crossplatform';
import { useWebsocketAPI } from '@/hooks/websocket-api';
function Step({
step: { status, id, optional, firstRequired },
@@ -108,55 +102,6 @@ function Step({
);
}
function SteamVRHandsEnabled() {
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
const [steamVrTrackers, setSteamVrTrackers] = useState<Omit<
SteamVRTrackersSettingT,
'pack'
> | null>(null);
useEffect(() => {
sendRPCPacket(RpcMessage.SettingsRequest, new SettingsRequestT());
}, []);
useRPCPacket(RpcMessage.SettingsResponse, (settings: SettingsResponseT) => {
if (settings.steamVrTrackers) {
setSteamVrTrackers(settings.steamVrTrackers);
}
});
const disableHandTrackers = () => {
const settings = new ChangeSettingsRequestT();
settings.steamVrTrackers = new SteamVRTrackersSettingT(
steamVrTrackers?.waist,
steamVrTrackers?.chest,
steamVrTrackers?.automaticTrackerToggle,
steamVrTrackers?.leftFoot,
steamVrTrackers?.rightFoot,
steamVrTrackers?.leftKnee,
steamVrTrackers?.rightKnee,
steamVrTrackers?.leftElbow,
steamVrTrackers?.rightElbow,
false,
false
);
sendRPCPacket(RpcMessage.ChangeSettingsRequest, settings);
};
return (
<div className="space-y-2.5">
<Typography id="tracking_checklist-STEAMVR_HANDS_ENABLED-desc" />
<div className="flex">
<Button
id="tracking_checklist-STEAMVR_HANDS_ENABLED-go"
variant="primary"
onClick={disableHandTrackers}
/>
</div>
</div>
);
}
const stepContentLookup: Record<
number,
(
@@ -407,9 +352,6 @@ const stepContentLookup: Record<
</>
);
},
[TrackingChecklistStepId.STEAMVR_HANDS_ENABLED]: () => {
return <SteamVRHandsEnabled />;
},
};
export function TrackingChecklistMobile() {
@@ -1,5 +1,5 @@
import { useEffect } from 'react';
import { FieldPath, useForm } from 'react-hook-form';
import { useForm } from 'react-hook-form';
import { useConfig } from '@/hooks/config';
import { useWebsocketAPI } from '@/hooks/websocket-api';
import { CheckBox } from '@/components/commons/Checkbox';
@@ -57,7 +57,7 @@ export function DeveloperModeWidget() {
control={control}
variant="toggle"
outlined
name={name as FieldPath<DeveloperModeWidgetForm>}
name={name}
label={l10n.getString(`widget-developer_mode-${label}`)}
/>
);
+2 -23
View File
@@ -5,7 +5,6 @@ import {
ResetResponseT,
RpcMessage,
StartDataFeedT,
InstalledInfoResponseT,
} from 'solarxr-protocol';
import { handleResetSounds } from '@/sounds/sounds';
import { useConfig } from './config';
@@ -19,17 +18,11 @@ import { DEFAULT_LOCALE, LangContext } from '@/i18n/config';
export interface AppContext {
currentFirmwareRelease: FirmwareRelease | null;
installInfo: InstalledInfoResponseT | null;
}
export function useProvideAppContext(): AppContext {
const {
useRPCPacket,
sendRPCPacket,
sendDataFeedPacket,
useDataFeedPacket,
isConnected,
} = useWebsocketAPI();
const { useRPCPacket, sendDataFeedPacket, useDataFeedPacket, isConnected } =
useWebsocketAPI();
const { changeLocales } = useContext(LangContext);
const { config } = useConfig();
const { dataFeedConfig } = useDataFeedConfig();
@@ -41,8 +34,6 @@ export function useProvideAppContext(): AppContext {
const [currentFirmwareRelease, setCurrentFirmwareRelease] =
useState<FirmwareRelease | null>(null);
const [installInfo, setInstallInfo] = useState<InstalledInfoResponseT | null>(null);
useEffect(() => {
if (isConnected) {
const startDataFeed = new StartDataFeedT();
@@ -79,17 +70,6 @@ export function useProvideAppContext(): AppContext {
};
}, [config?.uuid]);
useEffect(() => {
sendRPCPacket(RpcMessage.InstalledInfoRequest, new InstalledInfoResponseT());
}, []);
useRPCPacket(
RpcMessage.InstalledInfoResponse,
({ isUdevInstalled, isWayland }: InstalledInfoResponseT) => {
setInstallInfo(new InstalledInfoResponseT(isUdevInstalled, isWayland));
}
);
useLayoutEffect(() => {
changeLocales([config?.lang || DEFAULT_LOCALE]);
}, []);
@@ -105,7 +85,6 @@ export function useProvideAppContext(): AppContext {
return {
currentFirmwareRelease,
installInfo,
};
}
-2
View File
@@ -48,7 +48,6 @@ export interface Config {
homeLayout: 'default' | 'table';
skeletonPreview: boolean;
lastUsedProportions: 'manual' | 'autobone' | 'scaled' | null;
dontShowUdevModal: boolean;
}
export interface ConfigContext {
@@ -80,7 +79,6 @@ export const defaultConfig: Config = {
homeLayout: 'default',
skeletonPreview: true,
lastUsedProportions: null,
dontShowUdevModal: false,
};
const localStore: CrossStorage = {
+1 -2
View File
@@ -152,8 +152,7 @@ export function checkForUpdate(
if (
canUpdate &&
device.hardwareStatus?.batteryPctEstimate != null &&
(device.hardwareStatus.batteryPctEstimate < 50 ||
device.hardwareStatus.batteryPctEstimate > 200)
device.hardwareStatus.batteryPctEstimate < 50
) {
return 'low-battery';
}
+10 -108
View File
@@ -1,28 +1,6 @@
import {
createContext,
Reducer,
useContext,
useEffect,
useLayoutEffect,
useReducer,
useState,
} from 'react';
import { createContext, Reducer, useContext, useLayoutEffect, useReducer } from 'react';
import { useLocation } from 'react-router-dom';
import { useConfig } from './config';
import { useWebsocketAPI } from './websocket-api';
import {
ChangeSettingsRequestT,
ModelSettingsT,
ModelTogglesT,
OSCSettingsT,
ResetsSettingsT,
RpcMessage,
SettingsRequestT,
SettingsResponseT,
SkeletonBone,
VRCOSCSettingsT,
} from 'solarxr-protocol';
import { useManualProportions } from './manual-proportions';
type OnboardingAction =
| { type: 'progress'; value: number }
@@ -35,6 +13,13 @@ interface OnboardingState {
alonePage: boolean;
}
export interface OnboardingContext {
state: OnboardingState;
applyProgress: (value: number) => void;
setWifiCredentials: (ssid: string, password?: string) => void;
skipSetup: () => void;
}
export function reducer(state: OnboardingState, action: OnboardingAction) {
switch (action.type) {
case 'wifi-creds':
@@ -57,17 +42,8 @@ export function reducer(state: OnboardingState, action: OnboardingAction) {
}
}
export type OnboardingContext = ReturnType<typeof useProvideOnboarding>;
export function useProvideOnboarding() {
export function useProvideOnboarding(): OnboardingContext {
const { setConfig } = useConfig();
const [slimeSet, setSlimeSet] = useState<
'butterfly' | 'slime-v1' | 'dongle-slime' | 'wifi-slime'
>();
const [usage, setUsage] = useState<'vr-gaming' | 'mocap' | 'vtubing'>();
const [vrcOsc, setVrcOSC] = useState<boolean>();
const [mocapPos, setMocapPos] = useState<'forehead' | 'face'>();
const [playspace, setPlayspace] = useState<'sitting' | 'standing'>();
const [state, dispatch] = useReducer<Reducer<OnboardingState, OnboardingAction>>(
reducer,
{
@@ -76,11 +52,7 @@ export function useProvideOnboarding() {
}
);
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
const { state: locatioState, pathname } = useLocation();
const [previousPath, setPreviousPath] = useState(pathname);
const [settings, setSettings] = useState<SettingsResponseT>();
const { state: locatioState } = useLocation();
useLayoutEffect(() => {
const { alonePage = false }: { alonePage?: boolean } = (locatioState as any) || {};
@@ -89,74 +61,8 @@ export function useProvideOnboarding() {
dispatch({ type: 'alone-page', value: alonePage });
}, [locatioState, state]);
useEffect(() => {
sendRPCPacket(RpcMessage.SettingsRequest, new SettingsRequestT());
}, []);
useRPCPacket(RpcMessage.SettingsResponse, (settings: SettingsResponseT) => {
setSettings(settings);
});
const { changeBoneValue } = useManualProportions({
type: 'linear',
});
const onboardingEnded = () => {
if (!settings?.modelSettings || !settings?.vrcOsc) throw 'settings should be set';
const req = new ChangeSettingsRequestT();
const modelSettings = new ModelSettingsT();
const oscSettings = new VRCOSCSettingsT();
const mocap = usage === 'mocap' || usage === 'vtubing';
const toggles = Object.assign(new ModelTogglesT(), settings.modelSettings.toggles);
toggles.selfLocalization = mocap && playspace === 'standing';
modelSettings.toggles = toggles;
req.modelSettings = modelSettings;
const resets = Object.assign(new ResetsSettingsT(), settings.resetsSettings);
resets.resetHmdPitch = mocapPos === 'forehead';
req.resetsSettings = resets;
const osc = Object.assign(new OSCSettingsT(), settings.vrcOsc.oscSettings);
osc.enabled = vrcOsc ?? false;
oscSettings.oscSettings = osc;
req.vrcOsc = oscSettings;
sendRPCPacket(RpcMessage.ChangeSettingsRequest, req);
if (mocap) {
changeBoneValue({ bone: SkeletonBone.HAND_Z, type: 'bone', newValue: 0 });
}
};
const onboardingStarted = () => {
setSlimeSet(undefined);
setUsage(undefined);
setVrcOSC(undefined);
setMocapPos(undefined);
setPlayspace(undefined);
};
useEffect(() => {
setPreviousPath(pathname);
if (!pathname.startsWith('/onboarding') && previousPath.startsWith('/onboarding')) {
onboardingEnded();
}
if (pathname.startsWith('/onboarding') && !previousPath.startsWith('/onboarding')) {
onboardingStarted();
}
}, [pathname]);
return {
state,
slimeSet,
usage,
vrcOsc,
mocapPos,
playspace,
setPlayspace,
applyProgress: (value: number) => {
useLayoutEffect(() => {
dispatch({ type: 'progress', value });
@@ -168,10 +74,6 @@ export function useProvideOnboarding() {
skipSetup: () => {
setConfig({ doneOnboarding: true });
},
setSlimeSet,
setUsage,
setVrcOSC,
setMocapPos,
};
}
-2
View File
@@ -30,8 +30,6 @@ export const trackingchecklistIdtoLabel: Record<TrackingChecklistStepId, string>
'tracking_checklist-FEET_MOUNTING_CALIBRATION',
[TrackingChecklistStepId.STAY_ALIGNED_CONFIGURED]:
'tracking_checklist-STAY_ALIGNED_CONFIGURED',
[TrackingChecklistStepId.STEAMVR_HANDS_ENABLED]:
'tracking_checklist-STEAMVR_HANDS_ENABLED',
};
export type TrackingChecklistStepStatus =
+2
View File
@@ -97,6 +97,8 @@ function createAudio(path: string): HTMLAudioElement {
export function restartAndPlay(audio: HTMLAudioElement | null, volume: number) {
if (!audio) return;
try {
audio.load(); // LINUX: Solves wierd bug where webkit would unload sounds wierdly and make the sounds not play anymore
audio.volume = Math.min(1, Math.pow(volume, Math.E) + 0.05);
audio.currentTime = 0;
const playPromise = audio.play();
+1 -5
View File
@@ -11,12 +11,8 @@ import { DeviceDataT } from 'solarxr-protocol';
export function getSentryOrCompute(enabled = false, uuid: string) {
Sentry.setUser({ id: uuid });
// if sentry is already initialized - SKIP
if (enabled && Sentry.isInitialized()) {
log('Sentry already enabled, skipping initialization');
return;
}
if (enabled && Sentry.isInitialized()) return;
const client = Sentry.getClient();
if (client) {
-1
View File
@@ -183,7 +183,6 @@ const config = {
lg: '1300px',
xl: '1600px',
tall: { raw: '(min-height: 860px)' },
'keybinds-small': { raw: 'not (min-width: 1230px)' },
},
extend: {
colors: {
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "slimevr",
"version": "0.0.0",
"private": true,
"packageManager": "pnpm@10.33.0",
"packageManager": "pnpm@9.12.2",
"workspaces": [
"solarxr-protocol",
"gui"
+3215 -1884
View File
File diff suppressed because it is too large. Load diff
-10
View File
@@ -2,13 +2,3 @@ packages:
- "solarxr-protocol"
- "gui"
- "!solarxr-protocol/lib/flatbuffers/**"
onlyBuiltDependencies:
- '@parcel/watcher'
- '@sentry/cli'
- '@swc/core'
- electron
- electron-winstaller
- esbuild
- register-scheme
- unrs-resolver
@@ -47,12 +47,13 @@ fun startVRServer(activity: AppCompatActivity) {
vrServer.start()
// Start service for USB HID trackers
val androidHidManager = AndroidHIDManager(
LogManager.info("Starting the HID tracker service")
vrServer.hidTrackersServer = AndroidHIDManager(
"Sensors HID service",
{ tracker: Tracker -> vrServer.registerTracker(tracker) },
activity,
)
androidHidManager.start()
vrServer.hidTrackersServer.start()
Keybinding(vrServer)
vrServer.join()
@@ -32,7 +32,7 @@ class AndroidHIDManager(
name: String,
private val trackersConsumer: Consumer<Tracker>,
private val context: Context,
) : Thread(name) {
) : HIDCommon(name) {
private val devices: MutableList<HIDDevice> = mutableListOf()
private val devicesBySerial: MutableMap<String, MutableList<Int>> = HashMap()
private val devicesByHID: MutableMap<UsbDevice, MutableList<Int>> = HashMap()
-2
View File
@@ -83,8 +83,6 @@ dependencies {
implementation("com.mayakapps.kache:kache:2.1.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
implementation("com.github.HannahPadd:DbusGlobalShortcutsWayland:v0.1.0")
api("com.github.loucass003:EspflashKotlin:v0.11.0")
// Allow the use of reflection
@@ -1,6 +0,0 @@
package dev.slimevr
data class FeatureFlags(
var steam: Boolean = false,
var skipCheckUdev: Boolean = false,
)
@@ -2,49 +2,51 @@ package dev.slimevr
import com.melloware.jintellitype.HotkeyListener
import com.melloware.jintellitype.JIntellitype
import dev.hannah.portals.PortalManager
import dev.hannah.portals.globalShortcuts.Shortcut
import dev.hannah.portals.globalShortcuts.ShortcutTuple
import dev.slimevr.config.KeybindingsConfig
import dev.slimevr.tracking.trackers.TrackerUtils
import io.eiren.util.OperatingSystem
import io.eiren.util.OperatingSystem.Companion.currentPlatform
import io.eiren.util.ann.AWTThread
import io.eiren.util.logging.LogManager
import solarxr_protocol.rpc.KeybindId
enum class Keybinds(val id: Int, val keybindName: String, val description: String, val keybind: String) {
FULL_RESET(KeybindId.FULL_RESET, "FULL_RESET", "Full Reset", "CTRL+ALT+SHIFT+Y"),
MOUNTING_RESET(KeybindId.MOUNTING_RESET, "MOUNTING_RESET", "Mounting Reset", "CTRL+ALT+SHIFT+I"),
PAUSE_TRACKING(KeybindId.PAUSE_TRACKING, "PAUSE_TRACKING", "Pause Tracking", "CTRL+ALT+SHIFT+O"),
YAW_RESET(KeybindId.YAW_RESET, "YAW_RESET", "Yaw Reset", "CTRL+ALT+SHIFT+U"),
FEET_MOUNTING_RESET(KeybindId.FEET_MOUNTING_RESET, "FEET_MOUNTING_RESET", "Feet Mounting Reset", "CTRL+ALT+SHIFT+P"),
;
override fun toString(): String = keybindName
companion object {
private val byId = Keybinds.entries.associateBy { it.id }
private val byName = Keybinds.entries.associateBy { it.keybindName }
fun getById(value: Int): Keybinds? = byId[value]
fun getByName(name: String): Keybinds? = byName[name]
}
}
class Keybinding @AWTThread constructor(val server: VRServer) : HotkeyListener {
val config: KeybindingsConfig = server.configManager.vrConfig.keybindings
init {
if (currentPlatform == OperatingSystem.WINDOWS) {
if (currentPlatform != OperatingSystem.WINDOWS) {
LogManager
.info(
"[Keybinding] Currently only supported on Windows. Keybindings will be disabled.",
)
} else {
try {
if (JIntellitype.getInstance() != null) {
JIntellitype.getInstance().addHotKeyListener(this)
config.keybinds.forEach { (i, keybind) ->
JIntellitype.getInstance()
.registerHotKey(keybind.id, keybind.binding)
}
val fullResetBinding = config.fullResetBinding
JIntellitype.getInstance()
.registerHotKey(FULL_RESET, fullResetBinding)
LogManager.info("[Keybinding] Bound full reset to $fullResetBinding")
val yawResetBinding = config.yawResetBinding
JIntellitype.getInstance()
.registerHotKey(YAW_RESET, yawResetBinding)
LogManager.info("[Keybinding] Bound yaw reset to $yawResetBinding")
val mountingResetBinding = config.mountingResetBinding
JIntellitype.getInstance()
.registerHotKey(MOUNTING_RESET, mountingResetBinding)
LogManager.info("[Keybinding] Bound reset mounting to $mountingResetBinding")
val feetMountingResetBinding = config.feetMountingResetBinding
JIntellitype.getInstance()
.registerHotKey(FEET_MOUNTING_RESET, feetMountingResetBinding)
LogManager.info("[Keybinding] Bound feet reset mounting to $feetMountingResetBinding")
val pauseTrackingBinding = config.pauseTrackingBinding
JIntellitype.getInstance()
.registerHotKey(PAUSE_TRACKING, pauseTrackingBinding)
LogManager.info("[Keybinding] Bound pause tracking to $pauseTrackingBinding")
}
} catch (e: Throwable) {
LogManager
@@ -53,97 +55,42 @@ class Keybinding @AWTThread constructor(val server: VRServer) : HotkeyListener {
)
}
}
if (currentPlatform == OperatingSystem.LINUX) {
val portalManager = PortalManager(SLIMEVR_IDENTIFIER)
val shortcutsList = Keybinds.entries.map {
ShortcutTuple(it.name, Shortcut(it.description, it.keybind).shortcut)
}.toMutableList()
val globalShortcutsHandler = portalManager.globalShortcutsRequest(shortcutsList)
Runtime.getRuntime().addShutdownHook(
Thread {
println("Closing connection")
globalShortcutsHandler.close()
},
)
val onShortcut: (id: String) -> Unit = { shortcutId ->
val keybind = Keybinds.getByName(shortcutId)
if (keybind != null) {
val delay = config.keybinds[keybind]?.delay?.toLong() ?: 0L
when (keybind) {
Keybinds.FULL_RESET -> {
server.scheduleResetTrackersFull(keybind.keybindName, delay)
}
Keybinds.YAW_RESET -> {
server.scheduleResetTrackersYaw(keybind.keybindName, delay)
}
Keybinds.MOUNTING_RESET -> {
server.scheduleResetTrackersMounting(
keybind.keybindName,
delay,
)
}
Keybinds.FEET_MOUNTING_RESET -> {
server.scheduleResetTrackersMounting(
keybind.keybindName,
delay,
TrackerUtils.feetsBodyParts,
)
}
Keybinds.PAUSE_TRACKING -> {
server.scheduleTogglePauseTracking(
keybind.keybindName,
delay,
)
}
}
}
}
globalShortcutsHandler.onShortcutActivated = onShortcut
}
}
@AWTThread
override fun onHotKey(identifier: Int) {
val keybind = Keybinds.getById(identifier) ?: return
val delay = config.keybinds[keybind]?.delay?.toLong() ?: 0L
when (keybind) {
Keybinds.FULL_RESET -> {
server.scheduleResetTrackersFull(keybind.keybindName, delay)
}
when (identifier) {
FULL_RESET -> server.scheduleResetTrackersFull(RESET_SOURCE_NAME, config.fullResetDelay)
Keybinds.YAW_RESET -> {
server.scheduleResetTrackersYaw(keybind.keybindName, delay)
}
YAW_RESET -> server.scheduleResetTrackersYaw(RESET_SOURCE_NAME, config.yawResetDelay)
Keybinds.MOUNTING_RESET -> {
server.scheduleResetTrackersMounting(
keybind.keybindName,
delay,
TrackerUtils.feetsBodyParts,
)
}
MOUNTING_RESET -> server.scheduleResetTrackersMounting(
RESET_SOURCE_NAME,
config.mountingResetDelay,
)
Keybinds.FEET_MOUNTING_RESET -> {
server.scheduleResetTrackersMounting(
keybind.keybindName,
delay,
TrackerUtils.feetsBodyParts,
)
}
FEET_MOUNTING_RESET -> server.scheduleResetTrackersMounting(
RESET_SOURCE_NAME,
config.feetMountingResetDelay,
TrackerUtils.feetsBodyParts,
)
Keybinds.PAUSE_TRACKING -> {
server.scheduleTogglePauseTracking(
keybind.keybindName,
delay,
)
}
PAUSE_TRACKING ->
server
.scheduleTogglePauseTracking(
RESET_SOURCE_NAME,
config.pauseTrackingDelay,
)
}
}
companion object {
private const val RESET_SOURCE_NAME = "Keybinding"
private const val FULL_RESET = 1
private const val YAW_RESET = 2
private const val MOUNTING_RESET = 3
private const val FEET_MOUNTING_RESET = 4
private const val PAUSE_TRACKING = 5
}
}
@@ -11,14 +11,12 @@ import dev.slimevr.games.vrchat.VRCConfigHandler
import dev.slimevr.games.vrchat.VRCConfigHandlerStub
import dev.slimevr.games.vrchat.VRChatConfigManager
import dev.slimevr.guards.ServerGuards
import dev.slimevr.keybind.KeybindHandler
import dev.slimevr.osc.OSCHandler
import dev.slimevr.osc.OSCRouter
import dev.slimevr.osc.VMCHandler
import dev.slimevr.osc.VRCOSCHandler
import dev.slimevr.posestreamer.BVHRecorder
import dev.slimevr.protocol.ProtocolAPI
import dev.slimevr.protocol.rpc.TransactionInfo
import dev.slimevr.protocol.rpc.settings.RPCSettingsHandler
import dev.slimevr.reset.ResetHandler
import dev.slimevr.reset.ResetTimerManager
@@ -32,6 +30,7 @@ import dev.slimevr.status.StatusSystem
import dev.slimevr.tracking.processor.HumanPoseManager
import dev.slimevr.tracking.processor.skeleton.HumanSkeleton
import dev.slimevr.tracking.trackers.*
import dev.slimevr.tracking.trackers.hid.HIDCommon
import dev.slimevr.tracking.trackers.udp.TrackersUDPServer
import dev.slimevr.trackingchecklist.TrackingChecklistManager
import dev.slimevr.util.ann.VRServerThread
@@ -58,7 +57,6 @@ const val SLIMEVR_IDENTIFIER = "dev.slimevr.SlimeVR"
class VRServer @JvmOverloads constructor(
bridgeProvider: BridgeProvider = { _, _ -> sequence {} },
featureFlagsProvider: (VRServer) -> FeatureFlags = { _ -> FeatureFlags() },
serialHandlerProvider: (VRServer) -> SerialHandler = { _ -> SerialHandlerStub() },
flashingHandlerProvider: (VRServer) -> SerialFlashingHandler? = { _ -> null },
vrcConfigHandlerProvider: (VRServer) -> VRCConfigHandler = { _ -> VRCConfigHandlerStub() },
@@ -70,6 +68,7 @@ class VRServer @JvmOverloads constructor(
@JvmField
val humanPoseManager: HumanPoseManager
private val trackers: MutableList<Tracker> = FastList()
var hidTrackersServer: HIDCommon? = null
val trackersServer: TrackersUDPServer
private val bridges: MutableList<Bridge> = FastList()
private val tasks: Queue<Runnable> = LinkedBlockingQueue()
@@ -86,9 +85,6 @@ class VRServer @JvmOverloads constructor(
@JvmField
val deviceManager: DeviceManager
// UwU
val featureFlags: FeatureFlags = featureFlagsProvider(this)
@JvmField
val bvhRecorder: BVHRecorder
@@ -129,11 +125,10 @@ class VRServer @JvmOverloads constructor(
val networkProfileChecker: NetworkProfileChecker
val keybindHandler: KeybindHandler
val serverGuards = ServerGuards()
init {
// UwU
deviceManager = DeviceManager(this)
serialHandler = serialHandlerProvider(this)
serialFlashingHandler = flashingHandlerProvider(this)
@@ -147,7 +142,6 @@ class VRServer @JvmOverloads constructor(
vrcConfigManager = VRChatConfigManager(this, vrcConfigHandlerProvider(this))
networkProfileChecker = networkProfileProvider(this)
trackingChecklistManager = TrackingChecklistManager(this)
keybindHandler = KeybindHandler(this)
protocolAPI = ProtocolAPI(this)
val computedTrackers = humanPoseManager.computedTrackers
@@ -309,8 +303,9 @@ class VRServer @JvmOverloads constructor(
queueTask {
humanPoseManager.updateSkeletonModelFromServer()
vrcOSCHandler.setHeadTracker(TrackerUtils.getTrackerForSkeleton(trackers, TrackerPosition.HEAD))
this.getVRBridge(ISteamVRBridge::class.java)?.updateShareSettingsAutomatically()
RPCSettingsHandler.sendSteamVRUpdatedSettings(protocolAPI, protocolAPI.rpcHandler)
if (this.getVRBridge(ISteamVRBridge::class.java)?.updateShareSettingsAutomatically() == true) {
RPCSettingsHandler.sendSteamVRUpdatedSettings(protocolAPI, protocolAPI.rpcHandler)
}
}
}
@@ -336,8 +331,9 @@ class VRServer @JvmOverloads constructor(
queueTask {
humanPoseManager.setPauseTracking(pauseTracking, sourceName)
// Toggle trackers as they don't toggle when tracking is paused
this.getVRBridge(ISteamVRBridge::class.java)?.updateShareSettingsAutomatically()
RPCSettingsHandler.sendSteamVRUpdatedSettings(protocolAPI, protocolAPI.rpcHandler)
if (this.getVRBridge(ISteamVRBridge::class.java)?.updateShareSettingsAutomatically() == true) {
RPCSettingsHandler.sendSteamVRUpdatedSettings(protocolAPI, protocolAPI.rpcHandler)
}
}
}
@@ -345,54 +341,55 @@ class VRServer @JvmOverloads constructor(
queueTask {
humanPoseManager.togglePauseTracking(sourceName)
// Toggle trackers as they don't toggle when tracking is paused
this.getVRBridge(ISteamVRBridge::class.java)?.updateShareSettingsAutomatically()
RPCSettingsHandler.sendSteamVRUpdatedSettings(protocolAPI, protocolAPI.rpcHandler)
if (this.getVRBridge(ISteamVRBridge::class.java)?.updateShareSettingsAutomatically() == true) {
RPCSettingsHandler.sendSteamVRUpdatedSettings(protocolAPI, protocolAPI.rpcHandler)
}
}
}
fun scheduleResetTrackersFull(resetSourceName: String?, delay: Long, bodyParts: List<Int> = ArrayList(), tx: TransactionInfo? = null) {
fun scheduleResetTrackersFull(resetSourceName: String?, delay: Long, bodyParts: List<Int> = ArrayList()) {
resetTimer(
resetTimerManager,
delay,
onTick = { progress ->
resetHandler.sendStarted(ResetType.Full, tx, bodyParts, progress, delay.toInt())
resetHandler.sendStarted(ResetType.Full, bodyParts, progress, delay.toInt())
},
onComplete = {
queueTask {
humanPoseManager.resetTrackersFull(resetSourceName, bodyParts)
resetHandler.sendFinished(ResetType.Full, tx, bodyParts, delay.toInt())
resetHandler.sendFinished(ResetType.Full, bodyParts, delay.toInt())
}
},
)
}
fun scheduleResetTrackersYaw(resetSourceName: String?, delay: Long, bodyParts: List<Int> = TrackerUtils.allBodyPartsButFingers, tx: TransactionInfo? = null) {
fun scheduleResetTrackersYaw(resetSourceName: String?, delay: Long, bodyParts: List<Int> = TrackerUtils.allBodyPartsButFingers) {
resetTimer(
resetTimerManager,
delay,
onTick = { progress ->
resetHandler.sendStarted(ResetType.Yaw, tx, bodyParts, progress, delay.toInt())
resetHandler.sendStarted(ResetType.Yaw, bodyParts, progress, delay.toInt())
},
onComplete = {
queueTask {
humanPoseManager.resetTrackersYaw(resetSourceName, bodyParts)
resetHandler.sendFinished(ResetType.Yaw, tx, bodyParts, delay.toInt())
resetHandler.sendFinished(ResetType.Yaw, bodyParts, delay.toInt())
}
},
)
}
fun scheduleResetTrackersMounting(resetSourceName: String?, delay: Long, bodyParts: List<Int>? = null, tx: TransactionInfo? = null) {
fun scheduleResetTrackersMounting(resetSourceName: String?, delay: Long, bodyParts: List<Int>? = null) {
resetTimer(
resetTimerManager,
delay,
onTick = { progress ->
resetHandler.sendStarted(ResetType.Mounting, tx, bodyParts, progress, delay.toInt())
resetHandler.sendStarted(ResetType.Mounting, bodyParts, progress, delay.toInt())
},
onComplete = {
queueTask {
humanPoseManager.resetTrackersMounting(resetSourceName, bodyParts)
resetHandler.sendFinished(ResetType.Mounting, tx, bodyParts, delay.toInt())
resetHandler.sendFinished(ResetType.Mounting, bodyParts, delay.toInt())
}
},
)
@@ -0,0 +1,88 @@
package dev.slimevr.config;
public class KeybindingsConfig {
private String fullResetBinding = "CTRL+ALT+SHIFT+Y";
private String yawResetBinding = "CTRL+ALT+SHIFT+U";
private String mountingResetBinding = "CTRL+ALT+SHIFT+I";
private String feetMountingResetBinding = "CTRL+ALT+SHIFT+P";
private String pauseTrackingBinding = "CTRL+ALT+SHIFT+O";
private long fullResetDelay = 0L;
private long yawResetDelay = 0L;
private long mountingResetDelay = 0L;
private long feetMountingResetDelay = 0L;
private long pauseTrackingDelay = 0L;
public KeybindingsConfig() {
}
public String getFullResetBinding() {
return fullResetBinding;
}
public String getYawResetBinding() {
return yawResetBinding;
}
public String getMountingResetBinding() {
return mountingResetBinding;
}
public String getFeetMountingResetBinding() {
return feetMountingResetBinding;
}
public String getPauseTrackingBinding() {
return pauseTrackingBinding;
}
public long getFullResetDelay() {
return fullResetDelay;
}
public void setFullResetDelay(long delay) {
fullResetDelay = delay;
}
public long getYawResetDelay() {
return yawResetDelay;
}
public void setYawResetDelay(long delay) {
yawResetDelay = delay;
}
public long getMountingResetDelay() {
return mountingResetDelay;
}
public void setMountingResetDelay(long delay) {
mountingResetDelay = delay;
}
public long getFeetMountingResetDelay() {
return feetMountingResetDelay;
}
public void setFeetMountingResetDelay(long delay) {
feetMountingResetDelay = delay;
}
public long getPauseTrackingDelay() {
return pauseTrackingDelay;
}
public void setPauseTrackingDelay(long delay) {
pauseTrackingDelay = delay;
}
}
@@ -1,16 +0,0 @@
package dev.slimevr.config
import dev.slimevr.Keybinds
data class KeybindData(
var id: Int,
var name: String,
var binding: String,
var delay: Float,
)
class KeybindingsConfig {
val keybinds: MutableMap<Keybinds, KeybindData> = Keybinds.entries
.associateWith { KeybindData(it.id, it.keybindName, it.keybind, 0f) }
.toMutableMap()
}
@@ -0,0 +1,4 @@
package dev.slimevr.hid
interface HIDListener {
}
@@ -1,55 +0,0 @@
package dev.slimevr.keybind
import dev.slimevr.VRServer
import dev.slimevr.config.KeybindingsConfig
import solarxr_protocol.rpc.KeybindT
import java.util.concurrent.CopyOnWriteArrayList
class KeybindHandler(val vrServer: VRServer) {
private val listeners: MutableList<KeybindListener> = CopyOnWriteArrayList()
var keybinds: MutableList<KeybindT> = mutableListOf()
var defaultKeybinds: MutableList<KeybindT> = mutableListOf()
init {
createKeybinds()
}
fun addListener(listener: KeybindListener) {
this.listeners.add(listener)
}
fun removeListener(listener: KeybindListener) {
listeners.removeIf { listener == it }
}
private fun createKeybinds() {
keybinds.clear()
defaultKeybinds.clear()
vrServer.configManager.vrConfig.keybindings.keybinds.forEach { (i, keybind) ->
keybinds.add(
KeybindT().apply {
keybindId = keybind.id
keybindNameId = keybind.name
keybindValue = keybind.binding
keybindDelay = keybind.delay
},
)
}
val binds = KeybindingsConfig().keybinds
binds.forEach { (i, keybind) ->
defaultKeybinds.add(
KeybindT().apply {
keybindId = keybind.id
keybindNameId = keybind.name
keybindValue = keybind.binding
keybindDelay = keybind.delay
},
)
}
}
fun updateKeybinds() {
createKeybinds()
}
}
@@ -1,6 +0,0 @@
package dev.slimevr.keybind
interface KeybindListener {
fun sendKeybind()
fun onKeybindUpdate()
}
@@ -10,9 +10,6 @@ import dev.slimevr.protocol.datafeed.createTrackerId
import dev.slimevr.protocol.rpc.autobone.RPCAutoBoneHandler
import dev.slimevr.protocol.rpc.firmware.RPCFirmwareUpdateHandler
import dev.slimevr.protocol.rpc.games.vrchat.RPCVRChatHandler
import dev.slimevr.protocol.rpc.installinfo.RPCInstallInfoHandler
import dev.slimevr.protocol.rpc.keybinds.RPCKeybindHandler
import dev.slimevr.protocol.rpc.openuri.RPCOpenUriHandler
import dev.slimevr.protocol.rpc.reset.RPCResetHandler
import dev.slimevr.protocol.rpc.serial.RPCProvisioningHandler
import dev.slimevr.protocol.rpc.serial.RPCSerialHandler
@@ -24,6 +21,7 @@ import dev.slimevr.protocol.rpc.setup.RPCUtil.getLocalIp
import dev.slimevr.protocol.rpc.status.RPCStatusHandler
import dev.slimevr.protocol.rpc.trackingchecklist.RPCTrackingChecklistHandler
import dev.slimevr.protocol.rpc.trackingpause.RPCTrackingPause
import dev.slimevr.protocol.rpc.hid.RPCHIDHandler
import dev.slimevr.tracking.processor.config.SkeletonConfigOffsets
import dev.slimevr.tracking.processor.stayaligned.poses.RelaxedPose
import dev.slimevr.tracking.trackers.TrackerPosition
@@ -55,15 +53,7 @@ class RPCHandler(private val api: ProtocolAPI) : ProtocolHandler<RpcMessageHeade
RPCVRChatHandler(this, api)
RPCTrackingChecklistHandler(this, api)
RPCUserHeightCalibration(this, api)
RPCInstallInfoHandler(this, api)
RPCOpenUriHandler(this, api)
try {
RPCKeybindHandler(this, api)
} catch (e: Exception) {
e.printStackTrace()
} catch (t: Throwable) {
t.printStackTrace()
}
RPCHIDHandler(this, api)
registerPacketListener(
RpcMessage.AssignTrackerRequest,
@@ -386,14 +376,15 @@ class RPCHandler(private val api: ProtocolAPI) : ProtocolHandler<RpcMessageHeade
}
}
fun createRPCMessage(fbb: FlatBufferBuilder, messageType: Byte, messageOffset: Int, txId: Long?): Int {
@JvmOverloads
fun createRPCMessage(fbb: FlatBufferBuilder, messageType: Byte, messageOffset: Int, respondTo: RpcMessageHeader? = null): Int {
val data = IntArray(1)
RpcMessageHeader.startRpcMessageHeader(fbb)
RpcMessageHeader.addMessage(fbb, messageOffset)
RpcMessageHeader.addMessageType(fbb, messageType)
txId?.let { txId ->
RpcMessageHeader.addTxId(fbb, TransactionId.createTransactionId(fbb, txId))
respondTo?.txId()?.let { txId ->
RpcMessageHeader.addTxId(fbb, TransactionId.createTransactionId(fbb, txId.id()))
}
data[0] = RpcMessageHeader.endRpcMessageHeader(fbb)
@@ -404,10 +395,6 @@ class RPCHandler(private val api: ProtocolAPI) : ProtocolHandler<RpcMessageHeade
return MessageBundle.endMessageBundle(fbb)
}
fun createRPCMessage(fbb: FlatBufferBuilder, messageType: Byte, messageOffset: Int): Int = createRPCMessage(fbb, messageType, messageOffset, txId = null)
fun createRPCMessage(fbb: FlatBufferBuilder, messageType: Byte, messageOffset: Int, respondTo: RpcMessageHeader?): Int = createRPCMessage(fbb, messageType, messageOffset, respondTo?.txId()?.id())
override fun messagesCount(): Int = RpcMessage.names.size
fun onStatusSystemRequest(conn: GenericConnection, messageHeader: RpcMessageHeader) {
@@ -1,8 +0,0 @@
package dev.slimevr.protocol.rpc
import dev.slimevr.protocol.GenericConnection
data class TransactionInfo(
val id: Long,
val conn: GenericConnection,
)
Loaded 100 of 128 files, more files were not shown because too many files have changed in this diff. Show more