From bec3bb1e4afa398beb33e48dd50c4a2672f70fa3 Mon Sep 17 00:00:00 2001 From: Cyd Date: Mon, 6 Jul 2026 19:43:37 -0500 Subject: [PATCH] Sparse package icons need resources.pri at the external location MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- pkg/AppxManifest.xml | 5 +++- pkg/Make-Assets.ps1 | 62 ++++++++++++++++++++++++++++++++++++++++++ pkg/Register-vRIO.ps1 | 7 +++++ pkg/resources.pri | Bin 0 -> 2520 bytes 4 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 pkg/Make-Assets.ps1 create mode 100644 pkg/resources.pri diff --git a/pkg/AppxManifest.xml b/pkg/AppxManifest.xml index 8ac2b93..06d020f 100644 --- a/pkg/AppxManifest.xml +++ b/pkg/AppxManifest.xml @@ -16,10 +16,13 @@ xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" IgnorableNamespaces="uap uap3 uap10 rescap"> + + Version="1.0.0.1" /> vRIO diff --git a/pkg/Make-Assets.ps1 b/pkg/Make-Assets.ps1 new file mode 100644 index 0000000..81e3ed3 --- /dev/null +++ b/pkg/Make-Assets.ps1 @@ -0,0 +1,62 @@ +<# +.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\\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.' diff --git a/pkg/Register-vRIO.ps1 b/pkg/Register-vRIO.ps1 index cc62adb..780b6d1 100644 --- a/pkg/Register-vRIO.ps1 +++ b/pkg/Register-vRIO.ps1 @@ -39,6 +39,13 @@ $exe = Join-Path $ExePath 'VRio.App.exe' if (-not (Test-Path $exe)) { throw "VRio.App.exe not found in '$ExePath'" } $manifest = Join-Path $PSScriptRoot 'AppxManifest.xml' +# With AllowExternalContent the shell resolves the manifest's logo assets +# against the EXTERNAL location, not the manifest's folder — the Start/taskbar +# icon only shows if Assets\ and resources.pri sit next to the exe. +$assetDir = New-Item -ItemType Directory -Force (Join-Path $ExePath 'Assets') +Copy-Item (Join-Path $PSScriptRoot 'Assets\*') $assetDir -Force +Copy-Item (Join-Path $PSScriptRoot 'resources.pri') $ExePath -Force + Add-AppxPackage -Register $manifest -ExternalLocation (Resolve-Path $ExePath).Path $family = (Get-AppxPackage -Name $packageName).PackageFamilyName Write-Host "Registered $packageName with external location '$ExePath'." diff --git a/pkg/resources.pri b/pkg/resources.pri new file mode 100644 index 0000000000000000000000000000000000000000..be18d3490f345df5bc7c147736371a1530bf56fa GIT binary patch literal 2520 zcmcguOHUI~6#k|Uo?>_?xEyybpthwVF)nNZL=q6v_#mQbMmj)~PMLHD(zx^&_!IaE z`~;W&1Xis10lHy>-*<0^N2oO>%9+eP=ic+Y=bU?If>uxsTlFH~;CK*l0eo|S5uBfs z#AZN&n!nYo)|=aVAGLG=^OQ4u8mRfvmfybQi?=~Z!{3dzcKyI3-%XUil7E=!xBRFY zcww=6sh>{+0|~$8#a=!3gG+VHXMm%`ei!~J`C$+KM)pd4UG$I0@1^hd_115b-%J1W z5Be|qd+Q&Of05rV^-=x>eS8Ly#v~sL4r|Lo6C9+-agZVIBkm_2BpxEZL!5wvY3B#0 zDb&nTx--voaJGZ3ywyw5DriZw6fKL^O0qt3g&w^^Pms2eIgCy5DY^`@9J91$SF((^ z9|K0Vgn8mOc!hPWpp4g8!~$1l!KUV0;#j~ON5RS2&y!w#tDFi_rvDv!R2(oFOA#xc z#QPxkG|Ws1WcQ*TUHbj7lTHWsjIGU@zg^vJdVwGDRJinF!TWyvMR{WTAwYx~c=)f1xEN#8Z=Q}jIMzNFNUmX znEKf|s-(P?^({2^cJ>NS^0~0NW9U-Jkd?*q!s=o!ZpSExVSCkU z*0=pA&b5OED*jGAiv8BiL1lR@7e)nov-LS-Am%>ma^L8#NkCD9{iVoN2lZ+K%BMhB zD#DT%R-XtbuXIIgzXHvrqm1g5IqV+g)*&OqM_5u8^F*3C<1l!jgLy*DocadShQZd3 z`creA8DZt!@)e2AL$7=F$Vk~iW_Jxa&aNH9BaGuY-*rrM&GL;>P}kP+!Q z3>#kT*Gx+pJ)0ld{GGq#evr8Qxgt3B@Mp|lyC1rIZ~l58v&Gxp$87Qc?4ww^-F+18 d4f4