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 0000000..be18d34 Binary files /dev/null and b/pkg/resources.pri differ