From 5b82f4c1628b00df300f41edb0fa80f866a1348d Mon Sep 17 00:00:00 2001 From: MathieuG-P <40181755+Zagrios@users.noreply.github.com> Date: Wed, 26 Oct 2022 01:13:12 +0200 Subject: [PATCH 1/5] detection of oculus beat saber installation --- src/main/constants.ts | 1 + src/main/services/bs-local-version.service.ts | 51 ++++++++++----- src/main/services/bs-version-lib.service.ts | 27 ++++---- src/main/services/oculus.service.ts | 63 +++++++++++++++++++ src/shared/bs-version.interface.ts | 1 + 5 files changed, 116 insertions(+), 27 deletions(-) create mode 100644 src/main/services/oculus.service.ts diff --git a/src/main/constants.ts b/src/main/constants.ts index dfe276d9..24c72eda 100644 --- a/src/main/constants.ts +++ b/src/main/constants.ts @@ -1,3 +1,4 @@ export const BS_EXECUTABLE = "Beat Saber.exe"; +export const OCULUS_BS_DIR = "hyperbolic-magnetism-beat-saber" export const BS_APP_ID = "620980"; export const BS_DEPOT = "620981"; diff --git a/src/main/services/bs-local-version.service.ts b/src/main/services/bs-local-version.service.ts index 59ca0c6f..06214d11 100644 --- a/src/main/services/bs-local-version.service.ts +++ b/src/main/services/bs-local-version.service.ts @@ -3,7 +3,7 @@ import { BSVersion } from 'shared/bs-version.interface'; import { InstallationLocationService } from "./installation-location.service"; import { SteamService } from "./steam.service"; import { UtilsService } from "./utils.service"; -import { BS_APP_ID } from "../constants"; +import { BS_APP_ID, OCULUS_BS_DIR } from "../constants"; import path from "path"; import { createInterface } from "readline"; import { createReadStream } from "fs"; @@ -12,6 +12,8 @@ import { ConfigurationService } from "./configuration.service"; import { rename } from "fs/promises"; import { BsmException } from "shared/models/bsm-exception.model"; import log from "electron-log"; +import { OculusService } from "./oculus.service"; +import { DownloadLinkType } from "shared/models/mods"; export class BSLocalVersionService{ @@ -22,6 +24,7 @@ export class BSLocalVersionService{ private readonly installLocationService: InstallationLocationService; private readonly utilsService: UtilsService; private readonly steamService: SteamService; + private readonly oculusService: OculusService; private readonly remoteVersionService: BSVersionLibService; private readonly configService: ConfigurationService; @@ -34,6 +37,7 @@ export class BSLocalVersionService{ this.installLocationService = InstallationLocationService.getInstance(); this.utilsService = UtilsService.getInstance(); this.steamService = SteamService.getInstance(); + this.oculusService = OculusService.getInstance(); this.remoteVersionService = BSVersionLibService.getInstance(); this.configService = ConfigurationService.getInstance(); } @@ -80,6 +84,7 @@ export class BSLocalVersionService{ public async getVersionPath(version: BSVersion): Promise{ if(version.steam){ return this.steamService.getGameFolder(BS_APP_ID, "Beat Saber") } + if(version.oculus){ return this.oculusService.getGameFolder(OCULUS_BS_DIR); } return path.join( this.installLocationService.versionsDirectory, this.getVersionFolder(version) @@ -87,7 +92,6 @@ export class BSLocalVersionService{ } private removeSpecialChar(seq: string): string{ - // eslint-disable-next-line no-useless-escape return seq.replace( /[<>:"\/\\|?*]+/g, '' ); } @@ -95,27 +99,46 @@ export class BSLocalVersionService{ return version.name ? `${version.BSVersion}-${version.name}` : version.BSVersion; } - public getVersionType(version: BSVersion): "steam"|"universal"{ + public getVersionType(version: BSVersion): DownloadLinkType{ if(version.steam){ return "steam"; } + if(version.oculus){ return "oculus"; } return "universal" } + private async getSteamVersion(): Promise{ + const steamBsFolder = await this.steamService.getGameFolder(BS_APP_ID, "Beat Saber"); + if(!steamBsFolder || !this.utilsService.pathExist(steamBsFolder)){ return null; } + const steamBsVersion = await this.getVersionOfBSFolder(steamBsFolder); + if(!steamBsVersion){ return null; } + const version = await this.remoteVersionService.getVersionDetails(steamBsVersion); + if(!version){ return null; } + return {...version, steam: true}; + } + + private async getOculusVersion(): Promise{ + const oculusBsFolder = await this.oculusService.getGameFolder(OCULUS_BS_DIR); + if(!oculusBsFolder){ return null; } + const oculusBsVersion = await this.getVersionOfBSFolder(oculusBsFolder); + if(!oculusBsVersion){ return null; } + const version = await this.remoteVersionService.getVersionDetails(oculusBsVersion); + if(!version){ return null; } + return {...version, oculus: true}; + } + public async getInstalledVersions(): Promise{ + const versions: BSVersion[] = []; - const steamBsFolder = await this.steamService.getGameFolder(BS_APP_ID, "Beat Saber"); - if(steamBsFolder && this.utilsService.pathExist(steamBsFolder)){ - const steamBsVersion = await this.getVersionOfBSFolder(steamBsFolder); - if(steamBsVersion){ - const steamVersionDetails = this.remoteVersionService.getVersionDetails(steamBsVersion); - versions.push(steamVersionDetails ? {...steamVersionDetails, steam: true} : {BSVersion: steamBsVersion, steam: true}); - } - } + const steamVersion = await this.getSteamVersion(); + if(steamVersion){ versions.push(steamVersion); } + const oculusVersion = await this.getOculusVersion(); + if(oculusVersion){ versions.push(oculusVersion); } + if(!this.utilsService.pathExist(this.installLocationService.versionsDirectory)){ return versions } const folderInInstallation = this.utilsService.listDirsInDir(this.installLocationService.versionsDirectory); - folderInInstallation.forEach(f => { + for(const f of folderInInstallation){ log.info("try get version from folder", f); - let version = this.remoteVersionService.getVersionDetails(f); + let version = await this.remoteVersionService.getVersionDetails(f); if(version){ version = this.getCustomVersions().find(v => v.BSVersion === version.BSVersion && v.name === version.name) ?? version; } else { version = this.getCustomVersions().find(v => { const [version, ...rest] = f.split("-"); @@ -125,7 +148,7 @@ export class BSLocalVersionService{ }) } version && versions.push(version); - }); + }; this.setCustomVersions(versions.filter(v => !!v.name || !!v.color)); return versions; } diff --git a/src/main/services/bs-version-lib.service.ts b/src/main/services/bs-version-lib.service.ts index ed06e7ed..1ffe437b 100644 --- a/src/main/services/bs-version-lib.service.ts +++ b/src/main/services/bs-version-lib.service.ts @@ -16,7 +16,7 @@ export class BSVersionLibService{ private utilsService: UtilsService; private requestService: RequestService - private bsVersions: BSVersion[] = []; + private bsVersions: BSVersion[]; private constructor(){ this.utilsService = UtilsService.getInstance(); @@ -44,25 +44,26 @@ export class BSVersionLibService{ writeFileSync(localVersionsPath, JSON.stringify(versions, null, "\t"), {encoding: 'utf-8', flag: 'w'}); }; - private async loadBsVersions(): Promise{ - const [localVersions, remoteVersions] = await Promise.all([ - this.getLocalVersions(), (await isOnline({timeout: 1500}) && this.getRemoteVersions()) - ]); - let resVersions = localVersions; - if(remoteVersions && remoteVersions.length){ resVersions = remoteVersions; this.updateLocalVersions(resVersions); } - this.bsVersions = resVersions; - return this.bsVersions; + private async loadBsVersions(): Promise{ + if(this.bsVersions){ return this.bsVersions; } + const [localVersions, remoteVersions] = await Promise.all([ + this.getLocalVersions(), (await isOnline({timeout: 1500}) && this.getRemoteVersions()) + ]); + let resVersions = localVersions; + if(remoteVersions && remoteVersions.length){ resVersions = remoteVersions; this.updateLocalVersions(resVersions); } + this.bsVersions = resVersions; + return this.bsVersions; } public async getAvailableVersions(): Promise{ - if(this.bsVersions && this.bsVersions.length){ return this.bsVersions; } const bsVersions = await this.loadBsVersions(); if(!bsVersions || !bsVersions.length){ return []; } return bsVersions; } - public getVersionDetails(version: string): BSVersion{ - return this.bsVersions.find(v => v.BSVersion === version); - } + public async getVersionDetails(version: string): Promise{ + const versions = await this.getAvailableVersions(); + return versions.find(v => v.BSVersion === version); + } } \ No newline at end of file diff --git a/src/main/services/oculus.service.ts b/src/main/services/oculus.service.ts new file mode 100644 index 00000000..da184b5f --- /dev/null +++ b/src/main/services/oculus.service.ts @@ -0,0 +1,63 @@ +import { UtilsService } from "./utils.service"; +import regedit from 'regedit' +import path from "path"; + +export class OculusService { + + private static instance: OculusService; + + private readonly utils: UtilsService; + + private oculusPaths: string[]; + + public static getInstance(): OculusService{ + if(!OculusService.instance){ OculusService.instance = new OculusService(); } + return OculusService.instance; + } + + private constructor(){ + this.utils = UtilsService.getInstance(); + } + + public oculusRunning(): boolean{ + return this.utils.taskRunning("OculusClient.exe"); + } + + public async getOculusLibsPath(): Promise{ + + if(this.oculusPaths){ return this.oculusPaths; } + + const oculusLibsRegKey = "HKCU\\SOFTWARE\\Oculus VR, LLC\\Oculus\\Libraries"; + + const libsRegData = (await regedit.promisified.list([oculusLibsRegKey]))["HKCU\\SOFTWARE\\Oculus VR, LLC\\Oculus\\Libraries"]; + + if(!libsRegData.exists || !libsRegData.keys){ return null; } + + const libsPath = (await Promise.all(libsRegData.keys.map(async key => { + const originalPath = (await regedit.promisified.list([`${oculusLibsRegKey}\\${key}`]))[`${oculusLibsRegKey}\\${key}`]; + if(!originalPath.exists || !libsRegData.values || !originalPath.values["OriginalPath"]){ return null; } + + return originalPath.values["OriginalPath"].value as string; + + }, []))).filter(path => !!path); + + this.oculusPaths = libsPath; + + return libsPath; + + } + + public async getGameFolder(gameFolder: string): Promise{ + + const libsFolders = await this.getOculusLibsPath(); + const rootLibDir = "Software" + + for(const lib of libsFolders){ + const gameFullPath = path.join(lib, rootLibDir, gameFolder); + if(this.utils.pathExist(gameFullPath)){ return gameFullPath; } + } + + return null; + } + +} \ No newline at end of file diff --git a/src/shared/bs-version.interface.ts b/src/shared/bs-version.interface.ts index b8155fdb..49aa1f27 100644 --- a/src/shared/bs-version.interface.ts +++ b/src/shared/bs-version.interface.ts @@ -6,6 +6,7 @@ export interface BSVersion { ReleaseDate?: string, year?: string, steam?: boolean, + oculus?: boolean, name?: string, color?: string } \ No newline at end of file From a9646209e134d5a06fbf1a40cf30cea49288ff4e Mon Sep 17 00:00:00 2001 From: MathieuG-P Date: Sun, 30 Oct 2022 22:40:18 +0100 Subject: [PATCH 2/5] oculus detection complete --- assets/jsons/translations/fr.json | 2 ++ src/main/services/bs-launcher.service.ts | 6 ++++- src/main/services/bs-local-version.service.ts | 6 ++--- .../nav-bar/bs-version-item.component.tsx | 22 ++++++++++++++----- .../components/nav-bar/nav-bar.component.tsx | 4 ++-- .../slides/launch/launch-slide.component.tsx | 10 ++++----- .../pages/version-viewer.component.tsx | 10 ++++----- .../services/bs-version-manager.service.ts | 8 +++++-- .../bs-launch/launch-result.interface.ts | 2 +- 9 files changed, 45 insertions(+), 25 deletions(-) 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 From dcb932859b60b8fb5cc1513e28a02b7e49a9413c Mon Sep 17 00:00:00 2001 From: MathieuG-P <40181755+Zagrios@users.noreply.github.com> Date: Mon, 31 Oct 2022 20:22:28 +0100 Subject: [PATCH 3/5] fix steam running check even if it's oculus version --- src/main/services/bs-launcher.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/services/bs-launcher.service.ts b/src/main/services/bs-launcher.service.ts index b2368482..e15811c4 100644 --- a/src/main/services/bs-launcher.service.ts +++ b/src/main/services/bs-launcher.service.ts @@ -36,7 +36,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(!launchOptions.version.oculus && !this.steamService.steamRunning()){ return "STEAM_NOT_RUNNING" } if(this.isBsRunning()){ return "BS_ALREADY_RUNNING" } const cwd = await this.localVersionService.getVersionPath(launchOptions.version); From 26236ba024a560ce58c2b53363e13fdd24074b8f Mon Sep 17 00:00:00 2001 From: MathieuG-P <40181755+Zagrios@users.noreply.github.com> Date: Mon, 31 Oct 2022 20:26:08 +0100 Subject: [PATCH 4/5] add transltations --- assets/jsons/translations/en.json | 2 ++ assets/jsons/translations/es.json | 2 ++ 2 files changed, 4 insertions(+) diff --git a/assets/jsons/translations/en.json b/assets/jsons/translations/en.json index 37c4ab7e..0a0bb916 100644 --- a/assets/jsons/translations/en.json +++ b/assets/jsons/translations/en.json @@ -202,12 +202,14 @@ "titles":{ "UNABLE_TO_LAUNCH": "Unable to launch", "STEAM_NOT_RUNNING": "Steam is not running", + "OCULUS_NOT_RUNNING": "Oculus is not running", "BS_ALREADY_RUNNING": "BeatSaber already running", "EXE_NOT_FINDED": "Missing files", "EXIT": "Abrupt stop" }, "msg":{ "STEAM_NOT_RUNNING": "Steam must be running to launch BeatSaber.", + "OCULUS_NOT_RUNNING": "Oculus must be running to launch BeatSaber.", "BS_ALREADY_RUNNING": "Close BeatSaber before launching it again.", "EXE_NOT_FINDED": "Some files seem to be missing, try to verify the files.", "EXIT": "BeatSaber stopped abruptly, tries to check the files." diff --git a/assets/jsons/translations/es.json b/assets/jsons/translations/es.json index a525200d..7b1f4d53 100644 --- a/assets/jsons/translations/es.json +++ b/assets/jsons/translations/es.json @@ -203,12 +203,14 @@ "titles":{ "UNABLE_TO_LAUNCH": "No se puede lanzar", "STEAM_NOT_RUNNING": "Steam no funciona", + "OCULUS_NOT_RUNNING": "Oculus no funciona", "BS_ALREADY_RUNNING": "BeatSaber ya está en marcha", "EXE_NOT_FINDED": "Archivos perdidos", "EXIT": "Parada abrupta" }, "msg":{ "STEAM_NOT_RUNNING": "Para iniciar BeatSaber es necesario que Steam esté en funcionamiento.", + "OCULUS_NOT_RUNNING": "Oculus debe estar funcionando para lanzar BeatSaber.", "BS_ALREADY_RUNNING": "Cierra BeatSaber antes de volver a lanzarlo.", "EXE_NOT_FINDED": "Parece que faltan algunos archivos, intente verificar los archivos.", "EXIT": "BeatSaber se detuvo abruptamente, trata de revisar los archivos." From 4d6d3cf4f8986b841d6d8a9392ad4c181c93b682 Mon Sep 17 00:00:00 2001 From: MathieuG-P <40181755+Zagrios@users.noreply.github.com> Date: Mon, 31 Oct 2022 20:28:44 +0100 Subject: [PATCH 5/5] remove useless imports --- src/main/ipcs/bs-version-ipcs.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/ipcs/bs-version-ipcs.ts b/src/main/ipcs/bs-version-ipcs.ts index de28bf17..1fb0cfd3 100644 --- a/src/main/ipcs/bs-version-ipcs.ts +++ b/src/main/ipcs/bs-version-ipcs.ts @@ -2,13 +2,9 @@ import { ipcMain } from 'electron'; import { UtilsService } from '../services/utils.service'; import { BSVersionLibService } from '../services/bs-version-lib.service' import { BSVersion } from 'shared/bs-version.interface'; -import path from 'path'; import { exec } from 'child_process'; -import { SteamService } from '../services/steam.service'; -import { BS_APP_ID } from '../constants'; import { IpcRequest } from 'shared/models/ipc'; import { BSLocalVersionService } from '../services/bs-local-version.service'; -import { InstallationLocationService } from '../services/installation-location.service'; import { BsmException } from 'shared/models/bsm-exception.model'; ipcMain.on('bs-version.get-version-dict', (event, req: IpcRequest) => {