[CmdletBinding()] param([Parameter(Mandatory=$true)][string]$ArchivePath) $ErrorActionPreference = 'Stop' Add-Type -AssemblyName System.IO.Compression.FileSystem $zip = [IO.Compression.ZipFile]::OpenRead((Resolve-Path -LiteralPath $ArchivePath).Path) try { $plists = @($zip.Entries | Where-Object { $_.FullName -match '^[^/]+[.]app/Contents/Info[.]plist$' }) if ($plists.Count -ne 1) { throw 'Expected exactly one macOS application bundle.' } $prefix = $plists[0].FullName -replace 'Info[.]plist$', '' $reader = [IO.StreamReader]::new($plists[0].Open()) try { [xml]$plist = $reader.ReadToEnd() } finally { $reader.Dispose() } $executable = $plist.SelectSingleNode('//key[text()="CFBundleExecutable"]/following-sibling::string[1]').InnerText $identifier = $plist.SelectSingleNode('//key[text()="CFBundleIdentifier"]/following-sibling::string[1]').InnerText if ($identifier -ne 'com.blockline.relaydistrict' -or -not $executable -or $executable.Contains('/')) { throw 'Unexpected bundle identity or executable.' } $binary = $zip.GetEntry($prefix + 'MacOS/' + $executable) if (-not $binary -or $binary.Length -lt 1024) { throw 'Application executable missing.' } if (($binary.ExternalAttributes -band 0x00490000) -eq 0) { throw 'Unix executable permissions missing. Export directly to ZIP.' } $signature = $zip.GetEntry($prefix + '_CodeSignature/CodeResources') if (-not $signature -or $signature.Length -eq 0) { throw 'Code signature missing: enable built-in ad-hoc signing in the macOS preset.' } $packs = @($zip.Entries | Where-Object { $_.FullName.StartsWith($prefix + 'Resources/') -and $_.FullName.EndsWith('.pck') }) if ($packs.Count -ne 1 -or $packs[0].Length -lt 1024) { throw 'Game data missing.' } Write-Host 'Mac archive structure OK: bundle, executable permissions, signature manifest, game data.' } finally { $zip.Dispose() }