Skip to content

Commit 5d8e827

Browse files
committed
Steam
1 parent 110e0ce commit 5d8e827

26 files changed

Lines changed: 510 additions & 82 deletions

File tree

gui/electron/main/cli.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
import { program } from "commander";
1+
import { Option, program } from "commander";
22

33
program
4-
.option('-p --path <path>', 'set launch path')
4+
.option('-p, --path <path>', 'set launch path')
5+
.option('-s, --steam', 'steam mode')
6+
.option('-i, --install', 'run the driver installer')
57
.option(
68
'--skip-server-if-running',
79
'gui will not launch the server if it is already running'
810
)
911
.allowUnknownOption();
1012

13+
if (process.platform === "linux") {
14+
const noUdevOption = new Option('--no-udev', 'disable udev warning');
15+
noUdevOption.negate = false;
16+
program.addOption(noUdevOption)
17+
}
18+
1119
program.parse(process.argv);
1220
export const options = program.opts();

gui/electron/main/index.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { getPlatform, handleIpc, isPortAvailable } from './utils';
2020
import {
2121
findServerJar,
2222
findSystemJRE,
23+
getExeFolder,
2324
getGuiDataFolder,
2425
getLogsFolder,
2526
getServerDataFolder,
@@ -182,6 +183,8 @@ handleIpc(IPC_CHANNELS.GET_FOLDER, (e, folder) => {
182183
return getGuiDataFolder();
183184
case 'logs':
184185
return getLogsFolder();
186+
case 'exe':
187+
return getExeFolder();
185188
}
186189
});
187190

@@ -394,7 +397,16 @@ const spawnServer = async () => {
394397
logger.info({ javaBin, serverJar }, 'Found Java and server jar');
395398
const platform = getPlatform();
396399
const serverWorkdir = getServerDataFolder()
397-
const serverProcess = spawn(javaBin, ['-Xmx128M', '-jar', serverJar, 'run'], {
400+
401+
const serverArgs = ['-Xmx128M', '-jar', serverJar]
402+
if (options.steam) serverArgs.push(`--steam`)
403+
if (options.install) serverArgs.push(`--install`)
404+
if (options.noUdev) serverArgs.push(`--no-udev`)
405+
406+
serverArgs.push('run')
407+
408+
409+
const serverProcess = spawn(javaBin, serverArgs, {
398410
cwd: serverWorkdir,
399411
shell: false,
400412
env:

gui/electron/main/paths.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,21 @@ export const getLogsFolder = () => {
4848
return join(getGuiDataFolder(), 'logs');
4949
};
5050

51+
export const getExeFolder = () => {
52+
return path.dirname(app.getPath('exe'));
53+
};
54+
5155
export const getWindowStateFile = () =>
5256
join(getServerDataFolder(), '.window-state.json');
5357

5458
const localJavaBin = (sharedDir: string) => {
55-
const jre = join(sharedDir, 'jre/bin', javaBin);
56-
return jre;
59+
const platform = getPlatform();
60+
switch (platform) {
61+
case 'macos':
62+
return join(sharedDir, '../../../../jre/Contents/Home/bin', javaBin);
63+
default:
64+
return join(sharedDir, 'jre/bin', javaBin);
65+
}
5766
};
5867

5968
const javaHomeBin = () => {
@@ -112,6 +121,9 @@ export const findServerJar = () => {
112121
// For flatpack container
113122
path.resolve('/app/share/slimevr/'),
114123
path.resolve('/usr/share/slimevr/'),
124+
125+
// For macos on steam
126+
path.resolve(`${app.getPath('exe')}/../../../../`),
115127
];
116128
return paths
117129
.filter((p) => !!p)

gui/electron/preload/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@ contextBridge.exposeInMainWorld('electronAPI', {
3636
openLogsFolder: async () => ipcRenderer.invoke(IPC_CHANNELS.OPEN_FILE, await ipcRenderer.invoke(IPC_CHANNELS.GET_FOLDER, 'logs')),
3737
openFile: (path) => ipcRenderer.invoke(IPC_CHANNELS.OPEN_FILE, path),
3838
ghGet: (req) => ipcRenderer.invoke(IPC_CHANNELS.GH_FETCH, req),
39-
setPresence: (options) => ipcRenderer.invoke(IPC_CHANNELS.DISCORD_PRESENCE, options)
39+
setPresence: (options) => ipcRenderer.invoke(IPC_CHANNELS.DISCORD_PRESENCE, options),
40+
getInstallDir: () => ipcRenderer.invoke(IPC_CHANNELS.GET_FOLDER, 'exe')
4041
} satisfies IElectronAPI);

gui/electron/preload/interface.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export interface IElectronAPI {
5656
openFile: (path: string) => void;
5757
ghGet: <T extends GHGet>(options: T) => Promise<GHReturn[T['type']]>;
5858
setPresence: (options: DiscordPresence) => void;
59+
getInstallDir: () => Promise<string>;
5960
}
6061

6162
declare global {

gui/electron/shared.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export interface IpcInvokeMap {
4141
value?: unknown;
4242
}) => Promise<unknown>;
4343
[IPC_CHANNELS.OPEN_FILE]: (path: string) => void;
44-
[IPC_CHANNELS.GET_FOLDER]: (folder: 'config' | 'logs') => string;
44+
[IPC_CHANNELS.GET_FOLDER]: (folder: 'config' | 'logs' | 'exe') => string;
4545
[IPC_CHANNELS.GH_FETCH]: <T extends GHGet>(
4646
options: T
4747
) => Promise<GHReturn[T['type']]>;

gui/public/i18n/en/translation.ftl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,11 @@ onboarding-reset_tutorial-2 = Tap the highlighted tracker { $taps } times to tri
10241024
10251025
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.
10261026
1027+
## Install info
1028+
install-info_udev-rules_modal_title = Hardware udev access rules not found
1029+
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.
1030+
install-info_udev-rules_modal_button = Close
1031+
install-info_udev-rules_modal-dont-show-again_checkbox = Don't show again
10271032
## Setup start
10281033
onboarding-home = Welcome to SlimeVR
10291034
onboarding-home-start = Let's get set up!

gui/src/App.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { AutomaticProportionsPage } from './components/onboarding/pages/body-pro
1717
import { ManualProportionsPage } from './components/onboarding/pages/body-proportions/ManualProportions';
1818
import { ConnectTrackersPage } from './components/onboarding/pages/ConnectTracker';
1919
import { HomePage } from './components/onboarding/pages/Home';
20+
import { ErrorCollectingConsentPage } from './components/onboarding/pages/ErrorCollectingConsent';
2021
import { AutomaticMountingPage } from './components/onboarding/pages/mounting/AutomaticMounting';
2122
import { ManualMountingPage } from './components/onboarding/pages/mounting/ManualMounting';
2223
import { TrackersAssignPage } from './components/onboarding/pages/trackers-assign/TrackerAssignment';
@@ -58,6 +59,7 @@ import { QuizMocapPosQuestion } from './components/onboarding/pages/quiz/MocapPr
5859
import { ElectronContextC, provideElectron } from './hooks/electron';
5960
import { AppLocalizationProvider } from './i18n/config';
6061
import { openUrl } from './hooks/crossplatform';
62+
import { UdevRulesModal } from './components/onboarding/UdevRulesModal';
6163

6264
export const GH_REPO = 'SlimeVR/SlimeVR-Server';
6365
export const VersionContext = createContext('');
@@ -75,6 +77,7 @@ function Layout() {
7577
<SerialDetectionModal />
7678
<VersionUpdateModal />
7779
<UnknownDeviceModal />
80+
<UdevRulesModal />
7881
<SentryRoutes>
7982
<Route element={<AppLayout />}>
8083
<Route
@@ -152,6 +155,10 @@ function Layout() {
152155
}
153156
>
154157
<Route path="home" element={<HomePage />} />
158+
<Route
159+
path="error-collecting-consent"
160+
element={<ErrorCollectingConsentPage />}
161+
/>
155162
<Route path="wifi-creds" element={<WifiCredsPage />} />
156163
<Route path="quiz/slime-set" element={<QuizSlimeSetQuestion />} />
157164
<Route path="quiz/usage" element={<QuizUsageQuestion />} />

gui/src/AppLayout.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { useLayoutEffect } from 'react';
22
import { useConfig } from './hooks/config';
3-
import { Outlet, useNavigate } from 'react-router-dom';
3+
import { Outlet, useLocation, useNavigate } from 'react-router-dom';
44

55
export function AppLayout() {
66
const { config } = useConfig();
7+
const { pathname } = useLocation();
78
const navigate = useNavigate();
89

910
useLayoutEffect(() => {
@@ -28,10 +29,14 @@ export function AppLayout() {
2829
}, [config]);
2930

3031
useLayoutEffect(() => {
31-
if (config && !config.doneOnboarding) {
32+
if (
33+
config &&
34+
!config.doneOnboarding &&
35+
!pathname.startsWith('/onboarding/')
36+
) {
3237
navigate('/onboarding/home');
3338
}
34-
}, [config?.doneOnboarding]);
39+
}, [config]);
3540

3641
return (
3742
<>

gui/src/components/ErrorConsentModal.tsx

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)