build-rom.ps1 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. param(
  2. [switch]$SkipTests
  3. )
  4. $ErrorActionPreference = "Stop"
  5. $Root = $PSScriptRoot
  6. if (-not $SkipTests) {
  7. Write-Host "Running shader-core host unit tests..." -ForegroundColor Cyan
  8. cargo test --manifest-path "$Root\Cargo.toml"
  9. if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
  10. }
  11. Write-Host "Building N64 ROM (mips-nintendo64-none, release)..." -ForegroundColor Cyan
  12. Push-Location "$Root\crates\n64-rom"
  13. try {
  14. cargo +nightly-2025-01-12 run --release
  15. if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
  16. } finally {
  17. Pop-Location
  18. }
  19. $SrcRom = "$Root\target\mips-nintendo64-none\release\n64-rom.z64"
  20. $AltRom = "$Root\crates\n64-rom\target\mips-nintendo64-none\release\n64-rom.z64"
  21. $BuiltRom = if (Test-Path $SrcRom) { $SrcRom } elseif (Test-Path $AltRom) { $AltRom } else { throw "Could not find generated .z64 ROM!" }
  22. New-Item -ItemType Directory -Force -Path "$Root\dist" | Out-Null
  23. $DistRom = "$Root\dist\n64-shader-studio.z64"
  24. Copy-Item -Force $BuiltRom $DistRom
  25. $Size = (Get-Item $DistRom).Length
  26. Write-Host "Ready for flashcart: $DistRom ($Size bytes)" -ForegroundColor Green