fix(launcher): disable Steam SDK initialization
Use the game's non-Steam startup option in the shared fixed arguments. Validate the arguments in the installed development handoff. Statically verified on the .37 and .43 clients. The guarded game run remains part of acceptance.
This commit is contained in:
1 parent
a76e0c13a0
commit
c087bd886a
3 files changed
+14
-2
No files matched your search
@@ -3,10 +3,10 @@ import { join } from 'node:path';
|
|||||||
import { promisify } from 'node:util';
|
import { promisify } from 'node:util';
|
||||||
import { GAME_FILES } from '@wto/patcher';
|
import { GAME_FILES } from '@wto/patcher';
|
||||||
import { AppError } from '@shared/errors.ts';
|
import { AppError } from '@shared/errors.ts';
|
||||||
|
import offlineGameArguments from '@shared/offline-game-arguments.json';
|
||||||
import type { GameExit } from '@shared/schemas/launch.ts';
|
import type { GameExit } from '@shared/schemas/launch.ts';
|
||||||
|
|
||||||
const execute = promisify(execFile);
|
const execute = promisify(execFile);
|
||||||
const OFFLINE_ARGUMENTS = ['-forcestart', '-nobeac', '-crashpad-disable-upload'];
|
|
||||||
|
|
||||||
export async function gameProcessRunning(signal: AbortSignal): Promise<boolean> {
|
export async function gameProcessRunning(signal: AbortSignal): Promise<boolean> {
|
||||||
if (process.platform !== 'win32') return false;
|
if (process.platform !== 'win32') return false;
|
||||||
@@ -19,7 +19,7 @@ export async function runGameProcess(
|
|||||||
): Promise<GameExit> {
|
): Promise<GameExit> {
|
||||||
if (await gameProcessRunning(signal)) throw new AppError('launch_game_running');
|
if (await gameProcessRunning(signal)) throw new AppError('launch_game_running');
|
||||||
signal.throwIfAborted();
|
signal.throwIfAborted();
|
||||||
const child = spawn(join(copyPath, GAME_FILES.executable), [...OFFLINE_ARGUMENTS, ...additionalArguments], {
|
const child = spawn(join(copyPath, GAME_FILES.executable), [...offlineGameArguments, ...additionalArguments], {
|
||||||
cwd: copyPath, shell: false, stdio: 'ignore',
|
cwd: copyPath, shell: false, stdio: 'ignore',
|
||||||
});
|
});
|
||||||
const stop = (): void => { child.kill(); };
|
const stop = (): void => { child.kill(); };
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { isAbsolute, join, relative, resolve } from 'node:path';
|
|||||||
import { app } from 'electron';
|
import { app } from 'electron';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { AppError } from '@shared/errors.ts';
|
import { AppError } from '@shared/errors.ts';
|
||||||
|
import offlineGameArguments from '@shared/offline-game-arguments.json';
|
||||||
import { localServerReady } from './local-server.ts';
|
import { localServerReady } from './local-server.ts';
|
||||||
import { forwardProcessOutput } from './process-output.ts';
|
import { forwardProcessOutput } from './process-output.ts';
|
||||||
|
|
||||||
@@ -12,6 +13,7 @@ const Configuration = z.object({
|
|||||||
copy: z.string().min(1),
|
copy: z.string().min(1),
|
||||||
port: z.number().int().min(1).max(65535),
|
port: z.number().int().min(1).max(65535),
|
||||||
labUser: z.literal('wto-lab'),
|
labUser: z.literal('wto-lab'),
|
||||||
|
gameArguments: z.array(z.string()),
|
||||||
});
|
});
|
||||||
const Status = z.object({
|
const Status = z.object({
|
||||||
state: z.string(),
|
state: z.string(),
|
||||||
@@ -33,6 +35,10 @@ export async function readInstalledLab(): Promise<Lab> {
|
|||||||
const installPath = join(programData, 'WTOffline-lab');
|
const installPath = join(programData, 'WTOffline-lab');
|
||||||
try {
|
try {
|
||||||
const config = Configuration.parse(JSON.parse(await readFile(join(installPath, 'lab.json'), 'utf8')));
|
const config = Configuration.parse(JSON.parse(await readFile(join(installPath, 'lab.json'), 'utf8')));
|
||||||
|
if (config.gameArguments.length !== offlineGameArguments.length ||
|
||||||
|
offlineGameArguments.some((argument, index) => config.gameArguments[index] !== argument)) {
|
||||||
|
throw new Error('The installed lab launch arguments are out of date.');
|
||||||
|
}
|
||||||
const root = await realpath(config.lab);
|
const root = await realpath(config.lab);
|
||||||
const copyPath = await realpath(resolve(root, config.copy));
|
const copyPath = await realpath(resolve(root, config.copy));
|
||||||
const relation = relative(root, copyPath);
|
const relation = relative(root, copyPath);
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
[
|
||||||
|
"-forcestart",
|
||||||
|
"-nobeac",
|
||||||
|
"-crashpad-disable-upload",
|
||||||
|
"--nosteam"
|
||||||
|
]
|
||||||
Reference in new issue
Block a user