fix(launcher): enable standard game launch

Remove the development gate from the launcher and keep the guarded development handoff available.

Verified by type checking, Windows packaging, and opening the packaged launcher with a temporary profile.
This commit is contained in:
N0VAN0M4LY committed 2026-11-30 15:23:15 +08:00
1 parent 746b74c564
commit b3a30c0fd9
10 files changed
+8 -26

No files matched your search

@@ -3,7 +3,6 @@ import { join } from 'node:path';
import { promisify } from 'node:util';
import { GAME_FILES } from '@wto/patcher';
import { AppError } from '@shared/errors.ts';
import { ORDINARY_LAUNCH_ENABLED } from '@shared/schemas/launch.ts';
const execute = promisify(execFile);
const OFFLINE_ARGUMENTS = ['-forcestart', '-nobeac', '-crashpad-disable-upload'];
@@ -17,7 +16,6 @@ export async function gameProcessRunning(signal: AbortSignal): Promise<boolean>
export async function runGameProcess(
copyPath: string, additionalArguments: readonly string[], signal: AbortSignal, onStart: () => void,
): Promise<void> {
if (!ORDINARY_LAUNCH_ENABLED || process.platform !== 'win32') throw new AppError('launch_disabled');
if (await gameProcessRunning(signal)) throw new AppError('launch_game_running');
signal.throwIfAborted();
const child = spawn(join(copyPath, GAME_FILES.executable), [...OFFLINE_ARGUMENTS, ...additionalArguments], {
@@ -5,7 +5,7 @@ import { app, BrowserWindow, shell } from 'electron';
import { AccountStore, LOOPBACK } from '@wto/server';
import { executableVersion, GAME_FILES, isInSteamLibrary } from '@wto/patcher';
import { AppError } from '@shared/errors.ts';
import { ORDINARY_LAUNCH_ENABLED, type LaunchState } from '@shared/schemas/launch.ts';
import type { LaunchState } from '@shared/schemas/launch.ts';
import { getSettings } from '../config/settings-store.ts';
import { decalCachePath } from '../install/decals.ts';
import { copyPathContains, readInstallRecord } from '../install/install-record.ts';
@@ -99,14 +99,12 @@ function update(job: LaunchJob, next: LaunchState): void {
}
async function launch(job: LaunchJob): Promise<void> {
if (process.platform !== 'win32') throw new AppError('launch_platform_unsupported');
const signal = job.stop.signal;
const [record, settings] = await Promise.all([readInstallRecord(), getSettings()]);
if (!record) throw new AppError('launch_no_copy');
job.copyId = record.id;
const useLab = !app.isPackaged && settings.developerMode;
if (!useLab && !ORDINARY_LAUNCH_ENABLED) {
throw new AppError(app.isPackaged ? 'launch_disabled' : 'launch_lab_required');
}
if (isInSteamLibrary(record.copyPath)) throw new AppError('launch_copy_in_steam');
const currentVersion = await readVersion(record.copyPath, signal);
if (!currentVersion || currentVersion !== record.gameVersion) {
@@ -3,7 +3,6 @@ import { isAbsolute, join, relative } from 'node:path';
import { GAME_FILES, isInSteamLibrary } from '@wto/patcher';
import { AppError } from '@shared/errors.ts';
import { parseLaunchArguments } from '@shared/launch-arguments.ts';
import { ORDINARY_LAUNCH_ENABLED } from '@shared/schemas/launch.ts';
import type { InstallRecord } from '@shared/schemas/install.ts';
import type { Settings } from '@shared/schemas/settings.ts';
import { canonicalCopyPath, copyPathContains } from '../install/install-record.ts';
@@ -35,7 +34,6 @@ export async function runOrdinaryLaunch(
copyPath: string, dataPath: string, port: number, settings: Settings, signal: AbortSignal,
publish: (phase: OrdinaryPhase) => void,
): Promise<void> {
if (!ORDINARY_LAUNCH_ENABLED) throw new AppError('launch_disabled');
const args = parseLaunchArguments(settings.launchArguments);
if (!args) throw new AppError('launch_game_failed');
publish('starting-server');