# Baut Loader (C++) und Mod (C#) nach dist\: # dist\dinput8.dll -> in den Spielordner (Bin_High_Win64) # dist\BSO\BSO.dll + *.json -> nach Bin_High_Win64\BSO # dist\BSO-Mod.zip -> Release-Paket fuer den Launcher (release.ps1 -Product mod) # Danach automatisch signieren und auf die Website laden (wie MSCO; Version aus BSO.csproj, Changelog aus CHANGELOG.md). # Gibt es die Version schon, passiert nichts. -NoRelease oder BSO_NO_RELEASE=1: nur bauen. # Voraussetzungen: Visual Studio mit C++, .NET 10 SDK. param([switch]$NoRelease) $ErrorActionPreference = "Stop" $root = $PSScriptRoot $dist = Join-Path $root "dist" $obj = Join-Path $root "obj\loader" New-Item -ItemType Directory -Force "$dist\BSO", $obj | Out-Null # --- Loader ------------------------------------------------------------------------------------------------------- $vs = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -property installationPath if (-not $vs) { throw "Visual Studio mit C++ nicht gefunden" } $vcvars = Join-Path $vs "VC\Auxiliary\Build\vcvars64.bat" $env:PATH = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer;$env:PATH" # vcvars64 ruft vswhere auf $hostPack = Get-ChildItem "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Host.win-x64" -Directory | Sort-Object { [version]$_.Name } | Select-Object -Last 1 $nethost = Join-Path $hostPack.FullName "runtimes\win-x64\native" $src = Join-Path $root "Loader" $cmd = "`"$vcvars`" >nul && cl /nologo /LD /O2 /MT /EHsc /W3 /DUNICODE /D_UNICODE /I`"$nethost`" " + "/Fo`"$obj\\`" `"$src\dinput8.cpp`" /Fe`"$dist\dinput8.dll`" " + "/link /DEF:`"$src\dinput8.def`" /IMPLIB:`"$obj\dinput8.lib`" `"$nethost\libnethost.lib`" advapi32.lib" cmd /c $cmd if ($LASTEXITCODE -ne 0) { throw "Loader-Build fehlgeschlagen" } # --- Mod ---------------------------------------------------------------------------------------------------------- dotnet build (Join-Path $root "BSO.csproj") -c Release -o "$dist\BSO" --nologo -v q if ($LASTEXITCODE -ne 0) { throw "Mod-Build fehlgeschlagen" } # --- Release-Paket: wird vom Launcher nach Bin_High_Win64 entpackt (BSO.json gehoert dem Spieler, ist nicht dabei) -- Add-Type -AssemblyName System.IO.Compression, System.IO.Compression.FileSystem $zip = Join-Path $dist "BSO-Mod.zip" Remove-Item $zip -ErrorAction SilentlyContinue $archive = [IO.Compression.ZipFile]::Open($zip, "Create") try { $files = [ordered]@{ "dinput8.dll" = "$dist\dinput8.dll" "BSO/BSO.dll" = "$dist\BSO\BSO.dll" "BSO/BSO.runtimeconfig.json" = "$dist\BSO\BSO.runtimeconfig.json" "BSO/BSO.deps.json" = "$dist\BSO\BSO.deps.json" } foreach ($name in $files.Keys) { [void][IO.Compression.ZipFileExtensions]::CreateEntryFromFile($archive, $files[$name], $name) } } finally { $archive.Dispose() } Write-Host "Fertig: $dist" if (-not $NoRelease) { $version = ([xml](Get-Content (Join-Path $root "BSO.csproj"))).Project.PropertyGroup.Version | Where-Object { $_ } | Select-Object -First 1 & (Join-Path $root "release.ps1") -Product mod -Version $version -File $zip }