fix(patcher): support regional.vromfs.bin decal and skin indexes on cache import
Modern online War Thunder clients (verified on 2.61.0.58) ship their decal and skin indexes (dldata/downloadable_decals.blk and dldata/downloadable_skins.blk) inside cache/binary.<ver>/regional.vromfs.bin rather than downloading downloadable_decals.<hash>.blk into cache/content/. Requiring downloadable_decals.<hash>.blk rejected every live 2.61 cache/content folder. - Accept modern online caches containing cached .ddsx textures alongside a sibling binary.<ver>/regional.vromfs.bin (as well as selecting the parent cache folder or legacy downloadable_decals.<hash>.blk caches). - Extract both dldata/downloadable_decals.blk and dldata/downloadable_skins.blk into a self-contained .wto-index snapshot on launcher import (excluded from the copied game cache/content folder) and embed them into char.vromfs.bin during copy build so webdlcontent::init mounts cache/content and resolves cached real decals and downloadable skins natively without client patches. - Log the specific rejection reason in launcher decal import and clarify the en/zh-CN prompts. Verified with root and launcher npm run typecheck, launcher electron-vite build, and an end-to-end temporary import + char.vromfs.bin build against a read-only 2.61.0.58 online cache (4,080 decals / 1,930 skins embedded). In-game acceptance pending on an isolated 2.61.0.58 client copy.
This commit is contained in:
1 parent
deffcd6dde
commit
662e837ab2
9 files changed
+218
-42
No files matched your search
@@ -1,7 +1,12 @@
|
||||
import { randomUUID } from 'node:crypto';
|
||||
import { cp, lstat, mkdir, realpath, rm } from 'node:fs/promises';
|
||||
import { dirname, isAbsolute, join, relative } from 'node:path';
|
||||
import { isInSteamLibrary, playerDecalCacheProblem } from '@wto/patcher';
|
||||
import {
|
||||
isInSteamLibrary,
|
||||
playerDecalCacheProblem,
|
||||
resolvePlayerDecalCacheFolder,
|
||||
writeDecalCacheIndexSnapshot,
|
||||
} from '@wto/patcher';
|
||||
import { AppError } from '@shared/errors.ts';
|
||||
import type { Copies } from '@shared/schemas/install.ts';
|
||||
import { canonicalCopyPath, copyPathContains, listCopies, steamLibraryNeedsConfirmation, updateCopyRecord } from './install-record.ts';
|
||||
@@ -33,8 +38,13 @@ export async function importDecalCache(
|
||||
dataPath: string, sourcePath: string, signal?: AbortSignal, steamDataConfirmed = false,
|
||||
): Promise<string> {
|
||||
if (!isAbsolute(sourcePath)) throw new AppError('decal_source_invalid');
|
||||
const source = await realpath(sourcePath).catch(() => null);
|
||||
if (!source || playerDecalCacheProblem(source)) throw new AppError('decal_source_invalid');
|
||||
const rawSource = await realpath(sourcePath).catch(() => null);
|
||||
const source = rawSource ? await realpath(resolvePlayerDecalCacheFolder(rawSource)).catch(() => null) : null;
|
||||
const problem = source ? playerDecalCacheProblem(source) : 'selected folder could not be resolved';
|
||||
if (!source || problem) {
|
||||
console.warn('[decals] invalid decal cache source:', sourcePath, '->', problem);
|
||||
throw new AppError('decal_source_invalid');
|
||||
}
|
||||
|
||||
const root = await cacheRoot(dataPath, steamDataConfirmed);
|
||||
if (copyPathContains(source, root) || copyPathContains(root, source)) {
|
||||
@@ -56,7 +66,12 @@ export async function importDecalCache(
|
||||
},
|
||||
});
|
||||
signal?.throwIfAborted();
|
||||
if (playerDecalCacheProblem(target)) throw new AppError('decal_source_invalid');
|
||||
writeDecalCacheIndexSnapshot(source, target);
|
||||
const copiedProblem = playerDecalCacheProblem(target);
|
||||
if (copiedProblem) {
|
||||
console.warn('[decals] copied decal cache failed validation:', copiedProblem);
|
||||
throw new AppError('decal_source_invalid');
|
||||
}
|
||||
return id;
|
||||
} catch (error) {
|
||||
await discardDecalCache(dataPath, id, steamDataConfirmed);
|
||||
|
||||
Reference in new issue
Block a user