mirror of
https://github.com/SK8-ENGINE/skate-3-rust-engine.git
synced 2026-10-26 19:47:44 +00:00
28 lines
1.4 KiB
PowerShell
28 lines
1.4 KiB
PowerShell
param([string]$Map)
|
|
$ErrorActionPreference = 'Stop'
|
|
Push-Location $PSScriptRoot
|
|
try {
|
|
$executable = Join-Path $PSScriptRoot 'bin/skate-game.exe'
|
|
if (-not (Test-Path -LiteralPath $executable)) { throw 'Game is not built. Run BUILD.bat first.' }
|
|
New-Item -ItemType Directory -Path (Join-Path $PSScriptRoot 'logs') -Force | Out-Null
|
|
$log = Join-Path $PSScriptRoot ('logs/game-' + (Get-Date -Format 'yyyyMMdd-HHmmss') + '.log')
|
|
Write-Host 'Starting imported skater project (Easy). Use your XInput controller; Esc opens graphics/pause menu.'
|
|
Write-Host "Log: $log"
|
|
$errorLog = [System.IO.Path]::ChangeExtension($log, 'stderr.log')
|
|
$assetArgument = '"' + (Join-Path $PSScriptRoot 'assets') + '"'
|
|
$gameArguments = @('--assets', $assetArgument)
|
|
if ($Map) {
|
|
$mapPath = (Resolve-Path -LiteralPath $Map).Path
|
|
if ([System.IO.Path]::GetExtension($mapPath) -ine '.skate') { throw 'Select a .skate map file.' }
|
|
$gameArguments += @('--map', ('"' + $mapPath + '"'))
|
|
Write-Host "Map: $mapPath"
|
|
}
|
|
$game = Start-Process -FilePath $executable -WorkingDirectory $PSScriptRoot `
|
|
-ArgumentList $gameArguments -NoNewWindow -Wait -PassThru `
|
|
-RedirectStandardOutput $log -RedirectStandardError $errorLog
|
|
if ($game.ExitCode -ne 0) {
|
|
Get-Content -LiteralPath $errorLog -Tail 30
|
|
throw "Game exited with code $($game.ExitCode). Log: $errorLog"
|
|
}
|
|
} finally { Pop-Location }
|