From 86d2781e678beda507bb7fdccd86169c40e7f2d3 Mon Sep 17 00:00:00 2001 From: MathieuG-P <40181755+Zagrios@users.noreply.github.com> Date: Mon, 13 Mar 2023 01:33:25 +0100 Subject: [PATCH 1/2] [feature-177] remove useless stuff in settings --- src/renderer/pages/settings-page.component.tsx | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/renderer/pages/settings-page.component.tsx b/src/renderer/pages/settings-page.component.tsx index 9f68c2aa..90b6824c 100644 --- a/src/renderer/pages/settings-page.component.tsx +++ b/src/renderer/pages/settings-page.component.tsx @@ -40,7 +40,6 @@ export function SettingsPage() { const modalService: ModalService = ModalService.getInsance(); const downloaderService: BsDownloaderService = BsDownloaderService.getInstance(); const progressBarService: ProgressBarService = ProgressBarService.getInstance(); - const authService: AuthUserService = AuthUserService.getInstance(); const notificationService: NotificationService = NotificationService.getInstance(); const i18nService: I18nService = I18nService.getInstance(); const linkOpener: LinkOpenerService = LinkOpenerService.getInstance(); @@ -49,7 +48,6 @@ export function SettingsPage() { const modelsManager = ModelsManagerService.getInstance(); const {firstColor, secondColor} = useThemeColor(); - const sessionExist = useObservable(authService.sessionExist$); const themeItem: RadioItem[] = [ {id: 0, text: "pages.settings.appearance.themes.dark", value: "dark" as ThemeConfig}, @@ -133,12 +131,6 @@ export function SettingsPage() { }); } - const deleteSteamSession = () => { - if(!sessionExist){ return; } - authService.deleteSteamSession(); - notificationService.notifySuccess({title: "notifications.settings.steam.success.titles.logout", duration: 3000}); - }; - const toogleShowSupporters = () => { setShowSupporters(show => !show); @@ -196,10 +188,6 @@ export function SettingsPage() { nav(-1)} icon="close" withBar={false}/> - - - -
From 3b973e159757732ce25802e198ca0cb652af88b2 Mon Sep 17 00:00:00 2001 From: MathieuG-P <40181755+Zagrios@users.noreply.github.com> Date: Mon, 13 Mar 2023 01:34:51 +0100 Subject: [PATCH 2/2] [feature-177] add possibility to add additional arguments --- assets/jsons/translations/en.json | 6 ++++- assets/jsons/translations/es.json | 6 ++++- assets/jsons/translations/fr.json | 6 ++++- src/main/services/bs-launcher.service.ts | 17 +++++++----- .../slides/launch/launch-slide.component.tsx | 27 ++++++++++++++++--- src/renderer/services/bs-launcher.service.ts | 4 +-- .../bs-launch/launch-option.interface.ts | 9 ++++--- 7 files changed, 56 insertions(+), 19 deletions(-) diff --git a/assets/jsons/translations/en.json b/assets/jsons/translations/en.json index 247c51cf..a5c4fa7d 100644 --- a/assets/jsons/translations/en.json +++ b/assets/jsons/translations/en.json @@ -28,7 +28,11 @@ "desktop": "Desktop Mode", "desktop-description": "This allows you to use WASD and the mouse to navigate around the menu in game. This makes testing much easier, because you don't have to put on your headset!", "debug": "Debug Mode", - "debug-description": "Enables the output log window for IPA. This will show the debug console that mods use." + "debug-description": "Enables the output log window for IPA. This will show the debug console that mods use.", + "advanced-launch": { + "button": "Advanced launch", + "placeholder": "Additional arguments ex: --revert; --nowait" + } }, "maps": { "title": "Shared maps", diff --git a/assets/jsons/translations/es.json b/assets/jsons/translations/es.json index c122b051..5733c666 100644 --- a/assets/jsons/translations/es.json +++ b/assets/jsons/translations/es.json @@ -28,7 +28,11 @@ "desktop": "Desktop Mod", "desktop-description": "Esto te permite usar WASD y el mouse para navegar por el menú en juego. Esto hace que las pruebas sean mucho más fáciles, ¡porque no tienes que ponerte el auricular!", "debug": "Debug Mod", - "debug-description": "Habilita la ventana de registro de salida para IPA. Esto mostrará la consola de depuración que usan los mods." + "debug-description": "Habilita la ventana de registro de salida para IPA. Esto mostrará la consola de depuración que usan los mods.", + "advanced-launch": { + "button": "Lanzamiento avanzado", + "placeholder": "Argumentos adicionales ej: --revert; --no-wait" + } }, "maps": { "search-bar": { diff --git a/assets/jsons/translations/fr.json b/assets/jsons/translations/fr.json index 2e8e1b21..d1214096 100644 --- a/assets/jsons/translations/fr.json +++ b/assets/jsons/translations/fr.json @@ -28,7 +28,11 @@ "desktop": "Mode Bureau", "desktop-description": "Cela vous permet d'utiliser WASD et la souris pour naviguer dans le menu en jeu. Cela rend les tests beaucoup plus faciles, car vous n'avez pas à mettre votre casque!", "debug": "Mode Debug", - "debug-description": "Active la fenêtre de log pour IPA. Cela affichera la console de débogage utilisée par les mods." + "debug-description": "Active la fenêtre de log pour IPA. Cela affichera la console de débogage utilisée par les mods.", + "advanced-launch": { + "button": "Lancement avancé", + "placeholder": "Arguments supplémentaires ex: --revert; --nowait" + } }, "maps": { "search-bar": { diff --git a/src/main/services/bs-launcher.service.ts b/src/main/services/bs-launcher.service.ts index d3d299e7..23bdbaac 100644 --- a/src/main/services/bs-launcher.service.ts +++ b/src/main/services/bs-launcher.service.ts @@ -45,18 +45,21 @@ export class BSLauncherService{ if(!(await pathExist(exePath))){ return "EXE_NOT_FINDED"; } - const launchMods = []; + let launchArgs = []; - if(!launchOptions.version.steam && !launchOptions.version.oculus){ launchMods.push("--no-yeet"); } - if(launchOptions.oculus){ launchMods.push("-vrmode oculus"); } - if(launchOptions.desktop){ launchMods.push("fpfc"); } - if(launchOptions.debug){ launchMods.push("--verbose"); } + if(!launchOptions.version.steam && !launchOptions.version.oculus){ launchArgs.push("--no-yeet"); } + if(launchOptions.oculus){ launchArgs.push("-vrmode oculus"); } + if(launchOptions.desktop){ launchArgs.push("fpfc"); } + if(launchOptions.debug){ launchArgs.push("--verbose"); } + if(launchOptions.additionalArgs){ launchArgs.push(...launchOptions.additionalArgs); } + + launchArgs = Array.from(new Set(launchArgs).values()); if(launchOptions.debug){ - this.bsProcess = spawn(`\"${exePath}\"`, launchMods, {shell: true, cwd, env: {...process.env, "SteamAppId": BS_APP_ID}, detached: true, windowsVerbatimArguments: true }); + this.bsProcess = spawn(`\"${exePath}\"`, launchArgs, {shell: true, cwd, env: {...process.env, "SteamAppId": BS_APP_ID}, detached: true, windowsVerbatimArguments: true }); } else{ - this.bsProcess = spawn(`\"${exePath}\"`, launchMods, {shell: true, cwd, env: {...process.env, "SteamAppId": BS_APP_ID} }); + this.bsProcess = spawn(`\"${exePath}\"`, launchArgs, {shell: true, cwd, env: {...process.env, "SteamAppId": BS_APP_ID} }); } this.bsProcess.on('message', msg => console.log(msg)); diff --git a/src/renderer/components/version-viewer/slides/launch/launch-slide.component.tsx b/src/renderer/components/version-viewer/slides/launch/launch-slide.component.tsx index a077f9a4..c497101c 100644 --- a/src/renderer/components/version-viewer/slides/launch/launch-slide.component.tsx +++ b/src/renderer/components/version-viewer/slides/launch/launch-slide.component.tsx @@ -1,6 +1,8 @@ -import { useState } from "react"; +import { motion } from "framer-motion"; +import { ChangeEvent, useEffect, useState } from "react"; import { BsmButton } from "renderer/components/shared/bsm-button.component"; import { useObservable } from "renderer/hooks/use-observable.hook"; +import { useTranslation } from "renderer/hooks/use-translation.hook"; import { BSLauncherService, LaunchMods } from "renderer/services/bs-launcher.service"; import { ConfigurationService } from "renderer/services/configuration.service"; import { BSVersion } from "shared/bs-version.interface" @@ -10,15 +12,23 @@ type Props = {version: BSVersion}; export function LaunchSlide({version}: Props) { + const t = useTranslation(); + const configService = ConfigurationService.getInstance(); const bsLauncherService = BSLauncherService.getInstance(); const [oculusMode, setOculusMode] = useState(!!configService.get(LaunchMods.OCULUS_MOD)); const [desktopMode, setDesktopMode] = useState(!!configService.get(LaunchMods.DESKTOP_MOD)); const [debugMode, setDebugMode] = useState(!!configService.get(LaunchMods.DEBUG_MOD)); + const [advancedLaunch, setAdvancedLaunch] = useState(false); + const [additionalArgsString, setAdditionalArgsString] = useState(configService.get("additionnal-args") || ""); const launchState = useObservable(bsLauncherService.launchState$); + useEffect(() => { + configService.set("additionnal-args", additionalArgsString); + }, [additionalArgsString]); + const setMode = (mode: LaunchMods, value: boolean) => { if(mode === LaunchMods.DEBUG_MOD){ setDebugMode(value); @@ -32,7 +42,12 @@ export function LaunchSlide({version}: Props) { configService.set(mode, value); } - const launch = () => bsLauncherService.launch(version, version.oculus ? false : oculusMode, desktopMode, debugMode) + const handleAdditionalArgsChange = (e: ChangeEvent) => setAdditionalArgsString(() => e.target.value); + + const launch = () => { + const additionalArgs = advancedLaunch ? additionalArgsString.split(";").map(arg => arg.trim()).filter(arg => arg.length > 0) : undefined; + bsLauncherService.launch(version, version.oculus ? false : oculusMode, desktopMode, debugMode, additionalArgs); + } return (
@@ -41,8 +56,14 @@ export function LaunchSlide({version}: Props) { setMode(LaunchMods.DESKTOP_MOD, !desktopMode)} active={desktopMode} text="pages.version-viewer.launch-mods.desktop"/> setMode(LaunchMods.DEBUG_MOD, !debugMode)} active={debugMode} text="pages.version-viewer.launch-mods.debug"/>
+
+ {e.preventDefault(); setAdvancedLaunch(prev => !prev)}}/> + + + +
- +
) diff --git a/src/renderer/services/bs-launcher.service.ts b/src/renderer/services/bs-launcher.service.ts index 8aa32060..9e513122 100644 --- a/src/renderer/services/bs-launcher.service.ts +++ b/src/renderer/services/bs-launcher.service.ts @@ -40,8 +40,8 @@ export class BSLauncherService{ - public launch(version: BSVersion, oculus: boolean, desktop: boolean, debug: boolean): Promise{ - const lauchOption: LauchOption = {debug, oculus, desktop, version}; + public launch(version: BSVersion, oculus: boolean, desktop: boolean, debug: boolean, additionalArgs?: string[]): Promise{ + const lauchOption: LauchOption = {debug, oculus, desktop, version, additionalArgs}; if(this.launchState$.value){ return this.notificationService.notifyError({title: "notifications.bs-launch.errors.titles.BS_ALREADY_RUNNING"}); } this.launchState$.next(version); return this.ipcService.send("bs-launch.launch", {args: lauchOption}).then(res => { diff --git a/src/shared/models/bs-launch/launch-option.interface.ts b/src/shared/models/bs-launch/launch-option.interface.ts index f19e9ba5..cad8fecf 100644 --- a/src/shared/models/bs-launch/launch-option.interface.ts +++ b/src/shared/models/bs-launch/launch-option.interface.ts @@ -1,8 +1,9 @@ import { BSVersion } from "shared/bs-version.interface"; export interface LauchOption { - version: BSVersion, - oculus: boolean, - desktop: boolean, - debug: boolean + version: BSVersion, + oculus: boolean, + desktop: boolean, + debug: boolean, + additionalArgs?: string[] } \ No newline at end of file