Phase 4: BepInEx plugin complete

- Added ModConfig.cs with full configuration system
- Updated Plugin.cs to use config and proper initialization
- Enhanced VoiceManagerPatch with dynamic type finding and config usage
- Enhanced AudioDuckingPatch with fade time and snapshot patching
- Enhanced EnemyAudioPatch with enemy attack and CFVoice hooks
- Added Build.ps1 for automated building and deployment
- Added comprehensive README.md with installation and configuration
This commit is contained in:
2026-03-22 13:45:32 -04:00
parent 8f162dc103
commit a6fa90375e
8 changed files with 713 additions and 101 deletions

View File

@@ -0,0 +1,89 @@
#!/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 = Split-Path -Parent $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