diff --git a/apps/launcher/src/main/services/game-folder/inspect-game-folder.ts b/apps/launcher/src/main/services/game-folder/inspect-game-folder.ts
index bd5efbe..d126e64 100644
--- a/apps/launcher/src/main/services/game-folder/inspect-game-folder.ts
+++ b/apps/launcher/src/main/services/game-folder/inspect-game-folder.ts
@@ -3,11 +3,12 @@ import { join } from 'node:path';
import { executableVersion, GAME_FILES, isInSteamLibrary, recordedGameVersions } from '@wto/patcher';
import { AppError } from '@shared/errors.ts';
import type { GameFolderInspection } from '@shared/schemas/install.ts';
+import { STOCK_BACKUP_FOLDER } from '../install/stock-backup.ts';
import { resourcePaths } from '../resources/resource-paths.ts';
/**
* Look at a folder the player chose as their War Thunder installation: is it one, which version,
- * and is it a Steam library. Only reads.
+ * whether it already has an offline stock backup, and whether it is inside a Steam library. Only reads.
*/
export async function inspectGameFolder(path: string): Promise {
await requireFolder(path);
@@ -17,14 +18,26 @@ export async function inspectGameFolder(path: string): Promise wizard.start('new'), {
start: () => { ipcInvoke('launch:start').catch(report); },
stop: () => { ipcInvoke('launch:stop').catch(report); },
checkVersion: () => go({ page: 'copies', section: 'features' }),
@@ -166,7 +166,11 @@ export function App({ info, initialSettings, initialCopies }: AppProps) {
case 'copies': {
const side = t(`copies.sections.${section}`)} onSelect={(section) => go({ page: 'copies', section })} />;
if (route.copies === 'list') {
- return { side, main: , bar: home };
+ return {
+ side,
+ main: wizard.start('new')} onAddExisting={() => wizard.start('existing')} />,
+ bar: home,
+ };
}
if (!record) {
return {
@@ -174,7 +178,10 @@ export function App({ info, initialSettings, initialCopies }: AppProps) {
main: (
{t('copies.none')}
-
+
+
+
+
),
bar: home,
diff --git a/apps/launcher/src/renderer/src/i18n/locales/en.json b/apps/launcher/src/renderer/src/i18n/locales/en.json
index 77bf7e2..c776013 100644
--- a/apps/launcher/src/renderer/src/i18n/locales/en.json
+++ b/apps/launcher/src/renderer/src/i18n/locales/en.json
@@ -129,6 +129,9 @@
"source": {
"body": "Select the folder where War Thunder is installed.",
"dialogTitle": "Select the War Thunder installation folder",
+ "existingBody": "Select an existing offline client folder.",
+ "existingDialogTitle": "Select an existing offline client folder",
+ "offlineBackupDetected": "An existing offline original-file backup (wtoffline\\stock) was detected. This client can be added directly without copying.",
"notAGame": "The selected folder is not a War Thunder installation. Missing: {{files}}",
"versionVerified": "Game version {{version}} (verified)",
"versionUnverified": "Game version {{version}} has no check record yet. Installing still tries every patch; the patch check shows which features are available.",
@@ -146,7 +149,10 @@
"sameVolumeRequired": "Select a destination on the same volume as the original installation.",
"targetTitle": "Select a folder for the copy",
"inPlace": "In-place installation",
- "inPlaceBody": "Uses the selected game folder as the copy. Original files are backed up to wtoffline\\stock, and patches are applied on first launch.",
+ "inPlaceBody": "Uses the selected game folder directly as the client. Original files are backed up to wtoffline\\stock, and patches are applied on first launch.",
+ "existing": "Add existing client",
+ "existingBody": "Registers the selected existing game folder directly without copying files. If no original backup exists yet, one will be created in wtoffline\\stock.",
+ "existingBodyWithBackup": "Registers the existing offline client directly, preserving its wtoffline\\stock original-file backup without copying game files.",
"room": "Free space on target drive: {{free}}",
"noRoom": "Not enough free space: {{needed}} required, {{free}} available on the target drive.",
"problem": {
@@ -200,7 +206,8 @@
"features": "Feature status",
"maintain": "Maintenance"
},
- "add": "Add a copy",
+ "add": "Add a client",
+ "addExisting": "Add existing client",
"list": { "current": "Current", "select": "Set as current" },
"none": "The offline edition is not installed yet.",
"maintenance": {
@@ -257,7 +264,8 @@
"methods": {
"copy": "Copy installation",
"hardlink": "Space-saving copy",
- "in-place": "In-place installation"
+ "in-place": "In-place installation",
+ "existing": "Existing client"
},
"stock": "Original file backup",
"stockHint": "Patched files are generated from it at each launch",
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 e7f508a..2531ddc 100644
--- a/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json
+++ b/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json
@@ -129,6 +129,9 @@
"source": {
"body": "选择已安装的战争雷霆文件夹。",
"dialogTitle": "选择战争雷霆安装文件夹",
+ "existingBody": "选择已准备好的离线客户端文件夹。",
+ "existingDialogTitle": "选择已有离线客户端文件夹",
+ "offlineBackupDetected": "已检测到离线客户端的原版文件备份(wtoffline\\stock),可直接添加,无需重新复制。",
"notAGame": "所选文件夹不是战争雷霆的安装文件夹,缺少:{{files}}",
"versionVerified": "游戏版本 {{version}}(已核对)",
"versionUnverified": "游戏版本 {{version}} 还没有核对记录。安装时仍会逐个尝试全部补丁,可用功能以补丁检查结果为准。",
@@ -146,7 +149,10 @@
"sameVolumeRequired": "请选择与原版位于同一磁盘卷的目标文件夹。",
"targetTitle": "选择存放副本的文件夹",
"inPlace": "原位安装",
- "inPlaceBody": "使用所选游戏文件夹作为副本。原版文件备份至 wtoffline\\stock,首次启动时将应用补丁。",
+ "inPlaceBody": "使用所选游戏文件夹作为客户端。原版文件备份至 wtoffline\\stock,首次启动时将应用补丁。",
+ "existing": "添加已有客户端",
+ "existingBody": "直接登记所选的已有游戏文件夹,不复制游戏文件;如尚未建立原版备份将自动备份至 wtoffline\\stock。",
+ "existingBodyWithBackup": "直接登记已存在的离线客户端,保留现有的 wtoffline\\stock 原版文件备份,不复制游戏文件。",
"room": "目标磁盘可用空间:{{free}}",
"noRoom": "可用空间不足:需要 {{needed}},目标磁盘仅剩 {{free}}。",
"problem": {
@@ -200,7 +206,8 @@
"features": "功能状态",
"maintain": "维护"
},
- "add": "添加副本",
+ "add": "添加客户端",
+ "addExisting": "添加已有客户端",
"list": { "current": "当前", "select": "设为当前" },
"none": "尚未安装离线版。",
"maintenance": {
@@ -257,7 +264,8 @@
"methods": {
"copy": "复制安装",
"hardlink": "节省空间的复制",
- "in-place": "原位安装"
+ "in-place": "原位安装",
+ "existing": "已有客户端"
},
"stock": "原版文件备份",
"stockHint": "每次启动时据此生成补丁文件",
diff --git a/apps/launcher/src/renderer/src/pages/copies/CopyList.tsx b/apps/launcher/src/renderer/src/pages/copies/CopyList.tsx
index 176a316..4931049 100644
--- a/apps/launcher/src/renderer/src/pages/copies/CopyList.tsx
+++ b/apps/launcher/src/renderer/src/pages/copies/CopyList.tsx
@@ -8,9 +8,10 @@ interface CopyListProps {
readonly supportedVersions: readonly string[];
readonly onSelect: (id: string, detail?: boolean) => void;
readonly onAdd: () => void;
+ readonly onAddExisting: () => void;
}
-export function CopyList({ registry, supportedVersions, onSelect, onAdd }: CopyListProps) {
+export function CopyList({ registry, supportedVersions, onSelect, onAdd, onAddExisting }: CopyListProps) {
const { t } = useTranslation();
return (
@@ -45,6 +46,7 @@ export function CopyList({ registry, supportedVersions, onSelect, onAdd }: CopyL
);
})}
+
);
diff --git a/apps/launcher/src/renderer/src/pages/install/MethodStep.tsx b/apps/launcher/src/renderer/src/pages/install/MethodStep.tsx
index e6b263a..7b933a7 100644
--- a/apps/launcher/src/renderer/src/pages/install/MethodStep.tsx
+++ b/apps/launcher/src/renderer/src/pages/install/MethodStep.tsx
@@ -34,7 +34,8 @@ export function MethodStep({ source, sourceSize, choice, onChoice, onError }: Me
.then((target) => onChoice((current) => ({ ...current, target, steamConfirmed: false })))
.catch(onError);
};
- const folder = choice.method === 'in-place' ? source : choice.target;
+ const directFolder = choice.method === 'in-place' || choice.method === 'existing';
+ const folder = directFolder ? source : choice.target;
const steamWarning = folder?.inSteamLibrary
? onChoice({ ...choice, steamConfirmed })} />
@@ -47,8 +48,19 @@ export function MethodStep({ source, sourceSize, choice, onChoice, onError }: Me
>
);
const savingAvailable = (sourceSize?.linkableBytes ?? 0) > 0;
+ const existingChoice = (
+ choose('existing')}
+ >
+ {steamWarning}
+
+ );
return (
<>
+ {source.hasOfflineBackup && existingChoice}
{steamWarning}
+ {!source.hasOfflineBackup && existingChoice}
>
);
}
@@ -124,9 +137,10 @@ function TargetVerdict({ target, sourceSize, method }: {
function SteamWarning({ method, path, confirmed, onConfirmed }: { readonly method: Method; readonly path: string; readonly confirmed: boolean; readonly onConfirmed: (confirmed: boolean) => void }) {
const { t } = useTranslation();
+ const isDirect = method === 'in-place' || method === 'existing';
return (
- {t(method === 'in-place' ? 'steam.inPlaceWarning' : 'steam.copyWarning')}
+ {t(isDirect ? 'steam.inPlaceWarning' : 'steam.copyWarning')}
{path}
{size}
+ {backupNote}
);
}
diff --git a/apps/launcher/src/renderer/src/pages/install/WizardMain.tsx b/apps/launcher/src/renderer/src/pages/install/WizardMain.tsx
index 53547e8..de47247 100644
--- a/apps/launcher/src/renderer/src/pages/install/WizardMain.tsx
+++ b/apps/launcher/src/renderer/src/pages/install/WizardMain.tsx
@@ -15,7 +15,7 @@ export function WizardMain({ wizard, supportedVersions }: { readonly wizard: Ins
return (
{step === 'source' && (
-
+
)}
{step === 'method' && sourceUsable(source) && (
<>
diff --git a/apps/launcher/src/renderer/src/pages/install/useInstallWizard.ts b/apps/launcher/src/renderer/src/pages/install/useInstallWizard.ts
index 2165a07..c62f298 100644
--- a/apps/launcher/src/renderer/src/pages/install/useInstallWizard.ts
+++ b/apps/launcher/src/renderer/src/pages/install/useInstallWizard.ts
@@ -8,6 +8,7 @@ import { sourceUsable } from './SourceStep.tsx';
export const WIZARD_STEPS = ['source', 'method', 'data', 'check', 'installing'] as const;
export type WizardStep = (typeof WIZARD_STEPS)[number];
+export type WizardMode = 'new' | 'existing';
const NO_CHOICE: MethodChoice = { method: 'copy', target: null, steamConfirmed: false };
@@ -23,6 +24,7 @@ interface WizardOptions {
export function useInstallWizard({ onInstalled }: WizardOptions) {
const { message, report, clear } = useErrorMessage();
const [active, setActive] = useState(false);
+ const [mode, setMode] = useState('new');
const [step, setStep] = useState('source');
const [source, setSource] = useState(null);
const [sourceSize, setSourceSize] = useState(null);
@@ -90,11 +92,12 @@ export function useInstallWizard({ onInstalled }: WizardOptions) {
useEffect(() => ipcOn('event:install-progress', setProgress), []);
- const start = (): void => {
+ const start = (nextMode: WizardMode = 'new'): void => {
clear();
+ setMode(nextMode);
setStep('source');
setSource(null);
- setChoice(NO_CHOICE);
+ setChoice(nextMode === 'existing' ? { method: 'existing', target: null, steamConfirmed: false } : NO_CHOICE);
setName('');
setDraftId(null);
setDataPath('');
@@ -109,13 +112,15 @@ export function useInstallWizard({ onInstalled }: WizardOptions) {
const chooseSource = (found: GameFolderInspection | null): void => {
setSource(found);
- setChoice(NO_CHOICE);
+ const defaultMethod = mode === 'existing' || found?.hasOfflineBackup ? 'existing' : 'copy';
+ setChoice({ method: defaultMethod, target: null, steamConfirmed: false });
setName(found?.path.split(/[\\/]/).filter(Boolean).at(-1) ?? '');
};
const install = (): void => {
if (!sourceUsable(source) || !draftId || !dataReady) return;
- const copyFolder = choice.method === 'in-place' ? source : choice.target;
+ const directFolder = choice.method === 'in-place' || choice.method === 'existing';
+ const copyFolder = directFolder ? source : choice.target;
const choices = {
id: draftId, name, dataPath,
...(choice.steamConfirmed && copyFolder ? { confirmedSteamCopyPath: copyFolder.resolvedPath } : {}),
@@ -125,7 +130,9 @@ export function useInstallWizard({ onInstalled }: WizardOptions) {
};
const request: InstallRequest = choice.method === 'in-place'
? { method: 'in-place', gamePath: source.path, ...choices }
- : { method: 'copy', useHardLinks: choice.method === 'hardlink', sourcePath: source.path, copyPath: choice.target!.path, ...choices };
+ : choice.method === 'existing'
+ ? { method: 'existing', gamePath: source.path, ...choices }
+ : { method: 'copy', useHardLinks: choice.method === 'hardlink', sourcePath: source.path, copyPath: choice.target!.path, ...choices };
clear();
setProgress(null);
setCancelling(false);
@@ -172,7 +179,7 @@ export function useInstallWizard({ onInstalled }: WizardOptions) {
};
return {
- active, step, index, source, sourceSize, choice, name, dataPath, decalSource, check, missingAccepted, progress, cancelling, message, canGoOn,
+ active, mode, step, index, source, sourceSize, choice, name, dataPath, decalSource, check, missingAccepted, progress, cancelling, message, canGoOn,
steamDataPath: dataChecked?.inSteam ? dataChecked.path : null, steamDataConfirmed: dataChecked?.confirmed ?? false,
start, back, next, cancel, report, chooseSource, setChoice, setName, setDataPath, setSteamDataConfirmed, setDecalSource, setMissingAccepted,
};
diff --git a/apps/launcher/src/shared/schemas/install.ts b/apps/launcher/src/shared/schemas/install.ts
index 04a4455..12af778 100644
--- a/apps/launcher/src/shared/schemas/install.ts
+++ b/apps/launcher/src/shared/schemas/install.ts
@@ -12,6 +12,8 @@ export const GameFolderInspectionSchema = z.object({
verifiedVersions: z.array(z.string()),
/** The folder lies in a Steam library: installing into it needs the player's confirmation. */
inSteamLibrary: z.boolean(),
+ /** True when the folder already holds a complete wtoffline/stock backup from an offline setup. */
+ hasOfflineBackup: z.boolean(),
});
export type GameFolderInspection = z.output;
@@ -74,10 +76,10 @@ export type PatchCheck = z.output;
/**
* copy: the stock installation is copied to a new folder and only read.
- * in-place: the player's own prepared folder is used as the copy; its stock files are kept in
- * the backup folder inside it.
+ * in-place: the player's own prepared folder is used directly; its stock files are backed up inside it.
+ * existing: an already prepared offline client folder is registered directly without copying.
*/
-export const INSTALL_METHODS = ['copy', 'in-place'] as const;
+export const INSTALL_METHODS = ['copy', 'in-place', 'existing'] as const;
export type InstallMethod = (typeof INSTALL_METHODS)[number];
export const CopyIdSchema = z.uuid();
@@ -110,6 +112,11 @@ export const InstallRequestSchema = z.discriminatedUnion('method', [
/** The player's prepared game folder, used as the game copy. */
gamePath: z.string().min(1),
}),
+ InstallChoicesSchema.extend({
+ method: z.literal('existing'),
+ /** An already prepared offline client folder registered directly without copying. */
+ gamePath: z.string().min(1),
+ }),
]);
export type InstallRequest = z.output;