Window and taskbar icon from the user's own game install (VICTORY_ICON, on by default) #1787

Manually merged
github merged 1 commit from github-bot/gh-1787 into main 2026-11-29 08:21:48 +00:00 AGit
Owner

@⁠Jesper-Andersson on GitHub · 2026-11-29 00:05 UTC · original
Jesper-Andersson:pr/window-icon → main · +423 −3 · 5 files · 1 commits · merged 2026-11-29 08:16 UTC

Tested in game: the icon shows in the title bar and the taskbar button (checked by eye on 2026-11-29, Windows 11 dark theme, RTX 2070 SUPER). The log line for that run: icon set big=32 small=16 dpi=96. The install's smallest logo is 44x44, so the 32 px and 16 px icons are scaled down from it; the install has no smaller artwork. This ran on our branch, which has the same commits merged onto our own base, not on this PR branch itself.

On by default. VICTORY_ICON=0 turns it off.

Relates to: no issue; this PR is my claim for the idea.

What it changes

The game window and its taskbar button showed the generic application icon. This sets them from the logos that the installed title's own MicrosoftGame.config lists.

Behaviour change: on by default. VICTORY_ICON=0 turns it off and leaves the window as it was.

  • At the first top-level window, a worker thread (crates/victory-hle/src/modules/icon.rs) reads MicrosoftGame.config next to the title's executable. It takes the ShellVisuals logo attributes Square44x44Logo, Square150x150Logo and Square480x480Logo, or StoreLogo only when none of those is there.
  • Paths are checked: absolute paths, drive letters, .., and links that lead out of the game folder are all refused.
  • The nearest larger logo is decoded with the Windows Imaging Component (WIC) and scaled with Fant interpolation (premultiplied, then back to straight alpha) to GetSystemMetricsForDpi(SM_CXICON / SM_CXSMICON) at the window's DPI. It is built with CreateIconIndirect and posted as WM_SETICON (ICON_BIG, ICON_SMALL). The icons are kept for the life of the process.
  • A WM_SETICON from the title is let through and logged at debug level.
  • VICTORY_ICON: unset or game uses the title's logo, 0 is off, and a .ico or .png path uses that file instead. Any failure is logged once and leaves the window as it is.
  • windows becomes a normal dependency of victory-hle (it was optional, diagnostics only), with Win32_Foundation and Win32_Graphics_Imaging added. windows-sys gains Win32_UI_HiDpi. No new crate.
  • One line in docs/findings.md.

Asset policy. The code holds only the attribute names from Microsoft's public MicrosoftGame.config schema (ShellVisuals, Square44x44Logo and so on). The image file names and the images themselves are read at run time from the user's own installation. Nothing from the game is committed: no images, file names, strings or fixtures. Nothing is written to disk either; the icons live only in memory.

Sources (Microsoft Learn): WM_SETICON, CreateIconIndirect, the Windows Imaging Component decoding overview and IWICBitmapScaler, GetSystemMetricsForDpi, GetDpiForWindow, and the MicrosoftGame.config ShellVisuals schema.

How it was tested

  • GPU and profile: RTX 2070 SUPER 8 GB, Windows 11, Series S, 1080p, DLSS Performance (frame generation off, ray tracing off)
  • Before: the generic icon in the title bar, Alt+Tab and the taskbar.
  • After: the game's icon shows in the title bar and in the taskbar button. The log says icon set big=32 small=16 dpi=96 (96 dpi is 100 % scaling). The icons are scaled down from the 44x44 logo. Seen on our branch (the same commits merged onto our base), not on this PR branch. Not checked: Alt+Tab, and DPI scaling other than 100 %.
  • For shader changes, the wave sizes tested: N/A (no shader change)
  • cargo test passed for the crates it touches: yes: 203 passed, 0 failed, 3 ignored, plus no_dll_planting 1 passed (-p victory-hle; the unit tests are synthetic and cover the manifest parsing and the path checks). cargo clippy -p victory-hle --all-targets: no warnings in victory-hle (the warnings that remain are main's own, in victory-shader and victory-gpu, so -D warnings stops there before reaching this crate). cargo xtask policy: fails only on upstream's own crates/victory-shader/src/emit/lower.rs (667,523 bytes, over the 655,360-byte limit; the same on main, see #1429/#1493/#1527). This PR does not touch that file, and every changed file passes.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches (icon, taskbar, title bar, dark mode, DWM, lifecycle.rs). Related: none sets the window icon. #982 (graphical launcher) has its own launcher icon drawn by its build.rs; that is a separate program, not the game window. #1002, #1009, #1067 and #753 also change the window procedure in lifecycle.rs. This PR adds two lines there (icon::start in hook, and a debug log on the title's WM_SETICON), so a rebase on any of them should be trivial. Companion PR (separate, independent, touches the same two spots in lifecycle.rs): the dark title bar, pr/dark-title.

This was written with AI assistance (Claude Code).

**@⁠Jesper-Andersson** on GitHub · 2026-11-29 00:05 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1787) `Jesper-Andersson:pr/window-icon` → `main` · +423 −3 · 5 files · 1 commits · merged 2026-11-29 08:16 UTC <!-- Labels are in the title: pr-feature, startup. --> Tested in game: the icon shows in the title bar and the taskbar button (checked by eye on 2026-11-29, Windows 11 dark theme, RTX 2070 SUPER). The log line for that run: `icon set big=32 small=16 dpi=96`. The install's smallest logo is 44x44, so the 32 px and 16 px icons are scaled down from it; the install has no smaller artwork. This ran on our branch, which has the same commits merged onto our own base, not on this PR branch itself. On by default. `VICTORY_ICON=0` turns it off. Relates to: no issue; this PR is my claim for the idea. ## What it changes The game window and its taskbar button showed the generic application icon. This sets them from the logos that the installed title's own `MicrosoftGame.config` lists. **Behaviour change: on by default.** `VICTORY_ICON=0` turns it off and leaves the window as it was. - At the first top-level window, a worker thread (`crates/victory-hle/src/modules/icon.rs`) reads `MicrosoftGame.config` next to the title's executable. It takes the `ShellVisuals` logo attributes `Square44x44Logo`, `Square150x150Logo` and `Square480x480Logo`, or `StoreLogo` only when none of those is there. - Paths are checked: absolute paths, drive letters, `..`, and links that lead out of the game folder are all refused. - The nearest larger logo is decoded with the Windows Imaging Component (WIC) and scaled with Fant interpolation (premultiplied, then back to straight alpha) to `GetSystemMetricsForDpi(SM_CXICON / SM_CXSMICON)` at the window's DPI. It is built with `CreateIconIndirect` and posted as `WM_SETICON` (`ICON_BIG`, `ICON_SMALL`). The icons are kept for the life of the process. - A `WM_SETICON` from the title is let through and logged at debug level. - `VICTORY_ICON`: unset or `game` uses the title's logo, `0` is off, and a `.ico` or `.png` path uses that file instead. Any failure is logged once and leaves the window as it is. - `windows` becomes a normal dependency of victory-hle (it was optional, diagnostics only), with `Win32_Foundation` and `Win32_Graphics_Imaging` added. `windows-sys` gains `Win32_UI_HiDpi`. No new crate. - One line in `docs/findings.md`. **Asset policy.** The code holds only the attribute names from Microsoft's public `MicrosoftGame.config` schema (`ShellVisuals`, `Square44x44Logo` and so on). The image file names and the images themselves are read at run time from the user's own installation. Nothing from the game is committed: no images, file names, strings or fixtures. Nothing is written to disk either; the icons live only in memory. Sources (Microsoft Learn): WM_SETICON, CreateIconIndirect, the Windows Imaging Component decoding overview and IWICBitmapScaler, GetSystemMetricsForDpi, GetDpiForWindow, and the MicrosoftGame.config ShellVisuals schema. ## How it was tested - GPU and profile: RTX 2070 SUPER 8 GB, Windows 11, Series S, 1080p, DLSS Performance (frame generation off, ray tracing off) - Before: the generic icon in the title bar, Alt+Tab and the taskbar. - After: the game's icon shows in the title bar and in the taskbar button. The log says `icon set big=32 small=16 dpi=96` (96 dpi is 100 % scaling). The icons are scaled down from the 44x44 logo. Seen on our branch (the same commits merged onto our base), not on this PR branch. **Not checked:** Alt+Tab, and DPI scaling other than 100 %. - For shader changes, the wave sizes tested: N/A (no shader change) - `cargo test` passed for the crates it touches: yes: 203 passed, 0 failed, 3 ignored, plus `no_dll_planting` 1 passed (`-p victory-hle`; the unit tests are synthetic and cover the manifest parsing and the path checks). `cargo clippy -p victory-hle --all-targets`: no warnings in victory-hle (the warnings that remain are main's own, in victory-shader and victory-gpu, so `-D warnings` stops there before reaching this crate). `cargo xtask policy`: fails only on upstream's own `crates/victory-shader/src/emit/lower.rs` (667,523 bytes, over the 655,360-byte limit; the same on main, see #1429/#1493/#1527). This PR does not touch that file, and every changed file passes. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches (icon, taskbar, title bar, dark mode, DWM, `lifecycle.rs`). Related: none sets the window icon. #982 (graphical launcher) has its own launcher icon drawn by its `build.rs`; that is a separate program, not the game window. #1002, #1009, #1067 and #753 also change the window procedure in `lifecycle.rs`. This PR adds two lines there (`icon::start` in `hook`, and a debug log on the title's `WM_SETICON`), so a rebase on any of them should be trivial. Companion PR (separate, independent, touches the same two spots in `lifecycle.rs`): the dark title bar, `pr/dark-title`. This was written with AI assistance (Claude Code).
At the first top-level window a worker thread (crates/victory-hle/src/modules/icon.rs)
reads MicrosoftGame.config beside the title's executable (file name matched
case-insensitively), takes the ShellVisuals logo attributes Square44x44Logo,
Square150x150Logo and Square480x480Logo (StoreLogo only when none of those is
present), and refuses any path that is absolute, has a drive, uses ".." or
leaves the game folder through a link. The nearest larger logo is decoded
with Windows Imaging Component, scaled with Fant interpolation (premultiplied,
then back to straight alpha) to GetSystemMetricsForDpi(SM_CXICON / SM_CXSMICON,
GetDpiForWindow), built with CreateIconIndirect from a 32-bit DIB section and
an empty mask, and posted to the window as WM_SETICON (ICON_BIG, ICON_SMALL).
The icons are kept for the life of the process. A WM_SETICON from the title is
let through and logged at debug level.

VICTORY_ICON: unset or "game" uses the title's logo (default on, a behaviour
change for the PR description); "0" leaves the window alone; a .ico or .png
path uses that file. Any failure is logged once and leaves the window as is.
Nothing from the game is stored: the manifest attribute names are Microsoft's
public schema, the file names come from the user's manifest at run time.

The windows crate is now a normal dependency of victory-hle (it was optional,
diagnostics only), with Win32_Foundation and Win32_Graphics_Imaging added;
windows-sys gains Win32_UI_HiDpi. No new crate.

Sources: Microsoft Learn: WM_SETICON, CreateIconIndirect, Windows Imaging
Component decoding overview and IWICBitmapScaler, GetSystemMetricsForDpi,
GetDpiForWindow, and the Game.config ShellVisuals schema.

This change was made with AI assistance (Claude Code).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 00:10:15 +00:00
github manually merged commit 670c97371d into main 2026-11-29 08:21:48 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!1787
No description provided.