KAZIK/tools/tests/build_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

50 lines
2.2 KiB
PowerShell

param([string]$MasmRoot = '')
$ErrorActionPreference = 'Stop'
$root = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
Push-Location $root
try {
$masmCandidates = @(
$MasmRoot,
'D:\MASM32\masm32',
'C:\masm32',
'F:\MASM32\masm32'
) | Where-Object { -not [string]::IsNullOrWhiteSpace($_) }
$foundMasm = $null
foreach ($cand in $masmCandidates) {
try {
$drive = [System.IO.Path]::GetPathRoot($cand).TrimEnd('\', '/')
if ($drive -and -not (Test-Path -LiteralPath $drive)) { continue }
$ml = Join-Path $cand 'bin\ml.exe'
if (Test-Path -LiteralPath $ml) {
$foundMasm = $cand
break
}
} catch {}
}
if ($foundMasm) {
$sdkRoot = Join-Path ${env:ProgramFiles(x86)} 'Windows Kits\10\Lib'
$sdk = Get-ChildItem -LiteralPath $sdkRoot -Directory -ErrorAction SilentlyContinue |
Sort-Object Name -Descending |
Where-Object { Test-Path -LiteralPath (Join-Path $_.FullName 'um\x86\kernel32.lib') } |
Select-Object -First 1
$libraryPaths = @()
if ($sdk) { $libraryPaths += '/LIBPATH:' + (Join-Path $sdk.FullName 'um\x86') }
$libraryPaths += "/LIBPATH:$foundMasm\lib"
& "$foundMasm\bin\ml.exe" /c /coff /Cp /nologo /I. /Fobuild\graphics\poker.obj poker.asm
if ($LASTEXITCODE -ne 0) { throw 'MASM assembly failed' }
if (Test-Path -LiteralPath 'build\casino_icon.res') {
& "$foundMasm\bin\link.exe" /nologo /SUBSYSTEM:WINDOWS /RELEASE /VERSION:5.0 @libraryPaths /OUT:build\graphics\poker.exe build\graphics\poker.obj build\casino_icon.res kernel32.lib winmm.lib user32.lib ws2_32.lib gdi32.lib
} else {
& "$foundMasm\bin\link.exe" /nologo /SUBSYSTEM:WINDOWS /RELEASE /VERSION:5.0 @libraryPaths /OUT:build\graphics\poker.exe build\graphics\poker.obj kernel32.lib winmm.lib user32.lib ws2_32.lib gdi32.lib
}
if ($LASTEXITCODE -ne 0) { throw 'Link failed' }
} else {
& cmd.exe /c build.bat
if ($LASTEXITCODE -ne 0) { throw 'Build via build.bat failed' }
}
Write-Output 'Built build\graphics\poker.exe. Publish only after verification.'
} finally {
Pop-Location
}