From b3a30c0fd92633a6c94b0a59709d067d0718ed04 Mon Sep 17 00:00:00 2001 From: N0VAN0M4LY <224130499+N0VAN0M4LY@users.noreply.github.com> Date: Mon, 30 Nov 2026 15:23:15 +0800 Subject: [PATCH] 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. --- apps/launcher/src/main/services/launch/game-process.ts | 2 -- .../src/main/services/launch/launch-controller.ts | 6 ++---- apps/launcher/src/main/services/launch/ordinary-launch.ts | 2 -- apps/launcher/src/renderer/src/App.tsx | 3 +-- apps/launcher/src/renderer/src/i18n/locales/en.json | 2 +- apps/launcher/src/renderer/src/i18n/locales/zh-CN.json | 2 +- apps/launcher/src/renderer/src/pages/home/home-bar.ts | 8 ++------ .../src/renderer/src/pages/settings/LaunchSettings.tsx | 4 ---- apps/launcher/src/shared/errors.ts | 2 +- apps/launcher/src/shared/schemas/launch.ts | 3 --- 10 files changed, 8 insertions(+), 26 deletions(-) diff --git a/apps/launcher/src/main/services/launch/game-process.ts b/apps/launcher/src/main/services/launch/game-process.ts index 6540d55..9799be2 100644 --- a/apps/launcher/src/main/services/launch/game-process.ts +++ b/apps/launcher/src/main/services/launch/game-process.ts @@ -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 export async function runGameProcess( copyPath: string, additionalArguments: readonly string[], signal: AbortSignal, onStart: () => void, ): Promise { - 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], { diff --git a/apps/launcher/src/main/services/launch/launch-controller.ts b/apps/launcher/src/main/services/launch/launch-controller.ts index 1db3d3d..bf2a71b 100644 --- a/apps/launcher/src/main/services/launch/launch-controller.ts +++ b/apps/launcher/src/main/services/launch/launch-controller.ts @@ -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 { + 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) { diff --git a/apps/launcher/src/main/services/launch/ordinary-launch.ts b/apps/launcher/src/main/services/launch/ordinary-launch.ts index 254831a..07c5c43 100644 --- a/apps/launcher/src/main/services/launch/ordinary-launch.ts +++ b/apps/launcher/src/main/services/launch/ordinary-launch.ts @@ -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 { - 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'); diff --git a/apps/launcher/src/renderer/src/App.tsx b/apps/launcher/src/renderer/src/App.tsx index b2dcc24..97724f6 100644 --- a/apps/launcher/src/renderer/src/App.tsx +++ b/apps/launcher/src/renderer/src/App.tsx @@ -2,7 +2,7 @@ import { useEffect, useState, type ReactNode } from 'react'; import { useTranslation } from 'react-i18next'; import type { IpcOutput } from '@shared/ipc/contract.ts'; import type { Copies } from '@shared/schemas/install.ts'; -import { ORDINARY_LAUNCH_ENABLED, type LaunchState } from '@shared/schemas/launch.ts'; +import type { LaunchState } from '@shared/schemas/launch.ts'; import type { Settings } from '@shared/schemas/settings.ts'; import { Sheet } from './components/Sheet.tsx'; import { applyLanguage, resolveLanguage } from './i18n/index.ts'; @@ -98,7 +98,6 @@ export function App({ info, initialSettings, initialCopies }: AppProps) { const perCopyStatus = ['version-changed', 'failed', 'port-busy', 'server-exited'].includes(launch.phase); const launchStatus: LaunchState = perCopyStatus && launch.copyId && launch.copyId !== record?.id ? { phase: 'ready' } : launch; const home = homeBar(record, launchStatus, t, wizard.start, { - canStart: ORDINARY_LAUNCH_ENABLED || (info.development && settings.developerMode), start: () => { ipcInvoke('launch:start').catch(report); }, stop: () => { ipcInvoke('launch:stop').catch(report); }, checkVersion: () => go({ page: 'copies', section: 'features' }), diff --git a/apps/launcher/src/renderer/src/i18n/locales/en.json b/apps/launcher/src/renderer/src/i18n/locales/en.json index 536c976..44562e3 100644 --- a/apps/launcher/src/renderer/src/i18n/locales/en.json +++ b/apps/launcher/src/renderer/src/i18n/locales/en.json @@ -644,7 +644,7 @@ "launch_no_copy": "A game copy must be installed before launching.", "launch_busy": "A launch is already in progress.", "launch_failed": "Launch failed. See the launcher log.", - "launch_disabled": "Standard launch is pending isolation verification.", + "launch_platform_unsupported": "Game launch requires Windows.", "launch_lab_required": "Enable developer mode to launch through the isolated lab.", "launch_lab_missing": "The isolated lab automation could not be loaded.", "launch_lab_version": "The lab copy and the stock backup must use the same game version.", diff --git a/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json b/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json index f85b337..9b04b4a 100644 --- a/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json +++ b/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json @@ -644,7 +644,7 @@ "launch_no_copy": "启动前需要安装游戏副本。", "launch_busy": "启动流程正在运行。", "launch_failed": "启动失败。请查看启动器日志。", - "launch_disabled": "普通启动待隔离验收。", + "launch_platform_unsupported": "启动游戏需要 Windows。", "launch_lab_required": "请启用开发模式以通过隔离实验副本启动。", "launch_lab_missing": "无法读取隔离实验自动化配置。", "launch_lab_version": "实验副本和原版文件备份必须使用同一游戏版本。", diff --git a/apps/launcher/src/renderer/src/pages/home/home-bar.ts b/apps/launcher/src/renderer/src/pages/home/home-bar.ts index 8213b94..4c9825b 100644 --- a/apps/launcher/src/renderer/src/pages/home/home-bar.ts +++ b/apps/launcher/src/renderer/src/pages/home/home-bar.ts @@ -5,7 +5,6 @@ import type { BarModel } from '../../shell/bar-model.ts'; import { missingFeatures } from '../copies/missing-features.ts'; interface LaunchActions { - readonly canStart: boolean; readonly start: () => void; readonly stop: () => void; readonly checkVersion: () => void; @@ -19,8 +18,8 @@ export function homeBar( onInstall: () => void, actions: LaunchActions, ): BarModel { - const launch = { label: t('bar.launch'), onClick: actions.start, disabled: !actions.canStart }; - const retry = { label: t('launch.retry'), onClick: actions.start, disabled: !actions.canStart }; + const launch = { label: t('bar.launch'), onClick: actions.start }; + const retry = { label: t('launch.retry'), onClick: actions.start }; const starting = { label: t('launch.starting'), disabled: true }; const progress = { value: state.filesWritten ?? 0, max: state.filesTotal || null }; switch (state.phase) { @@ -85,9 +84,6 @@ export function homeBar( primary: { label: t('bar.install'), onClick: onInstall }, }; } - if (!actions.canStart) { - return { tone: 'warn', title: t('errors.launch_disabled'), primary: launch }; - } const missing = missingFeatures(record).length; return { tone: missing ? 'warn' : 'ok', diff --git a/apps/launcher/src/renderer/src/pages/settings/LaunchSettings.tsx b/apps/launcher/src/renderer/src/pages/settings/LaunchSettings.tsx index e9b2d49..456fd7c 100644 --- a/apps/launcher/src/renderer/src/pages/settings/LaunchSettings.tsx +++ b/apps/launcher/src/renderer/src/pages/settings/LaunchSettings.tsx @@ -2,7 +2,6 @@ import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import type { IpcOutput } from '@shared/ipc/contract.ts'; import { parseLaunchArguments } from '@shared/launch-arguments.ts'; -import { ORDINARY_LAUNCH_ENABLED } from '@shared/schemas/launch.ts'; import { LAUNCH_ARGUMENTS_LIMIT, type Settings, type SettingsPatch } from '@shared/schemas/settings.ts'; import { Row } from '../../components/Row.tsx'; import { Sheet } from '../../components/Sheet.tsx'; @@ -37,9 +36,6 @@ export function LaunchSettings({ settings, development, onError }: LaunchSetting ); } - if (!ORDINARY_LAUNCH_ENABLED) { - return

{t('errors.launch_disabled')}

; - } return ( diff --git a/apps/launcher/src/shared/errors.ts b/apps/launcher/src/shared/errors.ts index 6096262..8289c42 100644 --- a/apps/launcher/src/shared/errors.ts +++ b/apps/launcher/src/shared/errors.ts @@ -49,7 +49,7 @@ export const APP_ERROR_CODES = [ 'launch_no_copy', 'launch_busy', 'launch_failed', - 'launch_disabled', + 'launch_platform_unsupported', 'launch_lab_required', 'launch_lab_missing', 'launch_lab_version', diff --git a/apps/launcher/src/shared/schemas/launch.ts b/apps/launcher/src/shared/schemas/launch.ts index 6b8101b..587d180 100644 --- a/apps/launcher/src/shared/schemas/launch.ts +++ b/apps/launcher/src/shared/schemas/launch.ts @@ -1,9 +1,6 @@ import { z } from 'zod'; import { APP_ERROR_CODES } from '../errors.ts'; -// Enable only after isolation has been verified and the maintainer approves the change. -export const ORDINARY_LAUNCH_ENABLED = false; - export const LaunchStateSchema = z.object({ phase: z.enum([ 'ready', 'checking', 'building', 'starting-server', 'starting-game', 'running',