#!/usr/bin/env pwsh # Build script for HomuraHimeAudioMod # Requires: .NET SDK 4.8 or .NET Framework 4.8 param( [string]$Configuration = "Release", [string]$OutputDir = $null ) $ErrorActionPreference = "Stop" $ProjectDir = $PSScriptRoot $ProjectFile = Join-Path $ProjectDir "HomuraHimeAudioMod.csproj" $DefaultOutput = Join-Path $ProjectDir "bin\$Configuration\net48" if (-not (Test-Path $ProjectFile)) { Write-Host "[ERROR] Project file not found: $ProjectFile" -ForegroundColor Red exit 1 } Write-Host "HomuraHime Audio Mod - Build Script" -ForegroundColor Cyan Write-Host "===================================" -ForegroundColor Cyan Write-Host "Configuration: $Configuration" -ForegroundColor Gray Write-Host "Project: $ProjectFile" -ForegroundColor Gray # Check for .NET SDK $dotnet = Get-Command dotnet -ErrorAction SilentlyContinue if (-not $dotnet) { Write-Host "[ERROR] .NET SDK not found. Please install .NET Framework 4.8 SDK or .NET SDK." -ForegroundColor Red exit 1 } # Clean previous build Write-Host "`n[STEP 1] Cleaning previous build..." -ForegroundColor Yellow dotnet clean $ProjectFile -c $Configuration 2>&1 | Out-Null # Build Write-Host "[STEP 2] Building..." -ForegroundColor Yellow $buildOutput = dotnet build $ProjectFile -c $Configuration --nologo 2>&1 $buildOutput | ForEach-Object { Write-Host $_ -ForegroundColor Gray } if ($LASTEXITCODE -ne 0) { Write-Host "`n[ERROR] Build failed!" -ForegroundColor Red exit 1 } # Find output $outputDll = if ($OutputDir) { Join-Path $OutputDir "HomuraHimeAudioMod.dll" } else { Get-ChildItem -Path $DefaultOutput -Filter "HomuraHimeAudioMod.dll" -ErrorAction SilentlyContinue | Select-Object -First 1 | ForEach-Object { $_.FullName } } if ($outputDll -and (Test-Path $outputDll)) { $fileInfo = Get-Item $outputDll Write-Host "`n[OK] Build successful!" -ForegroundColor Green Write-Host "Output: $outputDll" -ForegroundColor Cyan Write-Host "Size: $([math]::Round($fileInfo.Length / 1024, 2)) KB" -ForegroundColor Gray Write-Host "Built: $($fileInfo.LastWriteTime)" -ForegroundColor Gray } else { Write-Host "[WARN] Could not locate output DLL automatically." -ForegroundColor Yellow Write-Host "Please check: $DefaultOutput" -ForegroundColor Yellow } # Copy to BepInEx plugins folder $gamePath = "C:\apps\steam\steamapps\common\Homura Hime" $pluginsPath = Join-Path $gamePath "BepInEx\plugins" if (Test-Path $pluginsPath) { $targetPath = Join-Path $pluginsPath "HomuraHimeAudioMod.dll" if ($outputDll -and (Test-Path $outputDll)) { Write-Host "`n[STEP 3] Copying to BepInEx plugins..." -ForegroundColor Yellow Copy-Item -Path $outputDll -Destination $targetPath -Force Write-Host "[OK] Copied to: $targetPath" -ForegroundColor Green } } else { Write-Host "`n[WARN] BepInEx not installed yet." -ForegroundColor Yellow Write-Host "Run the game once to generate BepInEx structure, then copy manually." -ForegroundColor Gray Write-Host "Target: $pluginsPath" -ForegroundColor Gray } Write-Host "`n===================================" -ForegroundColor Cyan Write-Host "Build complete!" -ForegroundColor Green Write-Host "" Write-Host "Next steps:" -ForegroundColor Yellow Write-Host " 1. Launch HomuraHime via Steam" -ForegroundColor Cyan Write-Host " 2. Check BepInEx\LogOutput.log for mod initialization" -ForegroundColor Cyan Write-Host " 3. Adjust settings in BepInEx\config\com.homurahime.audiomod.cfg" -ForegroundColor Cyan