diff --git a/assets/jsons/translations/fr.json b/assets/jsons/translations/fr.json index 6d492342..185b8b5d 100644 --- a/assets/jsons/translations/fr.json +++ b/assets/jsons/translations/fr.json @@ -202,12 +202,14 @@ "titles":{ "UNABLE_TO_LAUNCH": "Lancement impossible", "STEAM_NOT_RUNNING": "Steam n'est pas lancé", + "OCULUS_NOT_RUNNING": "Oculus n'est pas lancé", "BS_ALREADY_RUNNING": "BeatSaber est déjà lancé", "EXE_NOT_FINDED": "Fichiers manquants", "EXIT": "Arrêt brutal" }, "msg":{ "STEAM_NOT_RUNNING": "Steam doit être en cours d'exécution pour lancer BeatSaber.", + "OCULUS_NOT_RUNNING": "Oculus doit être en cours d'exécution pour lancer BeatSaber.", "BS_ALREADY_RUNNING": "Ferme BeatSaber avant de le lancer à nouveau.", "EXE_NOT_FINDED": "Quelques fichiers semblent manquants. Essaye de vérifier les fichiers.", "EXIT": "BeatSaber s'est arrêté brusquement, essaye de vérifier les fichiers." diff --git a/src/main/services/bs-launcher.service.ts b/src/main/services/bs-launcher.service.ts index 6b0a9e3e..b2368482 100644 --- a/src/main/services/bs-launcher.service.ts +++ b/src/main/services/bs-launcher.service.ts @@ -5,6 +5,7 @@ import { BS_EXECUTABLE, BS_APP_ID } from "../constants"; import { ChildProcessWithoutNullStreams, spawn } from "child_process"; import { SteamService } from "./steam.service"; import { BSLocalVersionService } from "./bs-local-version.service"; +import { OculusService } from "./oculus.service"; export class BSLauncherService{ @@ -12,6 +13,7 @@ export class BSLauncherService{ private readonly utilsService: UtilsService; private readonly steamService: SteamService; + private readonly oculusService: OculusService; private readonly localVersionService: BSLocalVersionService; private bsProcess: ChildProcessWithoutNullStreams; @@ -24,6 +26,7 @@ export class BSLauncherService{ private constructor(){ this.utilsService = UtilsService.getInstance(); this.steamService = SteamService.getInstance(); + this.oculusService = OculusService.getInstance(); this.localVersionService = BSLocalVersionService.getInstance(); } @@ -32,6 +35,7 @@ export class BSLauncherService{ } public async launch(launchOptions: LauchOption): Promise{ + if(launchOptions.version.oculus && !this.oculusService.oculusRunning()){ return "OCULUS_NOT_RUNNING" } if(!this.steamService.steamRunning()){ return "STEAM_NOT_RUNNING" } if(this.isBsRunning()){ return "BS_ALREADY_RUNNING" } @@ -42,7 +46,7 @@ export class BSLauncherService{ const launchMods = [launchOptions.oculus && "-vrmode oculus", launchOptions.desktop && "fpfc", launchOptions.debug && "--verbose"]; - this.bsProcess = spawn(`\"${exePath}\"`, launchMods, {shell: true, cwd: cwd, env: {...process.env, "SteamAppId": BS_APP_ID}}); + this.bsProcess = spawn(`\"${exePath}\"`, launchMods, {shell: true, cwd, env: {...process.env, "SteamAppId": BS_APP_ID}}); this.bsProcess.on('message', msg => { /** EMIT HERE **/ }); this.bsProcess.on('error', err => { /** EMIT HERE **/ }); diff --git a/src/main/services/bs-local-version.service.ts b/src/main/services/bs-local-version.service.ts index 06214d11..d908505b 100644 --- a/src/main/services/bs-local-version.service.ts +++ b/src/main/services/bs-local-version.service.ts @@ -154,7 +154,7 @@ export class BSLocalVersionService{ } public async deleteVersion(version: BSVersion): Promise{ - if(version.steam){ return false; } + if(version.steam || version.oculus){ return false; } const versionFolder = await this.getVersionPath(version); if(!this.utilsService.pathExist(versionFolder)){ return true; } @@ -164,7 +164,7 @@ export class BSLocalVersionService{ } public async editVersion(version: BSVersion, name: string, color: string): Promise{ - if(version.steam){ throw {title: "CantEditSteam", msg: "CantEditSteam"} as BsmException; } + if(version.steam || version.oculus){ throw {title: "CantEditSteam", msg: "CantEditSteam"} as BsmException; } const oldPath = await this.getVersionPath(version); const editedVersion: BSVersion = version.BSVersion === name ? {...version, name: undefined, color} @@ -192,7 +192,7 @@ export class BSLocalVersionService{ const originPath = await this.getVersionPath(version); const cloneVersion: BSVersion = version.BSVersion === name ? {...version, name: undefined, color} - : {...version, name: this.removeSpecialChar(name), color, steam: false}; + : {...version, name: this.removeSpecialChar(name), color, steam: false, oculus: false}; const newPath = await this.getVersionPath(cloneVersion); if(originPath === newPath){ diff --git a/src/renderer/components/nav-bar/bs-version-item.component.tsx b/src/renderer/components/nav-bar/bs-version-item.component.tsx index a6c879b4..c7d8aa0a 100644 --- a/src/renderer/components/nav-bar/bs-version-item.component.tsx +++ b/src/renderer/components/nav-bar/bs-version-item.component.tsx @@ -27,7 +27,7 @@ export function BsVersionItem(props: {version: BSVersion}) { const {firstColor, secondColor} = useThemeColor(); const isActive = (): boolean => { - return props.version?.BSVersion === state?.BSVersion && props?.version.steam === state?.steam && props?.version.name === state?.name; + return props.version?.BSVersion === state?.BSVersion && props?.version.steam === state?.steam && props?.version.oculus === state?.oculus && props?.version.name === state?.name; } const handleDoubleClick = () => { @@ -52,9 +52,9 @@ export function BsVersionItem(props: {version: BSVersion}) { useEffect(() => { const subs: Subscription[] = []; const downloadSub = combineLatest([downloaderService.currentBsVersionDownload$, downloaderService.downloadProgress$]).subscribe(vals => { - if(vals[0]?.BSVersion === props.version.BSVersion && vals[0]?.steam === props.version.steam && vals[0]?.name === props.version.name){ - setDownloading(true); - setDownloadPercent(vals[1]); + if(vals[0]?.BSVersion === props.version.BSVersion && vals[0]?.steam === props.version.steam && vals[0].oculus === props.version.oculus && vals[0]?.name === props.version.name){ + setDownloading(true); + setDownloadPercent(vals[1]); } else{ setDownloading(false); @@ -65,14 +65,24 @@ export function BsVersionItem(props: {version: BSVersion}) { return () => { subs.forEach(s => s.unsubscribe()); } }, []); + const renderIcon = () => { + const classes = "w-[19px] h-[19px] mr-[5px] shrink-0" + if(props.version.steam){ + return + } + if(props.version.oculus){ + return + } + return + } + return (
  • {downloading &&
    }
    - {props.version.steam && } - {!props.version.steam && } + {renderIcon()}
    {props.version.name || props.version.BSVersion}
    diff --git a/src/renderer/components/nav-bar/nav-bar.component.tsx b/src/renderer/components/nav-bar/nav-bar.component.tsx index 442f880e..2b2f73dd 100644 --- a/src/renderer/components/nav-bar/nav-bar.component.tsx +++ b/src/renderer/components/nav-bar/nav-bar.component.tsx @@ -19,10 +19,10 @@ export function NavBar() { {installedVersions && installedVersions.map((version) => )}
    - + - +
    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 137de37f..ebef41e7 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 @@ -6,9 +6,9 @@ import { ConfigurationService } from "renderer/services/configuration.service"; import { BSVersion } from "shared/bs-version.interface" import { LaunchModToogle } from "./launch-mod-toogle.component"; -type props = {version: BSVersion}; +type Props = {version: BSVersion}; -export function LaunchSlide({version}: props) { +export function LaunchSlide({version}: Props) { const configService = ConfigurationService.getInstance(); const bsLauncherService = BSLauncherService.getInstance(); @@ -34,12 +34,12 @@ export function LaunchSlide({version}: props) { configService.set(mode, value); } - const launch = () => bsLauncherService.launch(version, oculusMode, desktopMode, debugMode) + const launch = () => bsLauncherService.launch(version, version.oculus ? false : oculusMode, desktopMode, debugMode) return (
    -
    - setMode(LaunchMods.OCULUS_MOD, !oculusMode)} active={oculusMode} text="pages.version-viewer.launch-mods.oculus"/> +
    + {!version.oculus && setMode(LaunchMods.OCULUS_MOD, !oculusMode)} active={oculusMode} text="pages.version-viewer.launch-mods.oculus"/>} 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"/>
    diff --git a/src/renderer/pages/version-viewer.component.tsx b/src/renderer/pages/version-viewer.component.tsx index 3e0815f9..41bba599 100644 --- a/src/renderer/pages/version-viewer.component.tsx +++ b/src/renderer/pages/version-viewer.component.tsx @@ -80,11 +80,11 @@ export function VersionViewer() {
    ) diff --git a/src/renderer/services/bs-version-manager.service.ts b/src/renderer/services/bs-version-manager.service.ts index 56eee2e1..f1ee55c5 100644 --- a/src/renderer/services/bs-version-manager.service.ts +++ b/src/renderer/services/bs-version-manager.service.ts @@ -33,10 +33,14 @@ export class BSVersionManagerService { public setInstalledVersions(versions: BSVersion[]){ const sorted: BSVersion[] = versions.sort((a, b) => +b.ReleaseDate - +a.ReleaseDate) const steamIndex = sorted.findIndex(v => v.steam); + const oculusIndex = sorted.findIndex(v => v.oculus); if(steamIndex > 0){ [sorted[0], sorted[steamIndex]] = [sorted[steamIndex], sorted[0]]; } - const cleanedSort = [...new Map(sorted.map(version => [`${version.BSVersion}-${version.name}-${version.steam}`, version])).values()] + if(oculusIndex > 0){ + [sorted[steamIndex > 0 ? 1 : 0], sorted[steamIndex]] = [sorted[steamIndex], sorted[steamIndex > 0 ? 1 : 0]]; + } + const cleanedSort = [...new Map(sorted.map(version => [`${version.BSVersion}-${version.name}-${version.steam}-${version.oculus}`, version])).values()] this.installedVersions$.next(cleanedSort); } @@ -63,7 +67,7 @@ export class BSVersionManagerService { } public isVersionInstalled(version: BSVersion): boolean{ - return !!this.getInstalledVersions().find(v => v.BSVersion === version.BSVersion && v.steam === version.steam); + return !!this.getInstalledVersions().find(v => v.BSVersion === version.BSVersion && v.steam === version.steam && v.oculus === version.oculus); } public getAvaibleVersionsOfYear(year: string): BSVersion[]{ diff --git a/src/shared/models/bs-launch/launch-result.interface.ts b/src/shared/models/bs-launch/launch-result.interface.ts index 1d7cd1ef..95dd44c6 100644 --- a/src/shared/models/bs-launch/launch-result.interface.ts +++ b/src/shared/models/bs-launch/launch-result.interface.ts @@ -1,6 +1,6 @@ export type LaunchResult = ( "LAUNCHED"| - "STEAM_NOT_RUNNING"| + "STEAM_NOT_RUNNING"|"OCULUS_NOT_RUNNING"| "EXE_NOT_FINDED"| "BS_ALREADY_RUNNING" ) \ No newline at end of file