(null);
+ const focusKey = focus?.key ?? 0;
+ // Scroll once per request, not on every list refresh.
+ useEffect(() => {
+ if (focusKey && active) focusedRow.current?.scrollIntoView?.({ block: "center" });
+ }, [focusKey, active]);
const copyMod = mods.find((mod) => mod.id === copying);
// A status refresh may protect or remove a pack while its dialog is open.
const current = confirming ? mods.find((mod) => mod.id === confirming.id) : undefined;
@@ -114,6 +124,12 @@ export function ModList({
) : null}
+ {focus && !focused ? (
+
+ tf/custom/{focus.pack} isn't one of this profile's custom packs.
+
+ ) : null}
+
{mods.length === 0 ? (
{
expect(box.textContent).toContain("so TF2 may show different art");
await click('[data-testid="crosshair-stock-art-notice"] button');
expect(openMods).toHaveBeenCalledTimes(1);
+ expect(openMods).toHaveBeenCalledWith(expect.any(String));
});
it("warns about outside edits and rebuilds on request", async () => {
diff --git a/apps/desktop/src/lib/hud-ui.test.ts b/apps/desktop/src/lib/hud-ui.test.ts
index 4dbb1130..37682555 100644
--- a/apps/desktop/src/lib/hud-ui.test.ts
+++ b/apps/desktop/src/lib/hud-ui.test.ts
@@ -9,6 +9,7 @@ import {
type HudSort,
hudAuthorCopy,
hudCatalogControls,
+ hudCatalogMatch,
hudDisplayName,
hudIdFromName,
hudOptionsDirty,
@@ -414,6 +415,32 @@ describe("hud sorting", () => {
});
});
+describe("hudCatalogMatch", () => {
+ const catalog = [{ id: "rayshud" }, { id: "Middle-Mann" }, { id: "m0re-hud" }, { id: "m0rehud" }];
+ const match = (id: string, source: "local" | "hudDb" = "local", inferred = false) =>
+ hudCatalogMatch(catalog as never, {
+ installed: { id, hash: null, source, options: {} },
+ inferred,
+ schemaSupported: false,
+ catalogHash: null,
+ updateAvailable: false,
+ })?.id ?? null;
+
+ it("offers the catalog HUD an imported folder is a copy of", () => {
+ expect(match("rayshud")).toBe("rayshud");
+ expect(match("RaysHUD-master")).toBe("rayshud");
+ expect(match("middlemann-main")).toBe("Middle-Mann");
+ expect(match("rayshud", "hudDb", true)).toBe("rayshud");
+ });
+
+ it("offers nothing for a catalog install, an unknown HUD or an unclear name", () => {
+ expect(match("rayshud", "hudDb")).toBeNull();
+ expect(match("pure-hud")).toBeNull();
+ expect(match("m0re_hud")).toBeNull();
+ expect(match("m0re-hud")).toBe("m0re-hud");
+ });
+});
+
describe("hudIdFromName", () => {
it("matches the folder id a HUD is installed under", () => {
expect(hudIdFromName("Pure HUD")).toBe("pure-hud");
diff --git a/apps/desktop/src/lib/hud-ui.ts b/apps/desktop/src/lib/hud-ui.ts
index d5835a21..cc4b0b3a 100644
--- a/apps/desktop/src/lib/hud-ui.ts
+++ b/apps/desktop/src/lib/hud-ui.ts
@@ -539,6 +539,32 @@ export function formatHudRgba(r: number, g: number, b: number, a: number): strin
return `${r} ${g} ${b} ${a}`;
}
+/** Letters and digits only, without the branch suffix GitHub adds to a downloaded folder. */
+function normalizeHudName(name: string): string {
+ const lower = name.trim().toLowerCase();
+ const suffix = ["-master", "-main"].find((end) => lower.endsWith(end));
+ return (suffix ? lower.slice(0, -suffix.length) : lower).replace(/[^a-z0-9]/g, "");
+}
+
+/**
+ * The catalog HUD an imported or found HUD can be matched to: the one with its
+ * folder name, ignoring case, punctuation and a `-master`/`-main` suffix. Null
+ * when the HUD already comes from the catalog, or when no single entry fits.
+ */
+export function hudCatalogMatch(
+ catalog: HudCatalogEntry[],
+ state: HudUiState,
+): HudCatalogEntry | null {
+ const installed = state.installed;
+ if (!installed || (installed.source === "hudDb" && !state.inferred)) return null;
+ const exact = catalog.find((entry) => entry.id.toLowerCase() === installed.id.toLowerCase());
+ if (exact) return exact;
+ const wanted = normalizeHudName(installed.id);
+ if (wanted === "") return null;
+ const close = catalog.filter((entry) => normalizeHudName(entry.id) === wanted);
+ return close.length === 1 ? close[0] : null;
+}
+
/**
* The folder id a HUD gets when it is installed under `name` (an archive, a
* folder or a GameBanana listing title). Mirrors the native `hud_id_from_name`
diff --git a/apps/desktop/src/lib/mods-ui.test.ts b/apps/desktop/src/lib/mods-ui.test.ts
index 2810571e..7ab222a0 100644
--- a/apps/desktop/src/lib/mods-ui.test.ts
+++ b/apps/desktop/src/lib/mods-ui.test.ts
@@ -1,4 +1,5 @@
import { describe, expect, it, vi } from "vitest";
+import type { ModRecord } from "./bridge";
import {
canPreferParticleProvider,
DIRECT_BURNING_OVERLAY_ID,
@@ -13,6 +14,7 @@ import {
type ModSelection,
modDomId,
modMetaLine,
+ modOwnsPack,
modSourceLabel,
modSourceUrl,
modsApplyEnabled,
@@ -458,3 +460,15 @@ describe("particle file overlaps", () => {
expect(particleSkipAdvice("could not parse: bad header")).toContain("damaged");
});
});
+
+describe("modOwnsPack", () => {
+ const mod = { pack: "Cool Hits.vpk", inactivePack: undefined } as ModRecord;
+ it("matches a conflict notice's pack name to its record", () => {
+ expect(modOwnsPack(mod, "cool hits.vpk")).toBe(true);
+ expect(modOwnsPack(mod, "Cool Hits")).toBe(true);
+ expect(modOwnsPack(mod, "other")).toBe(false);
+ expect(modOwnsPack({ ...mod, pack: "stored-1", inactivePack: "creator" }, "creator")).toBe(
+ true,
+ );
+ });
+});
diff --git a/apps/desktop/src/lib/mods-ui.ts b/apps/desktop/src/lib/mods-ui.ts
index 724bdc90..64befa6b 100644
--- a/apps/desktop/src/lib/mods-ui.ts
+++ b/apps/desktop/src/lib/mods-ui.ts
@@ -370,6 +370,16 @@ export function modMetaLine(mod: ModRecord): string {
return `${modSourceLabel(mod.source)} · ${formatModBytes(mod.bytes)}`;
}
+/**
+ * Whether `pack`, a name under `tf/custom` as a conflict notice gives it, is
+ * this record's pack. Case and a `.vpk` ending are ignored, and a disabled
+ * pack still answers to the name it mounts under.
+ */
+export function modOwnsPack(mod: ModRecord, pack: string): boolean {
+ const key = (name: string) => name.toLowerCase().replace(/\.vpk$/, "");
+ return [mod.pack, mod.inactivePack].some((name) => name && key(name) === key(pack));
+}
+
/** A stable, selector-safe suffix for a record's test id. */
export function modDomId(id: string): string {
return id.replace(/[^a-z0-9]+/gi, "-").toLowerCase();
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index cc5a15c8..f702b1c0 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -95,7 +95,7 @@ Change install opens the finder with the previous install remembered in memory o
- Mouse `sensitivity` and `zoom_sensitivity_ratio` are exact decimal fields owned by the Gameplay scope (native `managed_cfg` and the frontend scope agree); input accepts plain positive decimals up to 1000 because the pinned dump documents no range, and an invalid entry is shown with a reason but never saved. Because the managed cfg runs after `config.cfg`, a completed absorb that saw `config.cfg` drift rewrites only the managed lines when TF2's options changed them; the sync never adds lines the managed file did not set. Raw input and acceleration stay with mastercomfig's Flat mouse addon, and no recommended sensitivity is offered.
- Gameplay's Weapons group holds auto reload, fast switch and Medigun auto-heal (`tf_medigun_autoheal`); Combat feedback holds damage numbers, combined damage numbers and healing numbers (`hud_combattext`, `_batching`, `_healing`). All are archived client cvars with no sv_cheats or server requirement; values seed from the effective cfg and TF2's defaults apply only when absent. Colors and the batching window are not offered. The same after-game sync covers these toggles, auto reload and fast switch because TF2's Advanced options write them to `config.cfg`; it accepts only values those options would write.
- **HUD** — hud-db catalog (paginated, sorted by name / tf2huds.dev listing activity / downloads / views from exact matched statistics, cached a day), one HUD per profile, install kinds by host (GitHub codeload zip, Dropbox `dl=1`, GameBanana download page, teamfortress.tv thread scrape, or link out), import picker offers ZIP/7z/RAR/folder, and Dropbox, teamfortress.tv and single-file GameBanana HUD downloads accept the same three archive formats through the shared bounded reader, TF2HUD.Editor schemas consumed as data (parser strips `//` comments, options may lack `Name`). Listing activity is not a HUD release date; missing statistics never enter metric rankings. Imgur albums open in the browser; GitHub `showcase.md` albums load in-app.
-- HUD browsing uses six previews per page with numbered navigation and page jumps above and below results; one Import HUD entry offers archive or extracted-folder choices. Imports unwrap a unique nested HUD only when every retained file belongs to it. Multiple HUD roots or sibling files require the user to follow the author's instructions and import one extracted HUD folder. `info.vdf` must declare UI version 3 before install; metadata and payloads are never synthesized or rewritten to imply compatibility. Dropbox download shards are trusted only as Dropbox redirects, one label below `dl.dropboxusercontent.com`.
+- HUD browsing uses six previews per page with numbered navigation and page jumps above and below results; one Import HUD entry offers archive or extracted-folder choices. An imported or found HUD whose folder name matches exactly one catalog entry (ignoring case, punctuation and a `-master`/`-main` suffix) offers Match to catalog, which pairs the record with that entry and renames the folder to its id. Imports unwrap a unique nested HUD only when every retained file belongs to it. A pick with no `info.vdf` is refused as not a HUD (`NotAHud`), and the pane keeps a notice with Open Mods; a Viewmodels VPK refused for carrying other content (`ViewmodelMixedContent`) gets the same notice. Multiple HUD roots or sibling files require the user to follow the author's instructions and import one extracted HUD folder. `info.vdf` must declare UI version 3 before install; metadata and payloads are never synthesized or rewritten to imply compatibility. Dropbox download shards are trusted only as Dropbox redirects, one label below `dl.dropboxusercontent.com`.
- Catalog HUD install and update emit `hud-install-progress` (downloading → checking → installing, the last after the write gate is taken). The card being installed shows exactly those steps, and the header status names the operation ("Installing HUD…"); there is no separate progress banner or percentage. Local imports have no download steps and show no card overlay.
- HUD/mod ZIP, 7z and folder imports share the profile ownership junk policy: case-insensitive `.bak`, `.cache`, `.ztmp`, `.execs-part`, VCS/OS metadata and `node_modules` components are skipped before root detection. Payload bytes and archive/path limits remain unchanged.
- HUD metric sorts rank only entries with a valid selected statistic; coverage and missing counts are explicit, and A to Z includes the full catalog. Statistics reloads serialize independently of the catalog and report loading/failure. tf2huds.dev counts follow its HUD list, then match explicit comfig links or unique GitHub repositories; names and missing values are never guessed into rankings. Browser fixture data is labeled Preview data.
@@ -112,7 +112,7 @@ Change install opens the finder with the previous install remembered in memory o
- **Viewmodels** — has two views, In game and Per weapon, and opens on In game: viewmodel FOV, Draw viewmodel, Min viewmodels, left-handed viewmodels and the Comfig transparent-viewmodels addon toggle (the same addon state as Comfig, disabled while TF2 runs or busy and outside Comfig profiles). The four cvars stay in `execs_gameplay.cfg` under a separate `viewmodels` managed-cfg scope that native `managed_cfg` and the frontend agree on, so Gameplay, Crosshair, Sounds and Viewmodels saves never rewrite each other's lines. They autosave like Gameplay and wait for a complete startup cfg read. Per weapon holds the class tables and the saved pack; its apply bar stays in view from either view. Set every class… previews a whole-profile Show all, Hide all or Keep melee visible choice (Hidden or Hands only) as the exact list of rows that change, applies it only to the draft, and offers Undo until the next edit; melee inspect rows count as melee and shared-animation conflicts are disclosed before applying. It builds `tf/custom/execs-viewmodels.vpk` locally from the player's installed class animation MDLs: per class, one Shown / Hidden / Hands only choice per loadout slot (Primary, Secondary, Melee, PDA) and one Shown / Hidden choice covering every inspect animation; a slot reads as what most of its weapons use (a tie follows the stock weapon), and changing it moves only the weapons that follow it. Each class is one table of slot rows under shared Shown / Hidden / Hands only columns, each row naming its weapons. Single weapon groups, with spellbooks and the grappling hook (no slot) under Other, sit beneath it in a Customize weapons fold, each with its own choice; the fold opens by default when a weapon is set on its own, and its summary counts those weapons. A group without a choice stays shown: an animation it shares with a hidden group is left untouched (Soldier's Concheror reuses the Shovel's swings), and each class names hidden rows that stay partly visible this way; a selection whose every animation is shared with a shown group is refused. Shared animations set to Hidden and Hands only at once still refuse the build. The catalog identity includes this rule's version, so a pack built under an earlier rule reads as outdated and its choices return as an unbuilt draft. Groups are derived from installed sources without CompVMInstaller data, and the build recipe still records exact per-group choices. Applying from the pane's apply bar builds the pack (release builds included, without rendered previews); applying an all-shown draft over a built pack removes it. Profile export carries the build recipe and output digest, never the generated model bytes; import rebuilds from the recipient's own install and refuses source differences. It also imports, replaces and removes a user-provided compatible VPK, and earlier Yttrium-style packs retain their saved bytes and options through profile switch and export/import; legacy build and preview commands fail before I/O. Do not copy CompVMInstaller's source archive or group table. Custom viewmodels on Valve Casual need the profile's `+exec` preload launch option (see Launch).
- **Sounds** — hit and kill sounds are exactly `tf/custom/execs-hitsounds/sound/ui/{hitsound,killsound}.wav` (the two names sv_pure exempts). Engine formats: 8/16-bit PCM or 4-bit MS-ADPCM at 11025/22050/44100 Hz; other WAVs are re-encoded, MP3-as-WAV refused. New choices are stock effects from the user's `tf2_sound_misc_dir.vpk`, the user's own WAV, MP3 or Ogg Vorbis clip (decoded by Symphonia in `audio_decode.rs`, at most 30 seconds, then prepared like a WAV; clips over a second carry a note), GameBanana hit and kill sound uploads handed over from Mods (listed as From GameBanana and saved like the player's own file), and comfig.app's hits library, the one retired catalog that came back. Its index is pinned to comfig-app commit `0dd0b076`, fetched from GitHub raw and cached by commit; sounds download on preview or use from `hits.comfig.app/<128-hex id>.wav` (an opaque id, not a byte digest), are validated as MS-ADPCM and cached as rebuildable downloads, and a boosted comfig sound re-encodes from its upload. The TF2Hitsounds catalog stays retired; its installed WAVs stay playable, switchable and exportable, but their baked boost cannot change. Sounds has two views: Hit and kill sound (game and music volume, the two slots, and a Pitch and repeat timing fold holding each sound's pitch and the hit repeat delay) and Sound library (search, filters, the list with one page control beneath it, and Remove sound files). A slot's Browse opens the library for that slot with the search focused, and a GameBanana handoff opens it too. A row's star and Use action show on hover or keyboard focus; a selected Use stays visible. The searchable library always chooses for one slot: a Hit sound / Kill sound switch, set by each slot's Browse, drives one Preview, one favorite star and one Use action per row ("Use [sound] for hits"). Show filters All, Favorites, Built into TF2 and comfig.app (your own file stays listed); Sort offers Suggested (yours, TF2's effects, comfig uploads made for the slot being chosen, then the rest, each in its source's own order), A to Z and Z to A. comfig publishes only names and ids, so there are no date or popularity sorts. Favorites are app-wide `localStorage`, never profile data. A compact preview dock floats at the bottom of Sounds with a preview volume (default 50%, app-wide `localStorage`) applied on top of each slot's Volume, a mute toggle and Stop; it never changes cvars or files. A selected Use stays focusable, and a row names the other slot when it holds that sound. **Boost** (0/6/12 dB, tanh soft clip) re-encodes a user-provided or comfig.app file louder because the engine caps `tf_dingaling_volume` at 1. A saved custom WAV remains dormant when a nonzero built-in effect plays, and Sounds offers Use saved sound; selecting the default file effect or explicitly removing or replacing the file clears it. `sound.cache` is deleted on apply. Sound CVars, autoexec wiring, WAVs and the hitsound record commit in one recoverable profile transaction. Accepted external managed WAV drift marks sound provenance changed until every old installed slot is replaced or removed; Sounds shows a repair warning. Sounds scans other mounted `tf/custom` packs for the two canonical virtual paths and reports candidate competitors and incomplete scans; it does not claim which file TF2 plays in-game.
- Sounds also owns TF2's Game volume (`volume`) and Music volume (`snd_musicvolume`): two 0–100% sliders at the top of the pane write them into the profile's `execs_gameplay.cfg` under the `sounds` managed-cfg scope (native `managed_cfg` and the frontend agree), so they run after `config.cfg` and a replaced or default `config.cfg` cannot reset them. Values keep TF2's exact decimals until a slider moves. The after-game sync updates these lines when TF2's options changed them in `config.cfg` (0–1 only) and never adds them; Copy sound settings carries them.
-- **Mods** opens on three task surfaces: **Browse**, **Custom packs**, and **Casual setup**. Browse uses GameBanana game id **297** through `Mod/Index`, or `Sound/Index` when its Mods / Sounds switch is on Sounds, for listings and name search; each section has its own categories. GameBanana numbers mods and sounds separately, so every id travels with its section, and a saved record names it in its page URL (`/mods/` or `/sounds/`), which update checks follow; `Generic_Name=contains,`, a selected `Generic_Category`, and mature-off `Generic_ContentRatings=-` compose server-side. New is the default; Popular, Likes, Views, Updated and New preserve upstream order and map to `Generic_MostDownloaded`, `Generic_MostLiked`, `Generic_MostViewed`, `Generic_LatestUpdated` and `Generic_Newest`. Added and updated dates stay distinct, unavailable metrics remain unknown, and All-category totals are estimates because non-GUI excluded roots are filtered locally. GUI results in the HUDs subcategory install as the profile's HUD, never as a custom pack: the card offers Install HUD, the file chooser lists only ZIP, 7z and RAR files and says which HUD it replaces, and native code rechecks the category and the chosen file, then runs the archive through the HUD importer's reader and checks and installs it as a `Local` HUD record named after the listing. The card of the installed HUD shows Installed and opens the HUD pane. Every other GUI mod (menus, icons, fonts, scoreboards, loading screens) installs like any other mod, while the pack installer still refuses a payload that is a HUD. Direct installs read the mod's immediate category to tell the two apart. Maps install too (Decal Tool, Prefabs and Serverside Weapons stay hidden): a `.bsp` outside any content folder goes into the pack's `maps` folder with the files beside it named after it (`.nav`, `