diff --git a/apps/launcher/package.json b/apps/launcher/package.json
index 0e9a8dc..6c72090 100644
--- a/apps/launcher/package.json
+++ b/apps/launcher/package.json
@@ -1,5 +1,6 @@
{
"name": "@wto/launcher",
+ "productName": "WTOffline Launcher",
"version": "0.1.0",
"private": true,
"description": "Installer and launcher of the War Thunder offline project.",
diff --git a/apps/launcher/src/renderer/src/App.tsx b/apps/launcher/src/renderer/src/App.tsx
index 492524f..3cec809 100644
--- a/apps/launcher/src/renderer/src/App.tsx
+++ b/apps/launcher/src/renderer/src/App.tsx
@@ -1,19 +1,25 @@
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import type { InstallRecord } from '@shared/schemas/install.ts';
import type { Settings } from '@shared/schemas/settings.ts';
import { LanguageMenu } from './components/LanguageMenu.tsx';
import { applyLanguage, resolveLanguage } from './i18n/index.ts';
import { ipcOn } from './ipc.ts';
+import { InstallWizard } from './pages/install/InstallWizard.tsx';
import { WelcomePage } from './pages/WelcomePage.tsx';
interface AppProps {
readonly initialSettings: Settings;
readonly systemLocale: string;
+ readonly initialRecord: InstallRecord | null;
+ readonly defaultDataPath: string;
}
-export function App({ initialSettings, systemLocale }: AppProps) {
+export function App({ initialSettings, systemLocale, initialRecord, defaultDataPath }: AppProps) {
const { t } = useTranslation();
const [settings, setSettings] = useState(initialSettings);
+ const [record, setRecord] = useState(initialRecord);
+ const [installing, setInstalling] = useState(false);
useEffect(() => ipcOn('event:settings-changed', setSettings), []);
useEffect(() => applyLanguage(resolveLanguage(settings.language, systemLocale)), [settings.language, systemLocale]);
@@ -25,7 +31,15 @@ export function App({ initialSettings, systemLocale }: AppProps) {
-
+ {installing ? (
+ { setRecord(installed); setInstalling(false); }}
+ onClose={() => setInstalling(false)}
+ />
+ ) : (
+ setInstalling(true)} />
+ )}
);
diff --git a/apps/launcher/src/renderer/src/components/FolderField.tsx b/apps/launcher/src/renderer/src/components/FolderField.tsx
new file mode 100644
index 0000000..fa85583
--- /dev/null
+++ b/apps/launcher/src/renderer/src/components/FolderField.tsx
@@ -0,0 +1,31 @@
+import { useTranslation } from 'react-i18next';
+import { ipcInvoke } from '../ipc.ts';
+
+interface FolderFieldProps {
+ readonly path: string | null;
+ /** Title of the folder dialog. */
+ readonly dialogTitle: string;
+ readonly disabled?: boolean;
+ readonly onChosen: (path: string) => void;
+ readonly onError: (error: unknown) => void;
+}
+
+/** A chosen folder and the button that opens the folder dialog. */
+export function FolderField({ path, dialogTitle, disabled = false, onChosen, onError }: FolderFieldProps) {
+ const { t } = useTranslation();
+ const choose = (): void => {
+ ipcInvoke('dialog:pickFolder', { title: dialogTitle })
+ .then(({ path: chosen }) => {
+ if (chosen) onChosen(chosen);
+ })
+ .catch(onError);
+ };
+ return (
+
+ {path ?? t('folder.none')}
+
+
+ );
+}
diff --git a/apps/launcher/src/renderer/src/components/Notice.tsx b/apps/launcher/src/renderer/src/components/Notice.tsx
new file mode 100644
index 0000000..f2049e2
--- /dev/null
+++ b/apps/launcher/src/renderer/src/components/Notice.tsx
@@ -0,0 +1,6 @@
+import type { ReactNode } from 'react';
+
+/** A boxed message: information, a warning the player can go past, or a problem that stops them. */
+export function Notice({ tone, children }: { readonly tone: 'info' | 'warning' | 'error'; readonly children: ReactNode }) {
+ return
{children}
;
+}
diff --git a/apps/launcher/src/renderer/src/components/ProgressBar.tsx b/apps/launcher/src/renderer/src/components/ProgressBar.tsx
new file mode 100644
index 0000000..43a5bda
--- /dev/null
+++ b/apps/launcher/src/renderer/src/components/ProgressBar.tsx
@@ -0,0 +1,9 @@
+/** A bar filled to `value` of `max`; without a max it shows that work is going on. */
+export function ProgressBar({ value, max }: { readonly value: number; readonly max: number | null }) {
+ const fraction = max ? Math.min(1, value / max) : null;
+ return (
+
+
+
+ );
+}
diff --git a/apps/launcher/src/renderer/src/features.ts b/apps/launcher/src/renderer/src/features.ts
new file mode 100644
index 0000000..bb41523
--- /dev/null
+++ b/apps/launcher/src/renderer/src/features.ts
@@ -0,0 +1,10 @@
+import type { TFunction } from 'i18next';
+
+/**
+ * The player-facing name of a feature tag from a patch definition (a feature inventory row such
+ * as "K-侦察"). Tags without a translation are shown as they are.
+ */
+export function featureName(t: TFunction, tag: string): string {
+ // Tags hold spaces and slashes but never the key separator, so they work as keys as they are.
+ return t(`features.${tag}`, { defaultValue: tag });
+}
diff --git a/apps/launcher/src/renderer/src/format.ts b/apps/launcher/src/renderer/src/format.ts
new file mode 100644
index 0000000..32e1c4f
--- /dev/null
+++ b/apps/launcher/src/renderer/src/format.ts
@@ -0,0 +1,6 @@
+/** Sizes as the player reads them: gigabytes with one decimal, megabytes below one gigabyte. */
+export function formatBytes(bytes: number): string {
+ const gigabytes = bytes / 1024 ** 3;
+ if (gigabytes >= 1) return `${gigabytes.toFixed(1)} GB`;
+ return `${Math.max(0, Math.round(bytes / 1024 ** 2))} MB`;
+}
diff --git a/apps/launcher/src/renderer/src/i18n/locales/en.json b/apps/launcher/src/renderer/src/i18n/locales/en.json
index ab7d35b..f93893f 100644
--- a/apps/launcher/src/renderer/src/i18n/locales/en.json
+++ b/apps/launcher/src/renderer/src/i18n/locales/en.json
@@ -10,7 +10,134 @@
},
"welcome": {
"title": "Not installed yet",
- "body": "Install the offline version from your own copy of War Thunder. Your original game is only read, never changed."
+ "body": "Install the offline version from your own War Thunder. By default it works on a copy; your original game is only read, never changed.",
+ "install": "Install"
+ },
+ "installed": {
+ "title": "The offline version is installed",
+ "launchLater": "Starting the game comes in the next version.",
+ "reinstall": "Install again"
+ },
+ "summary": {
+ "copy": "Game copy",
+ "data": "Data folder",
+ "version": "Game version",
+ "method": "Installed",
+ "methods": {
+ "copy": "as a copy in a new folder",
+ "in-place": "in the original folder"
+ },
+ "missing": "These features do not work with your game version:"
+ },
+ "folder": {
+ "none": "Not chosen",
+ "choose": "Choose folder",
+ "change": "Change"
+ },
+ "wizard": {
+ "steps": {
+ "source": "Game",
+ "method": "Method",
+ "data": "Data",
+ "check": "Check",
+ "installing": "Install"
+ },
+ "back": "Back",
+ "next": "Next",
+ "cancel": "Cancel",
+ "install": "Install"
+ },
+ "source": {
+ "title": "Choose your War Thunder folder",
+ "body": "The one holding aces.vromfs.bin and the win64 folder, such as the War Thunder folder in Steam.",
+ "notAGame": "This is not a War Thunder folder. Missing: {{files}}",
+ "versionVerified": "Game version {{version}}. The offline version is made for it.",
+ "versionUnverified": "Game version {{version}}. The offline version is made for {{verified}}, so some features may not work. The next steps check which.",
+ "versionUnknown": "unknown"
+ },
+ "method": {
+ "title": "How to install",
+ "copy": "Copy into a new folder (recommended)",
+ "copyBody": "The whole game is copied and the offline version goes into the copy. Your original stays as it is. Needs about {{size}}.",
+ "measuring": "(measuring)",
+ "targetTitle": "Choose a folder for the game copy",
+ "inPlace": "Install into this folder",
+ "inPlaceBody": "For a copy of the game you prepared yourself. Four files in {{path}} are replaced; the originals are kept in its wtoffline\\stock folder.",
+ "room": "{{free}} free on this drive.",
+ "noRoom": "Not enough room: {{needed}} needed, {{free}} free on this drive.",
+ "problem": {
+ "not_empty": "This folder already holds files. Choose an empty or a new folder.",
+ "overlaps_stock": "Choose a folder other than the original game folder, outside it and not containing it.",
+ "not_a_folder": "This is not a folder."
+ }
+ },
+ "steam": {
+ "title": "This folder is in a Steam library. Installing here:",
+ "risk1": "changes your online game client directly;",
+ "risk2": "can be undone when Steam verifies or updates the game;",
+ "risk3": "risks a ban if the online game is started with the changed files.",
+ "advice": "Copying into a new folder is the safer choice.",
+ "confirm": "I understand these risks and want to install here"
+ },
+ "data": {
+ "title": "Choose the data folder",
+ "body": "Saves, caches and logs of the offline version go here. Take this folder along to take your saves."
+ },
+ "check": {
+ "title": "Checking your game",
+ "running": "Checking that the offline version's changes fit your game. This takes a few seconds…",
+ "allFit": "All {{count}} changes fit your game.",
+ "essentialMissing": "Your game version lacks changes the offline version cannot run without, so it cannot be installed. Affected:",
+ "someMissing": "Some changes do not fit your game version. These features will not work:",
+ "details": "Which changes",
+ "accept": "Install without these features"
+ },
+ "progress": {
+ "title": "Installing",
+ "phase": {
+ "checking": "Checking the game files…",
+ "measuring": "Counting the files to copy…",
+ "copying": "Copying the game…",
+ "backing-up": "Keeping the original files…",
+ "recording": "Finishing…"
+ },
+ "copied": "{{done}} of {{total}} copied ({{doneFiles}} of {{totalFiles}} files)",
+ "cancel": "Cancel installation",
+ "cancelling": "Cancelling…"
+ },
+ "features": {
+ "A-离线启动": "Starting offline",
+ "A-与正版隔离": "Kept apart from the online game",
+ "A-不连 Gaijin": "No connection to Gaijin",
+ "A-新手流程": "Tutorials",
+ "B-机库与载具": "Hangar and vehicles",
+ "G-礼包商店": "Pack store",
+ "G-兑换码": "Redeem codes",
+ "G-市场": "Marketplace",
+ "G-Marketplace": "Marketplace",
+ "G-货币": "Currency purchases",
+ "G-高级账户": "Premium account",
+ "G-Premium Account": "Premium account",
+ "G-Store": "Store",
+ "G-加成道具": "Boosters",
+ "H-合同 / 赌注": "Battle contracts",
+ "H-补给箱": "Supply chests",
+ "H-物品回收与合成": "Recycling and crafting",
+ "H-兑换券": "Coupons",
+ "H-External inventory": "External inventory items",
+ "J-对局模式": "Battle modes",
+ "J-陆战 街机 / 历史": "Ground battles (arcade, realistic)",
+ "J-空战 街机 / 历史": "Air battles (arcade, realistic)",
+ "J-海战 街机 / 历史": "Naval battles (arcade, realistic)",
+ "J-附加子模式": "Extra modes (such as night battles)",
+ "K-AI 对手与队友": "AI opponents and teammates",
+ "K-出生点数 / 重生": "Spawn points and respawning",
+ "K-侦察": "Scouting and drones",
+ "K-击杀、助攻、占点计分": "Kill, assist and capture scoring",
+ "K-补充载具": "Extra vehicles",
+ "K-计分板": "Scoreboard",
+ "L-结算页": "Battle results",
+ "L-战斗奖章": "Battle awards"
},
"errors": {
"internal_error": "Something went wrong inside the launcher.",
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 4f72f53..1377293 100644
--- a/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json
+++ b/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json
@@ -10,7 +10,134 @@
},
"welcome": {
"title": "尚未安装",
- "body": "从你自己的战争雷霆游戏安装离线版。原版游戏只读取,不会被修改。"
+ "body": "用你自己的战争雷霆安装离线版。默认会复制一份游戏,原版只读取、不修改。",
+ "install": "开始安装"
+ },
+ "installed": {
+ "title": "离线版已安装",
+ "launchLater": "启动游戏的功能将在下一版加入。",
+ "reinstall": "重新安装"
+ },
+ "summary": {
+ "copy": "游戏副本",
+ "data": "数据目录",
+ "version": "游戏版本",
+ "method": "安装方式",
+ "methods": {
+ "copy": "复制到新文件夹",
+ "in-place": "直接在原文件夹里安装"
+ },
+ "missing": "你的游戏版本用不上以下功能:"
+ },
+ "folder": {
+ "none": "尚未选择",
+ "choose": "选择文件夹",
+ "change": "更改"
+ },
+ "wizard": {
+ "steps": {
+ "source": "游戏位置",
+ "method": "安装方式",
+ "data": "数据目录",
+ "check": "检查",
+ "installing": "安装"
+ },
+ "back": "上一步",
+ "next": "下一步",
+ "cancel": "取消",
+ "install": "开始安装"
+ },
+ "source": {
+ "title": "选择你的战争雷霆游戏文件夹",
+ "body": "就是装有 aces.vromfs.bin 和 win64 文件夹的那个,例如 Steam 里的 War Thunder 文件夹。",
+ "notAGame": "这不是战争雷霆的游戏文件夹,缺少:{{files}}",
+ "versionVerified": "游戏版本 {{version}},离线版已适配这个版本。",
+ "versionUnverified": "游戏版本 {{version}}。离线版适配的是 {{verified}},其他版本可能有部分功能用不了。下一步会检查具体哪些。",
+ "versionUnknown": "未知"
+ },
+ "method": {
+ "title": "怎么安装",
+ "copy": "复制到新文件夹(推荐)",
+ "copyBody": "把游戏完整复制一份,离线版装在副本里,原版不受影响。需要约 {{size}} 空间。",
+ "measuring": "(正在计算大小)",
+ "targetTitle": "选择存放游戏副本的文件夹",
+ "inPlace": "直接在这个文件夹里安装",
+ "inPlaceBody": "适合你已经自己准备好一份游戏副本的情况。会替换 {{path}} 里的 4 个文件,原文件备份在其中的 wtoffline\\stock 文件夹。",
+ "room": "这个盘还有 {{free}} 空间。",
+ "noRoom": "空间不够:需要 {{needed}},这个盘只剩 {{free}}。",
+ "problem": {
+ "not_empty": "这个文件夹里已经有文件了,请选一个空文件夹或新文件夹。",
+ "overlaps_stock": "不能选原版游戏文件夹本身,也不能选它里面或包含它的文件夹。",
+ "not_a_folder": "这不是一个文件夹。"
+ }
+ },
+ "steam": {
+ "title": "这个文件夹在 Steam 游戏库里。在这里安装:",
+ "risk1": "等于直接改动你的正版客户端;",
+ "risk2": "Steam 校验文件或更新时,改动可能被覆盖;",
+ "risk3": "带着改过的文件联网启动正版,有被封号的风险。",
+ "advice": "建议改用“复制到新文件夹”。",
+ "confirm": "我了解这些风险,仍要在这里安装"
+ },
+ "data": {
+ "title": "选择数据目录",
+ "body": "离线版的存档、缓存和日志都放在这里。拷走这个文件夹就能带走存档。"
+ },
+ "check": {
+ "title": "检查你的游戏",
+ "running": "正在核对离线版的改动是否都适用于你的游戏,需要几秒钟……",
+ "allFit": "全部 {{count}} 项改动都适用于你的游戏。",
+ "essentialMissing": "你的游戏版本缺少离线版运行所必需的改动,无法安装。受影响的是:",
+ "someMissing": "有些改动不适用于你的游戏版本,下面这些功能会用不了:",
+ "details": "具体是哪些改动",
+ "accept": "缺少这些功能也继续安装"
+ },
+ "progress": {
+ "title": "正在安装",
+ "phase": {
+ "checking": "正在检查游戏文件……",
+ "measuring": "正在统计要复制的文件……",
+ "copying": "正在复制游戏……",
+ "backing-up": "正在备份原版文件……",
+ "recording": "正在完成安装……"
+ },
+ "copied": "已复制 {{done}} / {{total}}({{doneFiles}} / {{totalFiles}} 个文件)",
+ "cancel": "取消安装",
+ "cancelling": "正在取消……"
+ },
+ "features": {
+ "A-离线启动": "离线启动",
+ "A-与正版隔离": "与正版游戏隔离",
+ "A-不连 Gaijin": "不连接 Gaijin",
+ "A-新手流程": "新手教程",
+ "B-机库与载具": "机库与载具",
+ "G-礼包商店": "礼包商店",
+ "G-兑换码": "兑换码",
+ "G-市场": "交易所",
+ "G-Marketplace": "交易所",
+ "G-货币": "货币购买",
+ "G-高级账户": "高级账户",
+ "G-Premium Account": "高级账户",
+ "G-Store": "商店",
+ "G-加成道具": "加成道具",
+ "H-合同 / 赌注": "作战合约",
+ "H-补给箱": "补给箱",
+ "H-物品回收与合成": "物品回收与合成",
+ "H-兑换券": "兑换券",
+ "H-External inventory": "外部库存物品",
+ "J-对局模式": "对局模式",
+ "J-陆战 街机 / 历史": "陆战(街机、历史)",
+ "J-空战 街机 / 历史": "空战(街机、历史)",
+ "J-海战 街机 / 历史": "海战(街机、历史)",
+ "J-附加子模式": "附加模式(如夜战)",
+ "K-AI 对手与队友": "AI 对手与队友",
+ "K-出生点数 / 重生": "出生点数与重生",
+ "K-侦察": "侦察与无人机",
+ "K-击杀、助攻、占点计分": "击杀、助攻和占点计分",
+ "K-补充载具": "补充载具",
+ "K-计分板": "计分板",
+ "L-结算页": "战后结算",
+ "L-战斗奖章": "战斗嘉奖"
},
"errors": {
"internal_error": "启动器内部出错了。",
diff --git a/apps/launcher/src/renderer/src/main.tsx b/apps/launcher/src/renderer/src/main.tsx
index 2455386..a118ca4 100644
--- a/apps/launcher/src/renderer/src/main.tsx
+++ b/apps/launcher/src/renderer/src/main.tsx
@@ -6,7 +6,7 @@ import { ipcInvoke } from './ipc.ts';
import './styles/app.css';
async function start(): Promise {
- const [settings, info] = await Promise.all([ipcInvoke('settings:get'), ipcInvoke('app:getInfo')]);
+ const [settings, info, install] = await Promise.all([ipcInvoke('settings:get'), ipcInvoke('app:getInfo'), ipcInvoke('install:getRecord')]);
const language = resolveLanguage(settings.language, info.systemLocale);
await initI18n(language);
document.documentElement.lang = language;
@@ -14,7 +14,7 @@ async function start(): Promise {
if (!root) throw new Error('#root is missing from index.html');
createRoot(root).render(
-
+ ,
);
}
diff --git a/apps/launcher/src/renderer/src/pages/InstallSummary.tsx b/apps/launcher/src/renderer/src/pages/InstallSummary.tsx
new file mode 100644
index 0000000..260eed8
--- /dev/null
+++ b/apps/launcher/src/renderer/src/pages/InstallSummary.tsx
@@ -0,0 +1,31 @@
+import { useTranslation } from 'react-i18next';
+import type { InstallRecord } from '@shared/schemas/install.ts';
+import { featureName } from '../features.ts';
+
+/** What is installed where, and which features are missing. */
+export function InstallSummary({ record }: { readonly record: InstallRecord }) {
+ const { t } = useTranslation();
+ const missing = [...new Set(record.unavailablePatches.flatMap((patch) => patch.features))];
+ return (
+ <>
+
+ )}
+ >
+ );
+}
diff --git a/apps/launcher/src/renderer/src/pages/WelcomePage.tsx b/apps/launcher/src/renderer/src/pages/WelcomePage.tsx
index 2ccb508..14e9855 100644
--- a/apps/launcher/src/renderer/src/pages/WelcomePage.tsx
+++ b/apps/launcher/src/renderer/src/pages/WelcomePage.tsx
@@ -1,12 +1,31 @@
import { useTranslation } from 'react-i18next';
+import type { InstallRecord } from '@shared/schemas/install.ts';
+import { InstallSummary } from './InstallSummary.tsx';
-/** What the launcher shows before anything is installed. The install wizard starts from here. */
-export function WelcomePage() {
+interface WelcomePageProps {
+ /** The installed copy, or null before the first installation. */
+ readonly record: InstallRecord | null;
+ readonly onInstall: () => void;
+}
+
+/** The first screen: an invitation to install, or what is installed. */
+export function WelcomePage({ record, onInstall }: WelcomePageProps) {
const { t } = useTranslation();
+ if (!record) {
+ return (
+
+
{t('welcome.title')}
+
{t('welcome.body')}
+
+
+ );
+ }
return (
-
{t('welcome.title')}
-
{t('welcome.body')}
+
{t('installed.title')}
+
+
{t('installed.launchLater')}
+
);
}
diff --git a/apps/launcher/src/renderer/src/pages/install/CheckStep.tsx b/apps/launcher/src/renderer/src/pages/install/CheckStep.tsx
new file mode 100644
index 0000000..a18f529
--- /dev/null
+++ b/apps/launcher/src/renderer/src/pages/install/CheckStep.tsx
@@ -0,0 +1,74 @@
+import { useTranslation } from 'react-i18next';
+import type { PatchCheck, UnavailablePatch } from '@shared/schemas/install.ts';
+import { Notice } from '../../components/Notice.tsx';
+import { ProgressBar } from '../../components/ProgressBar.tsx';
+import { featureName } from '../../features.ts';
+
+interface CheckStepProps {
+ /** Null while the check runs. */
+ readonly check: PatchCheck | null;
+ readonly missingAccepted: boolean;
+ readonly onMissingAccepted: (accepted: boolean) => void;
+}
+
+/** Step 4: which of the offline version's changes fit the player's game build. */
+export function CheckStep({ check, missingAccepted, onMissingAccepted }: CheckStepProps) {
+ const { t } = useTranslation();
+ if (!check) {
+ return (
+
+