Merge branch 'master' into feat/702-respect-system-proxy-windows

This commit is contained in:
Gold John King
2024-12-24 19:52:46 +08:00
21 changed files with 168 additions and 69 deletions
@@ -131,6 +131,7 @@ export class BSLauncherService {
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"; }
if(launchOptions.launchMods?.includes(LaunchMods.PROTON_LOGS)){ res.protonLogs = "true"; }
return res;
}
@@ -248,6 +249,7 @@ type ShortcutParams = {
debug?: string;
additionalArgs?: string[];
skipSteam?: string;
protonLogs?: string;
version: string;
versionName?: string;
versionIno?: string;
@@ -1,7 +1,6 @@
import { BS_APP_ID, BS_DEPOT } from "../../constants";
import path from "path";
import { BSVersion } from "shared/bs-version.interface";
import { UtilsService } from "../utils.service";
import log from "electron-log";
import { InstallationLocationService } from "../installation-location.service";
import { BSLocalVersionService } from "../bs-local-version.service";
@@ -17,14 +16,12 @@ import { CustomError } from "shared/models/exceptions/custom-error.class";
export class BsSteamDownloaderService {
private static instance: BsSteamDownloaderService;
private readonly utils: UtilsService;
private readonly installLocationService: InstallationLocationService;
private readonly localVersionService: BSLocalVersionService;
private depotDownloader: DepotDownloader;
private constructor() {
this.utils = UtilsService.getInstance();
this.installLocationService = InstallationLocationService.getInstance();
this.localVersionService = BSLocalVersionService.getInstance();
@@ -40,10 +37,6 @@ export class BsSteamDownloaderService {
return BsSteamDownloaderService.instance;
}
private getDepotDownloaderExePath(): string {
return path.join(this.utils.getAssetsScriptsPath(), process.platform === 'linux' ? "DepotDownloader" : "DepotDownloader.exe");
}
private async buildDepotDownloaderInstance(downloadInfos: DownloadSteamInfo, qr?: boolean): Promise<{depotDownloader: DepotDownloader, depotDownloaderOptions: DepotDownloaderArgsOptions, version: BSVersion}> {
const versionPath = await this.localVersionService.getVersionPath(downloadInfos.bsVersion);
@@ -68,11 +61,9 @@ export class BsSteamDownloaderService {
await ensureDir(this.installLocationService.versionsDirectory());
const exePath = this.getDepotDownloaderExePath();
const args = DepotDownloader.buildArgs(depotDownloaderOptions);
const depotDownloader = new DepotDownloader({
command: exePath,
args,
options: { cwd: this.installLocationService.versionsDirectory() },
echoStartData: downloadVersion
@@ -104,11 +95,21 @@ export class BsSteamDownloaderService {
finalize(() => this.localVersionService.initVersionMetadata(version, { store: BsStore.STEAM }))
).subscribe(sub);
}).catch(err => sub.error({
type: DepotDownloaderEventType.Error,
subType: DepotDownloaderErrorEvent.Unknown,
data: err
} as DepotDownloaderEvent));
}).catch(err => {
if (err instanceof CustomError
&& Object.values(DepotDownloaderErrorEvent).includes(
err.code as DepotDownloaderErrorEvent
)
) {
return sub.error(err);
}
return sub.error({
type: DepotDownloaderEventType.Error,
subType: DepotDownloaderErrorEvent.Unknown,
data: err
} as DepotDownloaderEvent)
});
return () => {
depotDownloaderBuildPromise.then(({ depotDownloader }) => depotDownloader.stop());
+9 -4
View File
@@ -6,6 +6,7 @@ import { StaticConfigurationService } from "./static-configuration.service";
import { CustomError } from "shared/models/exceptions/custom-error.class";
import { BSLaunchError, LaunchOption } from "shared/models/bs-launch";
import { bsmExec } from "main/helpers/os.helpers";
import { LaunchMods } from "shared/models/bs-launch/launch-option.interface";
export class LinuxService {
private static instance: LinuxService;
@@ -78,11 +79,15 @@ export class LinuxService {
"STEAM_COMPAT_CLIENT_INSTALL_PATH": steamPath,
"STEAM_COMPAT_APP_ID": BS_APP_ID,
// Run game in steam environment; fixes #585 for unicode song titles
"SteamEnv": "1",
// Uncomment these to create a proton log file in the Beat Saber install directory.
// "PROTON_LOG": 1,
// "PROTON_LOG_DIR": bsFolderPath,
"SteamEnv": 1,
});
if (launchOptions.launchMods?.includes(LaunchMods.PROTON_LOGS)) {
Object.assign(env, {
"PROTON_LOG": 1,
"PROTON_LOG_DIR": path.join(bsFolderPath, "Logs"),
});
}
}
public verifyProtonPath(protonFolder: string = ""): boolean {