Merge pull request #314 from Zagrios/bugfix/steamvr-not-retored-after-fpfc-mode/313

[bugfix-313] Restore SteamVR shortly after launching BS and on disabl…
This commit is contained in:
MathieuG-P
2023-08-28 16:45:18 +02:00
committed by GitHub
4 changed files with 20 additions and 6 deletions
+6
View File
@@ -15,3 +15,9 @@ ipc.on<LaunchOption>("create-launch-shortcut", (req, reply) => {
const bsLauncher = BSLauncherService.getInstance();
reply(from(bsLauncher.createLaunchShortcut(req.args)));
});
ipc.on<void>("bs-launch.restore-steamvr", (_, reply) => {
const bsLauncher = BSLauncherService.getInstance();
reply(from(bsLauncher.restoreSteamVR()));
});
+4 -4
View File
@@ -8,7 +8,7 @@ import { BSLocalVersionService } from "./bs-local-version.service";
import { pathExist } from "../helpers/fs.helpers";
import { rename } from "fs/promises";
import log from "electron-log";
import { Observable, lastValueFrom, of, timer } from "rxjs";
import { Observable, of } from "rxjs";
import { BsmProtocolService } from "./bsm-protocol.service";
import { app, shell} from "electron";
import { Resvg } from "@resvg/resvg-js";
@@ -144,7 +144,6 @@ export class BSLauncherService {
await this.backupSteamVR().catch(() => {
return this.restoreSteamVR();
});
await lastValueFrom(timer(2_000));
} else if(!launchOptions.version.oculus){
await this.restoreSteamVR();
}
@@ -163,13 +162,14 @@ export class BSLauncherService {
bsProcess.removeAllListeners("error");
bsProcess.removeAllListeners("exit");
resolve(-1);
}, 4000);
}, 15_000);
}).then(exitCode => {
log.info("BS process exit code", exitCode);
}).catch(err => {
log.error(err);
obs.error({type: BSLaunchError.BS_EXIT_ERROR, data: err} as BSLaunchErrorData);
}).finally(() => {
this.restoreSteamVR().catch(log.error);
});
})().then(() => {
@@ -31,6 +31,11 @@ export function LaunchSlide({ version }: Props) {
configService.set("additionnal-args", additionalArgsString);
}, [additionalArgsString]);
useEffect(() => {
if(desktopMode){ return; }
bsLauncherService.restoreSteamVR();
}, [desktopMode]);
const setMode = (mode: LaunchMods, value: boolean) => {
if (mode === LaunchMods.DEBUG_MOD) {
setDebugMode(value);
+5 -2
View File
@@ -2,7 +2,7 @@ import { LaunchOption, BSLaunchEvent, BSLaunchWarning, BSLaunchEventData, BSLaun
import { BSVersion } from 'shared/bs-version.interface';
import { IpcService } from "./ipc.service";
import { NotificationService } from "./notification.service";
import { BehaviorSubject, Observable, filter } from "rxjs";
import { BehaviorSubject, Observable, filter, lastValueFrom } from "rxjs";
import { ConfigurationService } from "./configuration.service";
import { ThemeService } from "./theme.service";
@@ -37,7 +37,7 @@ export class BSLauncherService {
additionalArgs: (this.config.get<string>("additionnal-args") || "").split(";").map(arg => arg.trim()).filter(arg => arg.length > 0)
}
}
public doLaunch(launchOptions: LaunchOption): Observable<BSLaunchEventData>{
return this.ipcService.sendV2<BSLaunchEventData, LaunchOption>("bs-launch.launch", {args: launchOptions});
}
@@ -73,6 +73,9 @@ export class BSLauncherService {
return this.ipcService.sendV2<void, LaunchOption>("create-launch-shortcut", {args: options});
}
public restoreSteamVR(): Promise<void>{
return lastValueFrom(this.ipcService.sendV2<void, void>("bs-launch.restore-steamvr"));
}
}
export enum LaunchMods {