mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
Merge remote-tracking branch 'origin/master' into feat/702-respect-system-proxy-windows
This commit is contained in:
@@ -7,6 +7,7 @@ import { sToMs } from "../../../shared/helpers/time.helpers";
|
||||
import { LinuxService } from "../linux.service";
|
||||
import { bsmSpawn } from "main/helpers/os.helpers";
|
||||
import { IS_FLATPAK } from "main/constants";
|
||||
import { LaunchMods } from "shared/models/bs-launch/launch-option.interface";
|
||||
|
||||
export abstract class AbstractLauncherService {
|
||||
|
||||
@@ -24,16 +25,20 @@ export abstract class AbstractLauncherService {
|
||||
if(!launchOptions.version.steam && !launchOptions.version.oculus){
|
||||
launchArgs.push("--no-yeet")
|
||||
}
|
||||
if (launchOptions.oculus) {
|
||||
if(launchOptions.launchMods?.includes(LaunchMods.OCULUS)) {
|
||||
launchArgs.push("-vrmode");
|
||||
launchArgs.push("oculus");
|
||||
}
|
||||
if (launchOptions.desktop) {
|
||||
if(launchOptions.launchMods?.includes(LaunchMods.FPFC)) {
|
||||
launchArgs.push("fpfc");
|
||||
}
|
||||
if (launchOptions.debug) {
|
||||
if(launchOptions.launchMods?.includes(LaunchMods.DEBUG)) {
|
||||
launchArgs.push("--verbose");
|
||||
}
|
||||
if(launchOptions.launchMods?.includes(LaunchMods.EDITOR)) {
|
||||
launchArgs.push("editor");
|
||||
}
|
||||
|
||||
if (launchOptions.additionalArgs) {
|
||||
launchArgs.push(...launchOptions.additionalArgs);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import { SteamLauncherService } from "./steam-launcher.service";
|
||||
import { OculusLauncherService } from "./oculus-launcher.service";
|
||||
import { BSVersion } from "shared/bs-version.interface";
|
||||
import { BsStore } from "../../../shared/models/bs-store.enum";
|
||||
import { LaunchMod, LaunchMods } from "shared/models/bs-launch/launch-option.interface";
|
||||
|
||||
export class BSLauncherService {
|
||||
private static instance: BSLauncherService;
|
||||
@@ -94,6 +95,14 @@ export class BSLauncherService {
|
||||
}
|
||||
|
||||
private shortcutParamsToLaunchOption(params: ShortcutParams): LaunchOption{
|
||||
|
||||
const launchMods: LaunchMod[] = [];
|
||||
|
||||
if(params.oculusMode === "true"){ launchMods.push(LaunchMods.OCULUS); }
|
||||
if(params.desktopMode === "true"){ launchMods.push(LaunchMods.FPFC); }
|
||||
if(params.debug === "true"){ launchMods.push(LaunchMods.DEBUG); }
|
||||
if(params.skipSteam === "true"){ launchMods.push(LaunchMods.SKIP_STEAM); }
|
||||
|
||||
const res: LaunchOption = {
|
||||
version: {
|
||||
BSVersion: params.version,
|
||||
@@ -102,10 +111,8 @@ export class BSLauncherService {
|
||||
oculus: params.versionOculus === "true",
|
||||
ino: +params.versionIno
|
||||
},
|
||||
oculus: params.oculusMode === "true",
|
||||
desktop: params.desktopMode === "true",
|
||||
debug: params.debug === "true",
|
||||
additionalArgs: params.additionalArgs
|
||||
additionalArgs: params.additionalArgs,
|
||||
launchMods,
|
||||
};
|
||||
|
||||
return res;
|
||||
@@ -119,10 +126,11 @@ export class BSLauncherService {
|
||||
if(launchOptions.version.oculus){ res.versionOculus = `${launchOptions.version.oculus}`; }
|
||||
if(launchOptions.version.ino){ res.versionIno = `${launchOptions.version.ino}`; }
|
||||
|
||||
if(launchOptions.oculus){ res.oculusMode = "true"; }
|
||||
if(launchOptions.desktop){ res.desktopMode = "true"; }
|
||||
if(launchOptions.debug){ res.debug = "true"; }
|
||||
if(launchOptions.launchMods?.includes(LaunchMods.OCULUS)){ res.oculusMode = "true"; }
|
||||
if(launchOptions.launchMods?.includes(LaunchMods.FPFC)){ res.desktopMode = "true"; }
|
||||
if(launchOptions.launchMods?.includes(LaunchMods.DEBUG)){ res.debug = "true"; }
|
||||
if(launchOptions.additionalArgs){ res.additionalArgs = launchOptions.additionalArgs; }
|
||||
if(launchOptions.launchMods?.includes(LaunchMods.SKIP_STEAM)){ res.skipSteam = "true"; }
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -239,6 +247,7 @@ type ShortcutParams = {
|
||||
desktopMode?: string;
|
||||
debug?: string;
|
||||
additionalArgs?: string[];
|
||||
skipSteam?: string;
|
||||
version: string;
|
||||
versionName?: string;
|
||||
versionIno?: string;
|
||||
|
||||
@@ -10,6 +10,7 @@ import { AbstractLauncherService } from "./abstract-launcher.service";
|
||||
import { CustomError } from "../../../shared/models/exceptions/custom-error.class";
|
||||
import { UtilsService } from "../utils.service";
|
||||
import { exec } from "child_process";
|
||||
import { LaunchMods } from "shared/models/bs-launch/launch-option.interface";
|
||||
|
||||
export class SteamLauncherService extends AbstractLauncherService implements StoreLauncherInterface{
|
||||
|
||||
@@ -73,8 +74,11 @@ export class SteamLauncherService extends AbstractLauncherService implements Sto
|
||||
throw CustomError.fromError(new Error(`Path not exist : ${bsExePath}`), BSLaunchError.BS_NOT_FOUND);
|
||||
}
|
||||
|
||||
const skipSteam: boolean = launchOptions.launchMods?.includes(LaunchMods.SKIP_STEAM) ?? false;
|
||||
|
||||
// Open Steam if not running
|
||||
if(!(await this.steam.isSteamRunning())){
|
||||
if(!skipSteam && !(await this.steam.isSteamRunning())){
|
||||
|
||||
obs.next({type: BSLaunchEvent.STEAM_LAUNCHING});
|
||||
|
||||
await this.steam.openSteam().then(() => {
|
||||
@@ -84,9 +88,12 @@ export class SteamLauncherService extends AbstractLauncherService implements Sto
|
||||
obs.next({type: BSLaunchWarning.UNABLE_TO_LAUNCH_STEAM});
|
||||
});
|
||||
}
|
||||
else {
|
||||
obs.next({ type: BSLaunchEvent.SKIPPING_STEAM_LAUNCH});
|
||||
}
|
||||
|
||||
// Backup SteamVR when desktop mode is enabled
|
||||
if(launchOptions.desktop){
|
||||
if(launchOptions.launchMods?.includes(LaunchMods.FPFC)){
|
||||
await this.backupSteamVR().catch(() => {
|
||||
return this.restoreSteamVR();
|
||||
});
|
||||
|
||||
@@ -42,7 +42,7 @@ export class BSVersionLibService {
|
||||
|
||||
private async shouldLoadFromConfig(): Promise<boolean> {
|
||||
// Some special cases of readonly memory installations
|
||||
return IS_FLATPAK || this.linuxService.isNixOS();
|
||||
return process.platform === "linux" && (IS_FLATPAK || this.linuxService.isNixOS());
|
||||
}
|
||||
|
||||
private async getLocalVersions(): Promise<BSVersion[]> {
|
||||
|
||||
@@ -21,19 +21,24 @@ export class FolderLinkerService {
|
||||
private readonly installLocationService = InstallationLocationService.getInstance();
|
||||
private readonly staticConfig: StaticConfigurationService;
|
||||
|
||||
private linkingType: "junction" | "symlink" = "junction";
|
||||
// Only Windows support "junction", this is disregarded in other os'es
|
||||
private linkingType: "junction" | "symlink" =
|
||||
process.platform === "win32" ? "junction" : "symlink";
|
||||
|
||||
private constructor() {
|
||||
this.installLocationService = InstallationLocationService.getInstance();
|
||||
this.staticConfig = StaticConfigurationService.getInstance();
|
||||
|
||||
this.linkingType = this.staticConfig.get("use-symlinks") === true ? "symlink" : "junction";
|
||||
log.info(`Linking type is set to ${this.linkingType}`);
|
||||
if (process.platform === "win32") {
|
||||
// Only Windows support "junction", this is disregarded in other os'es
|
||||
this.linkingType = this.staticConfig.get("use-symlinks") === true ? "symlink" : "junction";
|
||||
log.info(`Linking type is set to ${this.linkingType}`);
|
||||
|
||||
this.staticConfig.$watch("use-symlinks").subscribe((useSymlink) => {
|
||||
this.linkingType = useSymlink === true ? "symlink" : "junction";
|
||||
log.info(`Linking type set to ${this.linkingType}`);
|
||||
});
|
||||
this.staticConfig.$watch("use-symlinks").subscribe((useSymlink) => {
|
||||
this.linkingType = useSymlink === true ? "symlink" : "junction";
|
||||
log.info(`Linking type set to ${this.linkingType}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public sharedFolder(): string {
|
||||
|
||||
Reference in New Issue
Block a user