From a8678445c0fa91b1c654d80569de1ba71601f5b8 Mon Sep 17 00:00:00 2001 From: N0VAN0M4LY <224130499+N0VAN0M4LY@users.noreply.github.com> Date: Sun, 29 Nov 2026 16:34:54 +0800 Subject: [PATCH] fix(launcher): report whether a game version is verified Patches locate themselves in each game build, so nothing is chosen per game version: a version without a check record is installed with every patch tried, and the copy's patch check says which features work. The pages showed an "adaptation version" and, for an unchecked version, the nearest checked one as if its patches were used. They now show whether the version is verified, and say that an unverified one still tries every patch. --- .../src/renderer/src/i18n/locales/en.json | 13 ++++---- .../src/renderer/src/i18n/locales/zh-CN.json | 13 ++++---- .../renderer/src/pages/copies/CopyList.tsx | 8 +++-- .../renderer/src/pages/copies/CopySummary.tsx | 5 ++-- .../src/pages/copies/FeatureStatus.tsx | 8 +++-- .../src/renderer/src/pages/home/HomeSide.tsx | 6 ++-- .../renderer/src/pages/install/SourceStep.tsx | 7 ++--- apps/launcher/src/renderer/src/versions.ts | 30 ++++--------------- 8 files changed, 36 insertions(+), 54 deletions(-) diff --git a/apps/launcher/src/renderer/src/i18n/locales/en.json b/apps/launcher/src/renderer/src/i18n/locales/en.json index aad7454..a6e307c 100644 --- a/apps/launcher/src/renderer/src/i18n/locales/en.json +++ b/apps/launcher/src/renderer/src/i18n/locales/en.json @@ -49,7 +49,7 @@ "spaceValue": "About 97 GB (copy installation)", "currentCopy": "Current copy", "copyName": "Game copy", - "adaptation": "Adaptation", + "adaptation": "Check status", "features": "Features", "allAvailable": "✓ All available", "someMissing": "⚠ {{count}} unavailable", @@ -57,7 +57,7 @@ }, "adaptation": { "verified": "✓ Verified", - "nearest": "⚠ Nearest version" + "unverified": "⚠ Not verified" }, "bar": { "notInstalled": "Not installed", @@ -114,8 +114,8 @@ "body": "Select the folder where War Thunder is installed.", "dialogTitle": "Select the War Thunder installation folder", "notAGame": "The selected folder is not a War Thunder installation. Missing: {{files}}", - "versionVerified": "Game version {{version}} · Adaptation {{version}} (verified)", - "versionUnverified": "Game version {{version}} will use adaptation {{nearest}}. Check the patches to see which features are available.", + "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.", "versionUnknown": "unknown", "size": "Size {{size}} · {{files}} files", "measuring": "Calculating size…" @@ -211,8 +211,8 @@ "rename": "Rename", "source": "Installation source", "version": "Game version", - "adaptation": "Adaptation", - "adaptationHint": "Selected automatically by game version", + "adaptation": "Check status", + "adaptationHint": "Whether every patch was checked on this game version and verified in game", "location": "Location", "method": "Installation type", "methods": { @@ -231,6 +231,7 @@ "lead": "Patch compatibility determines which features are available. Installation requires all essential patches.", "essential": "Required", "verifiedOn": "Verified: {{version}}", + "passedCheck": "Passed the patch check (this game version is not verified)", "unavailable": "Patch does not apply: {{patches}}", "allAvailable": "All available", "someMissing": "{{count}} unavailable", 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 c6e2c9e..bef8652 100644 --- a/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json +++ b/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json @@ -49,7 +49,7 @@ "spaceValue": "约 97 GB(复制安装)", "currentCopy": "当前副本", "copyName": "游戏副本", - "adaptation": "适配版本", + "adaptation": "核对状态", "features": "功能", "allAvailable": "✓ 全部可用", "someMissing": "⚠ {{count}} 项不可用", @@ -57,7 +57,7 @@ }, "adaptation": { "verified": "✓ 已核对", - "nearest": "⚠ 就近适配" + "unverified": "⚠ 未核对" }, "bar": { "notInstalled": "未安装", @@ -114,8 +114,8 @@ "body": "选择已安装的战争雷霆文件夹。", "dialogTitle": "选择战争雷霆安装文件夹", "notAGame": "所选文件夹不是战争雷霆的安装文件夹,缺少:{{files}}", - "versionVerified": "游戏版本 {{version}} · 适配版本 {{version}}(已核对)", - "versionUnverified": "游戏版本 {{version}} 将使用适配版本 {{nearest}}。可用功能以补丁检查结果为准。", + "versionVerified": "游戏版本 {{version}}(已核对)", + "versionUnverified": "游戏版本 {{version}} 还没有核对记录。安装时仍会逐个尝试全部补丁,可用功能以补丁检查结果为准。", "versionUnknown": "未知", "size": "大小 {{size}} · {{files}} 个文件", "measuring": "正在统计大小…" @@ -211,8 +211,8 @@ "rename": "重命名", "source": "安装来源", "version": "游戏版本", - "adaptation": "适配版本", - "adaptationHint": "按游戏版本自动选择", + "adaptation": "核对状态", + "adaptationHint": "这个游戏版本是否检查过全部补丁并在游戏里验证过", "location": "位置", "method": "安装方式", "methods": { @@ -231,6 +231,7 @@ "lead": "补丁检查结果决定功能是否可用。安装需要全部必需补丁。", "essential": "必需", "verifiedOn": "已核对:{{version}}", + "passedCheck": "补丁检查通过(这个游戏版本未核对)", "unavailable": "补丁不适用:{{patches}}", "allAvailable": "全部可用", "someMissing": "{{count}} 项不可用", diff --git a/apps/launcher/src/renderer/src/pages/copies/CopyList.tsx b/apps/launcher/src/renderer/src/pages/copies/CopyList.tsx index 3c84983..b71adf8 100644 --- a/apps/launcher/src/renderer/src/pages/copies/CopyList.tsx +++ b/apps/launcher/src/renderer/src/pages/copies/CopyList.tsx @@ -1,7 +1,7 @@ import { useTranslation } from 'react-i18next'; import type { Copies } from '@shared/schemas/install.ts'; import { Sheet } from '../../components/Sheet.tsx'; -import { adaptationFor } from '../../versions.ts'; +import { isVerified } from '../../versions.ts'; interface CopyListProps { readonly registry: Copies; @@ -29,7 +29,11 @@ export function CopyList({ registry, supportedVersions, onSelect, onAdd }: CopyL
{t('copies.summary.version')}
{copy.gameVersion ?? unknown}
{t('copies.summary.adaptation')}
-
{adaptationFor(copy.gameVersion, supportedVersions) ?? unknown}
+
+ {isVerified(copy.gameVersion, supportedVersions) + ? {t('adaptation.verified')} + : {t('adaptation.unverified')}} +
{t('copies.summary.location')}
{copy.copyPath}
diff --git a/apps/launcher/src/renderer/src/pages/copies/CopySummary.tsx b/apps/launcher/src/renderer/src/pages/copies/CopySummary.tsx index 2f151a4..26f9b4b 100644 --- a/apps/launcher/src/renderer/src/pages/copies/CopySummary.tsx +++ b/apps/launcher/src/renderer/src/pages/copies/CopySummary.tsx @@ -4,7 +4,7 @@ import type { InstallRecord } from '@shared/schemas/install.ts'; import { Row } from '../../components/Row.tsx'; import { Sheet } from '../../components/Sheet.tsx'; import { ipcInvoke } from '../../ipc.ts'; -import { adaptationFor, isVerified } from '../../versions.ts'; +import { isVerified } from '../../versions.ts'; import { missingFeatures } from './missing-features.ts'; interface CopySummaryProps { @@ -37,8 +37,7 @@ export function CopySummary({ record, supportedVersions, onShowFeatures, onError {record.gameVersion ?? t('source.versionUnknown')} - {adaptationFor(record.gameVersion, supportedVersions) ?? t('source.versionUnknown')} - {verified ? t('adaptation.verified') : t('adaptation.nearest')} + {verified ? t('adaptation.verified') : t('adaptation.unverified')} {folder(record.copyPath)} {t(`copies.summary.methods.${record.method}`)} diff --git a/apps/launcher/src/renderer/src/pages/copies/FeatureStatus.tsx b/apps/launcher/src/renderer/src/pages/copies/FeatureStatus.tsx index 4a26ffe..4148341 100644 --- a/apps/launcher/src/renderer/src/pages/copies/FeatureStatus.tsx +++ b/apps/launcher/src/renderer/src/pages/copies/FeatureStatus.tsx @@ -4,7 +4,7 @@ import type { InstallRecord, PatchFeature } from '@shared/schemas/install.ts'; import { Sheet } from '../../components/Sheet.tsx'; import { featureName } from '../../features.ts'; import { ipcInvoke } from '../../ipc.ts'; -import { adaptationFor } from '../../versions.ts'; +import { isVerified } from '../../versions.ts'; interface FeatureStatusProps { readonly record: InstallRecord; @@ -31,7 +31,9 @@ export function FeatureStatus({ record, supportedVersions, onError }: FeatureSta for (const patch of record.unavailablePatches) { for (const tag of patch.features) unavailable.set(tag, [...(unavailable.get(tag) ?? []), patch.patchId]); } - const adaptation = adaptationFor(record.gameVersion, supportedVersions) ?? t('source.versionUnknown'); + const available = isVerified(record.gameVersion, supportedVersions) + ? t('copies.features.verifiedOn', { version: record.gameVersion }) + : t('copies.features.passedCheck'); const sections = groupBySection(features ?? []); return ( @@ -54,7 +56,7 @@ export function FeatureStatus({ record, supportedVersions, onError }: FeatureSta {feature.essential && <> {t('copies.features.essential')}} - {failed ? t('copies.features.unavailable', { patches: failed.join(', ') }) : t('copies.features.verifiedOn', { version: adaptation })} + {failed ? t('copies.features.unavailable', { patches: failed.join(', ') }) : available} ); diff --git a/apps/launcher/src/renderer/src/pages/home/HomeSide.tsx b/apps/launcher/src/renderer/src/pages/home/HomeSide.tsx index fcbb2f4..0df5e0b 100644 --- a/apps/launcher/src/renderer/src/pages/home/HomeSide.tsx +++ b/apps/launcher/src/renderer/src/pages/home/HomeSide.tsx @@ -2,7 +2,7 @@ import { useState } from 'react'; import { useTranslation } from 'react-i18next'; import type { InstallRecord } from '@shared/schemas/install.ts'; import type { Destination } from '../../shell/navigation.ts'; -import { adaptationFor, isVerified } from '../../versions.ts'; +import { isVerified } from '../../versions.ts'; import { missingFeatures } from '../copies/missing-features.ts'; interface HomeSideProps { @@ -35,7 +35,6 @@ export function HomeSide({ record, copies, supportedVersions, onNavigate, onSele ); } const missing = missingFeatures(record).length; - const adaptation = adaptationFor(record.gameVersion, supportedVersions); return ( <>

{t('side.currentCopy')}

@@ -59,10 +58,9 @@ export function HomeSide({ record, copies, supportedVersions, onNavigate, onSele
{t('side.adaptation')}
- {adaptation ?? t('source.versionUnknown')}{' '} {isVerified(record.gameVersion, supportedVersions) ? {t('adaptation.verified')} - : {t('adaptation.nearest')}} + : {t('adaptation.unverified')}}
{t('side.features')}
diff --git a/apps/launcher/src/renderer/src/pages/install/SourceStep.tsx b/apps/launcher/src/renderer/src/pages/install/SourceStep.tsx index ffa83ef..9f56d6e 100644 --- a/apps/launcher/src/renderer/src/pages/install/SourceStep.tsx +++ b/apps/launcher/src/renderer/src/pages/install/SourceStep.tsx @@ -4,7 +4,7 @@ import { FolderField } from '../../components/FolderField.tsx'; import { Notice } from '../../components/Notice.tsx'; import { formatBytes } from '../../format.ts'; import { ipcInvoke } from '../../ipc.ts'; -import { adaptationFor, isVerified } from '../../versions.ts'; +import { isVerified } from '../../versions.ts'; interface SourceStepProps { readonly source: GameFolderInspection | null; @@ -48,10 +48,7 @@ function SourceVerdict({ source, sourceSize, supportedVersions }: { readonly sou return (

- {t('source.versionUnverified', { - version: source.version ?? t('source.versionUnknown'), - nearest: adaptationFor(source.version, supportedVersions) ?? t('source.versionUnknown'), - })} + {t('source.versionUnverified', { version: source.version ?? t('source.versionUnknown') })}

{size}

diff --git a/apps/launcher/src/renderer/src/versions.ts b/apps/launcher/src/renderer/src/versions.ts index 3d99a7b..c7c0382 100644 --- a/apps/launcher/src/renderer/src/versions.ts +++ b/apps/launcher/src/renderer/src/versions.ts @@ -1,31 +1,11 @@ /** - * Game versions against the versions the patches were verified on (multi-version adaptation: - * the adaptation is chosen by the copy's version; without one for it, the nearest is used). + * Game versions against the versions with a check record (patches/versions/). There is no + * per-version selection of patches: every patch locates itself in the game build, so a version + * without a record is still installed with every patch tried, and the patch check of that copy + * says which features are available (docs/architecture.md 5.2). */ -/** Whether the patches were verified on this game version. */ +/** Whether this game version has a check record: every patch checked on it and verified in game. */ export function isVerified(version: string | null, supported: readonly string[]): boolean { return version !== null && supported.includes(version); } - -/** - * The adaptation used for a game version: the version itself when verified, otherwise the - * newest verified version not above it, otherwise the oldest verified version. - */ -export function adaptationFor(version: string | null, supported: readonly string[]): string | null { - const sorted = [...supported].sort(compareVersions); - if (sorted.length === 0) return null; - if (version === null) return sorted.at(-1) ?? null; - const notAbove = sorted.filter((candidate) => compareVersions(candidate, version) <= 0); - return notAbove.at(-1) ?? sorted[0] ?? null; -} - -function compareVersions(a: string, b: string): number { - const left = a.split('.').map(Number); - const right = b.split('.').map(Number); - for (let index = 0; index < Math.max(left.length, right.length); index += 1) { - const difference = (left[index] ?? 0) - (right[index] ?? 0); - if (difference !== 0) return difference; - } - return 0; -}