Show whether a game version is verified instead of a nearest adaptation

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.
This commit is contained in:
N0VAN0M4LY committed 2026-11-29 16:34:54 +08:00
1 parent f4d2916f0d
commit abf958e2a6
8 files changed
+36 -54

No files matched your search

@@ -49,7 +49,7 @@
"spaceValue": "About 97 GB (copy installation)", "spaceValue": "About 97 GB (copy installation)",
"currentCopy": "Current copy", "currentCopy": "Current copy",
"copyName": "Game copy", "copyName": "Game copy",
"adaptation": "Adaptation", "adaptation": "Check status",
"features": "Features", "features": "Features",
"allAvailable": "✓ All available", "allAvailable": "✓ All available",
"someMissing": "⚠ {{count}} unavailable", "someMissing": "⚠ {{count}} unavailable",
@@ -57,7 +57,7 @@
}, },
"adaptation": { "adaptation": {
"verified": "✓ Verified", "verified": "✓ Verified",
"nearest": "⚠ Nearest version" "unverified": "⚠ Not verified"
}, },
"bar": { "bar": {
"notInstalled": "Not installed", "notInstalled": "Not installed",
@@ -114,8 +114,8 @@
"body": "Select the folder where War Thunder is installed.", "body": "Select the folder where War Thunder is installed.",
"dialogTitle": "Select the War Thunder installation folder", "dialogTitle": "Select the War Thunder installation folder",
"notAGame": "The selected folder is not a War Thunder installation. Missing: {{files}}", "notAGame": "The selected folder is not a War Thunder installation. Missing: {{files}}",
"versionVerified": "Game version {{version}} · Adaptation {{version}} (verified)", "versionVerified": "Game version {{version}} (verified)",
"versionUnverified": "Game version {{version}} will use adaptation {{nearest}}. Check the patches to see which features are available.", "versionUnverified": "Game version {{version}} has no check record yet. Installing still tries every patch; the patch check shows which features are available.",
"versionUnknown": "unknown", "versionUnknown": "unknown",
"size": "Size {{size}} · {{files}} files", "size": "Size {{size}} · {{files}} files",
"measuring": "Calculating size…" "measuring": "Calculating size…"
@@ -211,8 +211,8 @@
"rename": "Rename", "rename": "Rename",
"source": "Installation source", "source": "Installation source",
"version": "Game version", "version": "Game version",
"adaptation": "Adaptation", "adaptation": "Check status",
"adaptationHint": "Selected automatically by game version", "adaptationHint": "Whether every patch was checked on this game version and verified in game",
"location": "Location", "location": "Location",
"method": "Installation type", "method": "Installation type",
"methods": { "methods": {
@@ -231,6 +231,7 @@
"lead": "Patch compatibility determines which features are available. Installation requires all essential patches.", "lead": "Patch compatibility determines which features are available. Installation requires all essential patches.",
"essential": "Required", "essential": "Required",
"verifiedOn": "Verified: {{version}}", "verifiedOn": "Verified: {{version}}",
"passedCheck": "Passed the patch check (this game version is not verified)",
"unavailable": "Patch does not apply: {{patches}}", "unavailable": "Patch does not apply: {{patches}}",
"allAvailable": "All available", "allAvailable": "All available",
"someMissing": "{{count}} unavailable", "someMissing": "{{count}} unavailable",
@@ -49,7 +49,7 @@
"spaceValue": "约 97 GB(复制安装)", "spaceValue": "约 97 GB(复制安装)",
"currentCopy": "当前副本", "currentCopy": "当前副本",
"copyName": "游戏副本", "copyName": "游戏副本",
"adaptation": "适配版本", "adaptation": "核对状态",
"features": "功能", "features": "功能",
"allAvailable": "✓ 全部可用", "allAvailable": "✓ 全部可用",
"someMissing": "⚠ {{count}} 项不可用", "someMissing": "⚠ {{count}} 项不可用",
@@ -57,7 +57,7 @@
}, },
"adaptation": { "adaptation": {
"verified": "✓ 已核对", "verified": "✓ 已核对",
"nearest": "⚠ 就近适配" "unverified": "⚠ 未核对"
}, },
"bar": { "bar": {
"notInstalled": "未安装", "notInstalled": "未安装",
@@ -114,8 +114,8 @@
"body": "选择已安装的战争雷霆文件夹。", "body": "选择已安装的战争雷霆文件夹。",
"dialogTitle": "选择战争雷霆安装文件夹", "dialogTitle": "选择战争雷霆安装文件夹",
"notAGame": "所选文件夹不是战争雷霆的安装文件夹,缺少:{{files}}", "notAGame": "所选文件夹不是战争雷霆的安装文件夹,缺少:{{files}}",
"versionVerified": "游戏版本 {{version}} · 适配版本 {{version}}(已核对)", "versionVerified": "游戏版本 {{version}}(已核对)",
"versionUnverified": "游戏版本 {{version}} 将使用适配版本 {{nearest}}。可用功能以补丁检查结果为准。", "versionUnverified": "游戏版本 {{version}} 还没有核对记录。安装时仍会逐个尝试全部补丁,可用功能以补丁检查结果为准。",
"versionUnknown": "未知", "versionUnknown": "未知",
"size": "大小 {{size}} · {{files}} 个文件", "size": "大小 {{size}} · {{files}} 个文件",
"measuring": "正在统计大小…" "measuring": "正在统计大小…"
@@ -211,8 +211,8 @@
"rename": "重命名", "rename": "重命名",
"source": "安装来源", "source": "安装来源",
"version": "游戏版本", "version": "游戏版本",
"adaptation": "适配版本", "adaptation": "核对状态",
"adaptationHint": "按游戏版本自动选择", "adaptationHint": "这个游戏版本是否检查过全部补丁并在游戏里验证过",
"location": "位置", "location": "位置",
"method": "安装方式", "method": "安装方式",
"methods": { "methods": {
@@ -231,6 +231,7 @@
"lead": "补丁检查结果决定功能是否可用。安装需要全部必需补丁。", "lead": "补丁检查结果决定功能是否可用。安装需要全部必需补丁。",
"essential": "必需", "essential": "必需",
"verifiedOn": "已核对:{{version}}", "verifiedOn": "已核对:{{version}}",
"passedCheck": "补丁检查通过(这个游戏版本未核对)",
"unavailable": "补丁不适用:{{patches}}", "unavailable": "补丁不适用:{{patches}}",
"allAvailable": "全部可用", "allAvailable": "全部可用",
"someMissing": "{{count}} 项不可用", "someMissing": "{{count}} 项不可用",
@@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import type { Copies } from '@shared/schemas/install.ts'; import type { Copies } from '@shared/schemas/install.ts';
import { Sheet } from '../../components/Sheet.tsx'; import { Sheet } from '../../components/Sheet.tsx';
import { adaptationFor } from '../../versions.ts'; import { isVerified } from '../../versions.ts';
interface CopyListProps { interface CopyListProps {
readonly registry: Copies; readonly registry: Copies;
@@ -29,7 +29,11 @@ export function CopyList({ registry, supportedVersions, onSelect, onAdd }: CopyL
<dt>{t('copies.summary.version')}</dt> <dt>{t('copies.summary.version')}</dt>
<dd>{copy.gameVersion ?? unknown}</dd> <dd>{copy.gameVersion ?? unknown}</dd>
<dt>{t('copies.summary.adaptation')}</dt> <dt>{t('copies.summary.adaptation')}</dt>
<dd>{adaptationFor(copy.gameVersion, supportedVersions) ?? unknown}</dd> <dd>
{isVerified(copy.gameVersion, supportedVersions)
? <span className="ok">{t('adaptation.verified')}</span>
: <span className="warn">{t('adaptation.unverified')}</span>}
</dd>
<dt>{t('copies.summary.location')}</dt> <dt>{t('copies.summary.location')}</dt>
<dd className="folder-path" title={copy.copyPath}>{copy.copyPath}</dd> <dd className="folder-path" title={copy.copyPath}>{copy.copyPath}</dd>
</dl> </dl>
@@ -4,7 +4,7 @@ import type { InstallRecord } from '@shared/schemas/install.ts';
import { Row } from '../../components/Row.tsx'; import { Row } from '../../components/Row.tsx';
import { Sheet } from '../../components/Sheet.tsx'; import { Sheet } from '../../components/Sheet.tsx';
import { ipcInvoke } from '../../ipc.ts'; import { ipcInvoke } from '../../ipc.ts';
import { adaptationFor, isVerified } from '../../versions.ts'; import { isVerified } from '../../versions.ts';
import { missingFeatures } from './missing-features.ts'; import { missingFeatures } from './missing-features.ts';
interface CopySummaryProps { interface CopySummaryProps {
@@ -37,8 +37,7 @@ export function CopySummary({ record, supportedVersions, onShowFeatures, onError
</Row> </Row>
<Row label={t('copies.summary.version')}>{record.gameVersion ?? t('source.versionUnknown')}</Row> <Row label={t('copies.summary.version')}>{record.gameVersion ?? t('source.versionUnknown')}</Row>
<Row label={t('copies.summary.adaptation')} hint={t('copies.summary.adaptationHint')}> <Row label={t('copies.summary.adaptation')} hint={t('copies.summary.adaptationHint')}>
{adaptationFor(record.gameVersion, supportedVersions) ?? t('source.versionUnknown')} <span className={verified ? 'ok' : 'warn'}>{verified ? t('adaptation.verified') : t('adaptation.unverified')}</span>
<span className={verified ? 'ok' : 'warn'}>{verified ? t('adaptation.verified') : t('adaptation.nearest')}</span>
</Row> </Row>
<Row label={t('copies.summary.location')}>{folder(record.copyPath)}</Row> <Row label={t('copies.summary.location')}>{folder(record.copyPath)}</Row>
<Row label={t('copies.summary.method')}>{t(`copies.summary.methods.${record.method}`)}</Row> <Row label={t('copies.summary.method')}>{t(`copies.summary.methods.${record.method}`)}</Row>
@@ -4,7 +4,7 @@ import type { InstallRecord, PatchFeature } from '@shared/schemas/install.ts';
import { Sheet } from '../../components/Sheet.tsx'; import { Sheet } from '../../components/Sheet.tsx';
import { featureName } from '../../features.ts'; import { featureName } from '../../features.ts';
import { ipcInvoke } from '../../ipc.ts'; import { ipcInvoke } from '../../ipc.ts';
import { adaptationFor } from '../../versions.ts'; import { isVerified } from '../../versions.ts';
interface FeatureStatusProps { interface FeatureStatusProps {
readonly record: InstallRecord; readonly record: InstallRecord;
@@ -31,7 +31,9 @@ export function FeatureStatus({ record, supportedVersions, onError }: FeatureSta
for (const patch of record.unavailablePatches) { for (const patch of record.unavailablePatches) {
for (const tag of patch.features) unavailable.set(tag, [...(unavailable.get(tag) ?? []), patch.patchId]); 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 ?? []); const sections = groupBySection(features ?? []);
return ( return (
@@ -54,7 +56,7 @@ export function FeatureStatus({ record, supportedVersions, onError }: FeatureSta
{feature.essential && <> <span className="tag">{t('copies.features.essential')}</span></>} {feature.essential && <> <span className="tag">{t('copies.features.essential')}</span></>}
</span> </span>
<span className={failed ? 'feature-note feature-note-warning' : 'feature-note'}> <span className={failed ? 'feature-note feature-note-warning' : 'feature-note'}>
{failed ? t('copies.features.unavailable', { patches: failed.join(', ') }) : t('copies.features.verifiedOn', { version: adaptation })} {failed ? t('copies.features.unavailable', { patches: failed.join(', ') }) : available}
</span> </span>
</div> </div>
); );
@@ -2,7 +2,7 @@ import { useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import type { InstallRecord } from '@shared/schemas/install.ts'; import type { InstallRecord } from '@shared/schemas/install.ts';
import type { Destination } from '../../shell/navigation.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'; import { missingFeatures } from '../copies/missing-features.ts';
interface HomeSideProps { interface HomeSideProps {
@@ -35,7 +35,6 @@ export function HomeSide({ record, copies, supportedVersions, onNavigate, onSele
); );
} }
const missing = missingFeatures(record).length; const missing = missingFeatures(record).length;
const adaptation = adaptationFor(record.gameVersion, supportedVersions);
return ( return (
<> <>
<h3 className="side-heading">{t('side.currentCopy')}</h3> <h3 className="side-heading">{t('side.currentCopy')}</h3>
@@ -59,10 +58,9 @@ export function HomeSide({ record, copies, supportedVersions, onNavigate, onSele
<dl className="kv"> <dl className="kv">
<dt>{t('side.adaptation')}</dt> <dt>{t('side.adaptation')}</dt>
<dd> <dd>
{adaptation ?? t('source.versionUnknown')}{' '}
{isVerified(record.gameVersion, supportedVersions) {isVerified(record.gameVersion, supportedVersions)
? <span className="ok">{t('adaptation.verified')}</span> ? <span className="ok">{t('adaptation.verified')}</span>
: <span className="warn">{t('adaptation.nearest')}</span>} : <span className="warn">{t('adaptation.unverified')}</span>}
</dd> </dd>
<dt>{t('side.features')}</dt> <dt>{t('side.features')}</dt>
<dd> <dd>
@@ -4,7 +4,7 @@ import { FolderField } from '../../components/FolderField.tsx';
import { Notice } from '../../components/Notice.tsx'; import { Notice } from '../../components/Notice.tsx';
import { formatBytes } from '../../format.ts'; import { formatBytes } from '../../format.ts';
import { ipcInvoke } from '../../ipc.ts'; import { ipcInvoke } from '../../ipc.ts';
import { adaptationFor, isVerified } from '../../versions.ts'; import { isVerified } from '../../versions.ts';
interface SourceStepProps { interface SourceStepProps {
readonly source: GameFolderInspection | null; readonly source: GameFolderInspection | null;
@@ -48,10 +48,7 @@ function SourceVerdict({ source, sourceSize, supportedVersions }: { readonly sou
return ( return (
<Notice tone="warning"> <Notice tone="warning">
<p> <p>
{t('source.versionUnverified', { {t('source.versionUnverified', { version: source.version ?? t('source.versionUnknown') })}
version: source.version ?? t('source.versionUnknown'),
nearest: adaptationFor(source.version, supportedVersions) ?? t('source.versionUnknown'),
})}
</p> </p>
<p className="small">{size}</p> <p className="small">{size}</p>
</Notice> </Notice>
+5 -25
View File
@@ -1,31 +1,11 @@
/** /**
* Game versions against the versions the patches were verified on (multi-version adaptation: * Game versions against the versions with a check record (patches/versions/). There is no
* the adaptation is chosen by the copy's version; without one for it, the nearest is used). * 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 { export function isVerified(version: string | null, supported: readonly string[]): boolean {
return version !== null && supported.includes(version); 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;
}