mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
Discord's game detection matches a running process named hex.exe to the Steam game HEX: Shards of Fate, so the app was shown as that game for as long as Hex ran. The detectable list has exactly one entry with that bare executable, which is why the managed install matched. Windows now installs and runs hex-voice.exe. A terminal still runs hex: PATHEXT resolves it to hex.com, which starts the GUI executable beside it. Releases before the rename were staged as hex.exe by their own updater, so the app copies such an install to the new name, repoints the Start Menu shortcut and Launch at login, and relaunches before claiming the single instance. The installer, script installer, updater, console entry point, and docs use the new name; the published artifact stays hex.exe.
55 lines
2.6 KiB
PowerShell
55 lines
2.6 KiB
PowerShell
# Builds hex-setup-<version>-windows-<x64|arm64>.exe, the per-user Windows
|
|
# installer, around an already-built (and signed) release hex.exe (installed
|
|
# as hex-voice.exe) and its console entry point hex.com. Installs Inno Setup 6
|
|
# when ISCC is missing. The installer embeds both byte for byte. -Console is
|
|
# left out only to wrap a release published before hex.com.
|
|
#
|
|
# scripts/build-windows-installer.ps1 -Executable dist\hex-2.4.0-windows-x64.exe `
|
|
# -Console dist\hex-2.4.0-windows-x64.com -Version 2.3.0 -Arch x86_64 -OutDir dist
|
|
[CmdletBinding()]
|
|
param(
|
|
[Parameter(Mandatory)] [string]$Executable,
|
|
[string]$Console,
|
|
[Parameter(Mandatory)] [string]$Version,
|
|
[Parameter(Mandatory)] [ValidateSet('x86_64', 'aarch64')] [string]$Arch,
|
|
[Parameter(Mandatory)] [string]$OutDir
|
|
)
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
if ($Version -notmatch '^(\d+\.\d+\.\d+(-beta\.\d+)?|0\.0\.0-dev-\d+)$') { throw "Expected a release version, not $Version." }
|
|
$Executable = (Resolve-Path $Executable).Path
|
|
$consoleDefine = @()
|
|
if ($Console) { $consoleDefine = @("/DConsole=$((Resolve-Path $Console).Path)") }
|
|
New-Item -ItemType Directory -Force $OutDir | Out-Null
|
|
$OutDir = (Resolve-Path $OutDir).Path
|
|
$label = if ($Arch -eq 'x86_64') { 'x64' } else { 'arm64' }
|
|
$script = Join-Path (Split-Path -Parent $PSScriptRoot) 'packaging\windows\hex.iss'
|
|
|
|
function Find-Iscc {
|
|
$candidates = @(
|
|
(Get-Command ISCC.exe -ErrorAction SilentlyContinue | ForEach-Object Source),
|
|
"${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe",
|
|
"$env:ProgramFiles\Inno Setup 6\ISCC.exe",
|
|
"$env:LOCALAPPDATA\Programs\Inno Setup 6\ISCC.exe"
|
|
)
|
|
$candidates | Where-Object { $_ -and (Test-Path $_) } | Select-Object -First 1
|
|
}
|
|
|
|
$iscc = Find-Iscc
|
|
if (-not $iscc) {
|
|
if (Get-Command choco.exe -ErrorAction SilentlyContinue) {
|
|
choco install innosetup --yes --no-progress | Out-Host
|
|
} else {
|
|
$setup = Join-Path $env:TEMP 'innosetup.exe'
|
|
Invoke-WebRequest -Uri 'https://jrsoftware.org/download.php/is.exe' -OutFile $setup -UseBasicParsing
|
|
Start-Process $setup -ArgumentList '/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART', '/CURRENTUSER' -Wait
|
|
}
|
|
$iscc = Find-Iscc
|
|
if (-not $iscc) { throw 'Inno Setup could not be installed.' }
|
|
}
|
|
|
|
& $iscc /Qp "/DAppVersion=$Version" "/DArch=$label" "/DExecutable=$Executable" @consoleDefine "/DOutputDir=$OutDir" $script
|
|
if ($LASTEXITCODE -ne 0) { throw "ISCC failed with exit code $LASTEXITCODE." }
|
|
$installer = Join-Path $OutDir "hex-setup-$Version-windows-$label.exe"
|
|
if (-not (Test-Path $installer)) { throw "ISCC did not produce $installer." }
|
|
Write-Output $installer
|