KAZIK/tools/tests/publish_graphics.ps1
Artvasil09 3ad5bf4c9d Develop assembly-only casino scenes and native games
Add native Durak, poker, blackjack, roulette, Buckshot and billiards scenes with animation assets and regression tests. Improve arrival, city, hall, profiles, shops, audio and exit handling; remove the portable C game core and refresh shipping executables.
2026-10-08 22:39:19 +03:00

34 lines
2.2 KiB
PowerShell

param()
$ErrorActionPreference = 'Stop'
$root = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
Push-Location $root
try {
$game = Join-Path $root 'build\graphics\poker.exe'
$sourcePath = Join-Path $root 'build\AssemblerCasinoLauncher.cs'
$source = [IO.File]::ReadAllText($sourcePath, [Text.Encoding]::UTF8)
$hash = (Get-FileHash -LiteralPath $game -Algorithm SHA256).Hash
$pattern = 'ExpectedPokerSha256 = "[A-Fa-f0-9]{64}"'
if ([regex]::Matches($source, $pattern).Count -ne 1) {
throw 'Launcher integrity constant is missing or ambiguous'
}
# Mechanical synchronization of the release hash, not a change to integrity policy.
$source = [regex]::Replace($source, $pattern, ('ExpectedPokerSha256 = "' + $hash + '"'))
$stage = Join-Path $root 'build\startup'
New-Item -ItemType Directory -Path $stage -Force | Out-Null
$stageSource = Join-Path $stage 'AssemblerCasinoLauncher.cs'
[IO.File]::WriteAllText($stageSource, $source, [Text.UTF8Encoding]::new($false))
$csc = Join-Path $env:WINDIR 'Microsoft.NET\Framework\v4.0.30319\csc.exe'
if (!(Test-Path -LiteralPath $csc)) { throw '.NET Framework C# compiler is required to update the existing launcher' }
& $csc /nologo /target:winexe /platform:x86 /reference:System.Windows.Forms.dll /win32icon:assets\icons\casino.ico "/out:$stage\Assembler Casino.exe" $stageSource
if ($LASTEXITCODE -ne 0) { throw 'Launcher compilation failed; game was not published' }
Copy-Item -LiteralPath $game -Destination (Join-Path $root 'poker.exe')
Copy-Item -LiteralPath $game -Destination (Join-Path $root 'bin\poker.exe')
Copy-Item -LiteralPath (Join-Path $stage 'Assembler Casino.exe') -Destination (Join-Path $root 'dist\Assembler Casino.exe')
[IO.File]::WriteAllText($sourcePath, $source, [Text.UTF8Encoding]::new($false))
foreach ($file in @('poker.exe', 'bin\poker.exe', 'build\graphics\poker.exe')) {
if ((Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash -ne $hash) {
throw "Published binary mismatch: $file"
}
}
Write-Output "Published the same graphical build to root/bin and updated the launcher: $hash"
} finally { Pop-Location }