Consolidates two standalone Railroader mods into one UMM "everything mod" with an optional-module framework. Modules are disabled by default and toggled per-module from the S3 settings page. Core framework: - IModule contract plus ModuleRegistry, with each module owning a Harmony instance scoped by its id so only enabled modules patch the game - Per-module flat JSON settings (SettingsStore). On this Mono runtime JsonUtility silently drops nested custom-class fields, so settings stay flat - Foldout-per-module settings panel plus a detector that offers to disable the old standalone mods if they are still installed Modules (moved over to parity, verified in-game): - Physics Optimizer (was RailroaderPhysicsOverhaul): LOD fast-path and auto-freeze, profiler overlay, debug car tinting, /rpf console commands - Map Popout (was RRPopout): native map detach window. Pure-UMM install that drops the winhttp proxy and LoadLibrary's RRPopout.dll from the mod folder. Native Win32 + D3D11 + Dear ImGui engine included. Fixes a latent break where the now-private MapBuilder.UpdateForZoom() is reached via Traverse. Build: dotnet for the managed assembly (netstandard2.1) and CMake for the native DLL. build-local.ps1 installs into the game, build-release.ps1 packages the UMM drag-install zip.
67 lines
2.8 KiB
PowerShell
67 lines
2.8 KiB
PowerShell
# Shared build helpers for S³ (dot-sourced by build-local.ps1 and build-release.ps1).
|
|
# Not run directly.
|
|
|
|
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$script:RepoRoot = Split-Path $PSScriptRoot -Parent
|
|
$script:ModId = "S3"
|
|
|
|
function Get-ModVersion {
|
|
# Single source of truth: the Version field in Info.json.
|
|
$info = Get-Content (Join-Path $RepoRoot "Info.json") -Raw | ConvertFrom-Json
|
|
return $info.Version
|
|
}
|
|
|
|
function Invoke-ManagedBuild {
|
|
param([string]$Configuration = "Release", [string]$GameDir = "")
|
|
|
|
Write-Host "=== Building managed (S3.dll, $Configuration) ===" -ForegroundColor Cyan
|
|
$csproj = Join-Path $RepoRoot "src\S3.csproj"
|
|
$args = @($csproj, "-c", $Configuration, "--nologo", "-v", "minimal")
|
|
if ($GameDir) { $args += "/p:GameDir=$GameDir" }
|
|
dotnet build @args | Out-Host
|
|
if ($LASTEXITCODE -ne 0) { throw "Managed build failed." }
|
|
|
|
$dll = Join-Path $RepoRoot "src\bin\$Configuration\S3.dll"
|
|
if (-not (Test-Path $dll)) { throw "S3.dll not found at $dll" }
|
|
return $dll
|
|
}
|
|
|
|
function Invoke-NativeBuild {
|
|
param([string]$Configuration = "Release")
|
|
|
|
$cmakeLists = Join-Path $RepoRoot "native\CMakeLists.txt"
|
|
if (-not (Test-Path $cmakeLists)) {
|
|
Write-Host "=== No native/CMakeLists.txt — skipping native build ===" -ForegroundColor DarkYellow
|
|
return $null
|
|
}
|
|
|
|
Write-Host "=== Building native (RRPopout.dll, $Configuration) ===" -ForegroundColor Cyan
|
|
$buildDir = Join-Path $RepoRoot "native\build"
|
|
if (-not (Test-Path $buildDir)) { cmake -B $buildDir -A x64 (Join-Path $RepoRoot "native") | Out-Host }
|
|
cmake --build $buildDir --config $Configuration | Out-Host
|
|
if ($LASTEXITCODE -ne 0) { throw "Native build failed." }
|
|
|
|
# MSVC multi-config generators place the DLL in a per-config subfolder.
|
|
$dll = Join-Path $buildDir "bin\$Configuration\RRPopout.dll"
|
|
if (-not (Test-Path $dll)) { $dll = Join-Path $buildDir "bin\RRPopout.dll" } # single-config fallback
|
|
if (-not (Test-Path $dll)) { throw "RRPopout.dll not found under $buildDir\bin" }
|
|
return $dll
|
|
}
|
|
|
|
# Assembles the Mods\S3 layout into $DestModDir (the S3 folder itself).
|
|
function New-ModLayout {
|
|
param([Parameter(Mandatory)][string]$DestModDir,
|
|
[Parameter(Mandatory)][string]$ManagedDll,
|
|
[string]$NativeDll = $null)
|
|
|
|
if (Test-Path $DestModDir) { Remove-Item $DestModDir -Recurse -Force }
|
|
New-Item -ItemType Directory -Force -Path $DestModDir | Out-Null
|
|
|
|
Copy-Item $ManagedDll (Join-Path $DestModDir "S3.dll") -Force
|
|
Copy-Item (Join-Path $RepoRoot "Info.json") (Join-Path $DestModDir "Info.json") -Force
|
|
if ($NativeDll) {
|
|
Copy-Item $NativeDll (Join-Path $DestModDir "RRPopout.dll") -Force
|
|
}
|
|
}
|