Files
VRIO/pkg/Make-Assets.ps1
T
CydandClaude Fable 5 bec3bb1e4a Sparse package icons need resources.pri at the external location
The shell resolves Square44x44Logo through the package resource index;
this package never had a resources.pri, so every icon lookup failed and
Start/taskbar showed a generic icon regardless of the Assets PNGs.
Empirically (SHLoadIndirectString against the live package), with
AllowExternalContent MRT loads resources from the EXTERNAL location,
not the manifest's folder — so Register-vRIO.ps1 now copies Assets\ and
resources.pri next to the exe before registering. Make-Assets.ps1
regenerates the PNGs from vwe.ico and rebuilds the pri (needs makepri
from the Windows SDK / SDK.BuildTools NuGet). Package version bumped;
the MrtCache is keyed by package full name, so same-version
re-registration serves stale lookups.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 19:43:37 -05:00

63 lines
2.7 KiB
PowerShell

<#
.SYNOPSIS
Regenerates pkg\Assets\*.png from src\VRio.App\vwe.ico and rebuilds
resources.pri — run after changing the icon artwork.
The shell resolves the manifest's Square44x44Logo through the package
resource index; without resources.pri every icon lookup fails and the
Start menu / taskbar show a generic icon. After regenerating, bump the
Version in AppxManifest.xml (the shell's MrtCache is keyed by package
full name and serves stale lookups otherwise) and re-register with
Register-vRIO.ps1.
.PARAMETER MakePri
Path to makepri.exe. Auto-detected from the Windows SDK if installed;
otherwise extract it from the Microsoft.Windows.SDK.BuildTools NuGet
package (it is a zip: bin\<ver>\x64\makepri.exe).
#>
param([string]$MakePri)
$ErrorActionPreference = 'Stop'
Add-Type -AssemblyName System.Drawing
if (-not $MakePri) {
$MakePri = Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\bin' -Recurse -Filter makepri.exe -ErrorAction SilentlyContinue |
Where-Object FullName -like '*\x64\*' | Select-Object -First 1 -ExpandProperty FullName
if (-not $MakePri) {
throw 'makepri.exe not found — install the Windows SDK or pass -MakePri (see help).'
}
}
$assets = Join-Path $PSScriptRoot 'Assets'
$ico = New-Object System.Drawing.Icon((Join-Path $PSScriptRoot '..\src\VRio.App\vwe.ico'), 32, 32)
$src = $ico.ToBitmap()
function Save-Png([int]$canvas, [int]$content, [string]$name) {
$bmp = New-Object System.Drawing.Bitmap($canvas, $canvas)
$g = [System.Drawing.Graphics]::FromImage($bmp)
$g.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
$g.PixelOffsetMode = [System.Drawing.Drawing2D.PixelOffsetMode]::HighQuality
$off = [int](($canvas - $content) / 2)
$g.DrawImage($src, $off, $off, $content, $content)
$g.Dispose()
$bmp.Save((Join-Path $assets $name), [System.Drawing.Imaging.ImageFormat]::Png)
$bmp.Dispose()
Write-Host " $name"
}
Save-Png 44 44 'logo44.png'
Save-Png 150 96 'logo150.png' # medium tile: 3x upscale centered, crisper than full-bleed
foreach ($ts in 16, 24, 32, 48) {
# targetsize / altform-unplated variants are found by naming convention;
# unplated is what the Win11 taskbar prefers.
Save-Png $ts $ts "logo44.targetsize-$ts.png"
Save-Png $ts $ts "logo44.targetsize-${ts}_altform-unplated.png"
}
$src.Dispose(); $ico.Dispose()
$cf = Join-Path $env:TEMP 'vrio-priconfig.xml'
& $MakePri createconfig /cf $cf /dq en-US /o | Out-Null
& $MakePri new /pr $PSScriptRoot /cf $cf /mn (Join-Path $PSScriptRoot 'AppxManifest.xml') /of (Join-Path $PSScriptRoot 'resources.pri') /o | Out-Null
Remove-Item $cf
Write-Host 'resources.pri rebuilt. Now bump Version in AppxManifest.xml and re-register.'