param( [switch]$SkipTests ) $ErrorActionPreference = "Stop" $Root = $PSScriptRoot if (-not $SkipTests) { Write-Host "Running shader-core host unit tests..." -ForegroundColor Cyan cargo test --manifest-path "$Root\Cargo.toml" if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } Write-Host "Building N64 ROM (mips-nintendo64-none, release)..." -ForegroundColor Cyan Push-Location "$Root\crates\n64-rom" try { cargo +nightly-2025-01-12 run --release if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } finally { Pop-Location } $SrcRom = "$Root\target\mips-nintendo64-none\release\n64-rom.z64" $AltRom = "$Root\crates\n64-rom\target\mips-nintendo64-none\release\n64-rom.z64" $BuiltRom = if (Test-Path $SrcRom) { $SrcRom } elseif (Test-Path $AltRom) { $AltRom } else { throw "Could not find generated .z64 ROM!" } New-Item -ItemType Directory -Force -Path "$Root\dist" | Out-Null $DistRom = "$Root\dist\n64-shader-studio.z64" Copy-Item -Force $BuiltRom $DistRom $Size = (Get-Item $DistRom).Length Write-Host "Ready for flashcart: $DistRom ($Size bytes)" -ForegroundColor Green