[feat] defaultly open to the last version launched on startup

This commit is contained in:
silentrald
2024-10-05 09:53:03 +08:00
parent 18adf064f3
commit 0a64e71cf8
3 changed files with 19 additions and 1 deletions
@@ -21,6 +21,7 @@ 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";
import { StaticConfigurationService } from "../static-configuration.service";
export class BSLauncherService {
private static instance: BSLauncherService;
@@ -32,6 +33,7 @@ export class BSLauncherService {
private readonly remoteVersion: BSVersionLibService;
private readonly steamLauncher: SteamLauncherService;
private readonly oculusLauncher: OculusLauncherService;
private readonly staticConfig: StaticConfigurationService;
public static getInstance(): BSLauncherService {
if (!BSLauncherService.instance) {
@@ -48,6 +50,7 @@ export class BSLauncherService {
this.remoteVersion = BSVersionLibService.getInstance();
this.steamLauncher = SteamLauncherService.getInstance();
this.oculusLauncher = OculusLauncherService.getInstance();
this.staticConfig = StaticConfigurationService.getInstance();
this.bsmProtocolService.on("launch", link => {
log.info("Launch from bsm protocol", link.toString());
@@ -73,6 +76,8 @@ export class BSLauncherService {
return throwError(() => new Error("Unable to get launcher for the provided version"));
}
this.staticConfig.set("last-version-launched", launchOptions.version);
return launcher.launch(launchOptions);
}
@@ -89,6 +89,7 @@ export interface StaticConfigKeyValues {
"disable-hadware-acceleration": boolean;
"use-symlinks": boolean;
"use-system-proxy": boolean;
"last-version-launched": BSVersion;
// Linux Specific static configs
"proton-folder": string;