Files
WT-Offline/packages/build/src/char-pack.ts
T
N0VAN0M4LY 9ed92c33d4 fix(cosmetics): deliver decal indexes in the local character pack
The client never downloads downloadable_decals.<hash>.blk: webdlcontent only looks
for it in its web cache folder (aces.exe 2.61.0.37 0xd3e710 -> 0xd3f610) and deletes
a file whose signature check fails (0xd383e0), so the index the local service served
never reached it and every decal was dropped for lack of a texture.

The build now stores dldata/downloadable_skins.blk and dldata/downloadable_decals.blk
in char.vromfs.bin. The client's vromfs index path (0xd3bc40 -> 0xd3cc60) loads both
without hash or signature checks and skips the download path. Each decal points at
a built-in decals.dxp.bin texture (star, or panther for wide decals) as placeholder;
the texture manager strips the "?options" suffix before the lookup (DagorEngine
TextureMetaData::decode), so the existing textures are used.

--decal-cache <folder> copies the cache/content folder of the player's online
installation into the game copy instead; the client then uses that signed index and
its cached textures, and falls back to the cached dldata_s.info because the local
service now answers the dldata hosts with 404. The service's index generation, the
content hash helper and the decal texture dataset are removed.

Checked: typecheck; client startup log shows 1598 decals registered from the vromfs index
with no missing textures.
2026-11-28 12:44:45 +08:00

44 lines
2.3 KiB
TypeScript

/**
* Rebuild char.vromfs.bin: config/network.blk pointed at the local service, the offline
* version's features turned on in config/game_settings.blk, every vehicle shown in the
* tech tree (config/shop.blk), and, unless the player gave a decal source, placeholder decal
* and skin indexes (decals/offline-decal-index.ts).
*/
import { DECALS_CONFIG_PATH, offlineDecalIndex } from './decals/offline-decal-index.ts';
import { enableFeaturesForEveryone, GAME_SETTINGS_PATH, OFFLINE_FEATURES } from './features/offline-features.ts';
import type { LocalEndpoint } from './network/local-endpoint.ts';
import { redirectNetworkConfig, type NetworkRedirectReport } from './network/redirect-network-config.ts';
import { editPackBlks, readPackBlk } from './pack-edit.ts';
import { revealHiddenVehicles, SHOP_PATH } from './tech-tree/reveal-hidden-vehicles.ts';
export const NETWORK_CONFIG_PATH = 'config/network.blk';
export interface CharPackResult {
readonly pack: Uint8Array;
readonly network: NetworkRedirectReport;
/** Features that are now on for every player. */
readonly features: readonly string[];
/** Vehicles that were hidden from players who had not researched or bought them. */
readonly revealedVehicles: number;
/** Decals in the placeholder index; undefined when the index was left out. */
readonly placeholderDecals: number | undefined;
}
export interface CharPackOptions {
/** Store the placeholder decal index (false when the player's own web cache is copied). */
readonly placeholderDecals: boolean;
}
export function rebuildCharPack(stockPack: Uint8Array, endpoint: LocalEndpoint, options: CharPackOptions): CharPackResult {
let network: NetworkRedirectReport | undefined;
let features: string[] = [];
let revealedVehicles = 0;
const decals = options.placeholderDecals ? offlineDecalIndex(readPackBlk(stockPack, DECALS_CONFIG_PATH)) : undefined;
const pack = editPackBlks(stockPack, [
{ path: NETWORK_CONFIG_PATH, edit: (root) => { network = redirectNetworkConfig(root, endpoint); } },
{ path: GAME_SETTINGS_PATH, edit: (root) => { features = enableFeaturesForEveryone(root, OFFLINE_FEATURES); } },
{ path: SHOP_PATH, edit: (root) => { revealedVehicles = revealHiddenVehicles(root); } },
], decals?.files ?? []);
return { pack, network: network!, features, revealedVehicles, placeholderDecals: decals?.decals };
}