feat: port aelrynth 2026.9.27.2 snapshot onto GitHub history

Overlay upstream/main (9b5e276) onto BlankenshipG main without rewriting
history. Keep origin-only Decal/plugin/docs trees. Re-apply aelrynth.com
and sibling-fork URL fixes that aelrynth git still has as tombohar links.

Co-authored-by: BlankenshipG <BlankenshipG@users.noreply.github.com>
This commit is contained in:
Cursor Agent 2026-10-04 15:43:50 +00:00
commit 4ddbb52eb2
No known key found for this signature in database
244 changed files with 59710 additions and 3067 deletions

View file

@ -6,9 +6,12 @@
.DESCRIPTION
1. Publishes the Avalonia launcher (self-contained, x86)
2. Publishes RynthCore.Engine (NativeAOT, x86 -- ~2 min)
3. Publishes RynthCore.Plugin.RynthAi (NativeAOT, x86)
4. Stages all output under installer\staging\app\
5. Invokes ISCC.exe to produce installer\Output\RynthCore-Setup.exe
3. Publishes RynthCore.Loader (NativeAOT, x86) -- the DLL the launcher injects
4. Publishes RynthCore.Plugin.RynthAi (NativeAOT, x86)
5. Publishes the Loot Editor
6. Stages all output under installer\staging\app\, plus the hand-built
RynthCore.SehTrampoline.dll, and checks every required runtime file is there
7. Invokes ISCC.exe to produce installer\Output\RynthCore-Setup.exe
.PARAMETER Configuration
Build configuration. Default: Release
@ -22,7 +25,7 @@
#>
param(
[string]$Configuration = "Release",
[string]$IsccPath = "C:\Program Files (x86)\Inno Setup 6\ISCC.exe",
[string]$IsccPath = "",
# Explicit path to the RynthSuite repo root. When omitted, defaults to the
# sibling directory of RynthCore (i.e. ..\RynthSuite relative to this repo).
[string]$RynthSuiteRoot = "",
@ -35,6 +38,24 @@ param(
$ErrorActionPreference = "Stop"
Set-StrictMode -Off
# Release number for release.txt, which the launcher's updater reads
# (RynthUpdater.InstalledCoreRelease). -Version yyyy.m.d.n → yyyymmddnn; a dev build
# without -Version records 0 ("unknown", so any published release reads as newer).
# Checked here, before the builds, so a typo fails in a second rather than at the end.
$release = 0
if ($Version) {
$p = $Version.Split('.')
if ($p.Count -ne 4 -or ($p | Where-Object { $_ -notmatch '^\d+$' }) -or [int]$p[1] -gt 12 -or [int]$p[2] -gt 31 -or [int]$p[3] -gt 99) {
throw "-Version must be yyyy.m.d.n (e.g. 2026.9.26.3), got '$Version'"
}
$release = [int]$p[0] * 1000000 + [int]$p[1] * 10000 + [int]$p[2] * 100 + [int]$p[3]
}
# Stamp every build with the release, so the launcher, the engine log and the in-game
# Status panel show it (RynthCore.App.BuildVersion); the SDK appends the git commit.
$VersionArgs = @()
if ($Version) { $VersionArgs = @("-p:Version=$Version") }
$ScriptDir = $PSScriptRoot
$RepoRoot = Split-Path $ScriptDir -Parent # e.g. C:\Projects\RynthCore
$ProjectsRoot = Split-Path $RepoRoot -Parent # e.g. C:\Projects
@ -44,18 +65,22 @@ if (-not $RynthSuiteRoot) {
$RynthSuiteRoot = "$ProjectsRoot\RynthSuite"
}
$LauncherProject = "$RepoRoot\src\RynthCore.App.Avalonia\RynthCore.App.Avalonia.csproj"
$EngineProject = "$RepoRoot\src\RynthCore.Engine\RynthCore.Engine.csproj"
$PluginProject = "$RynthSuiteRoot\Plugins\RynthCore.Plugin.RynthAi\RynthCore.Plugin.RynthAi.csproj"
$LauncherProject = "$RepoRoot\src\RynthCore.App.Avalonia\RynthCore.App.Avalonia.csproj"
$EngineProject = "$RepoRoot\src\RynthCore.Engine\RynthCore.Engine.csproj"
$LoaderProject = "$RepoRoot\src\RynthCore.Loader\RynthCore.Loader.csproj"
$PluginProject = "$RynthSuiteRoot\Plugins\RynthCore.Plugin.RynthAi\RynthCore.Plugin.RynthAi.csproj"
$LootEditorProject = "$RynthSuiteRoot\Tools\RynthCore.LootEditor\RynthCore.LootEditor.csproj"
$LauncherPublish = "$RepoRoot\src\RynthCore.App.Avalonia\bin\$Configuration\net10.0-windows7.0\win-x86\publish"
$EnginePublish = "$RepoRoot\src\RynthCore.Engine\bin\$Configuration\net10.0-windows\win-x86\publish"
$PluginPublish = "$RynthSuiteRoot\Plugins\RynthCore.Plugin.RynthAi\bin\$Configuration\net10.0-windows\win-x86\publish"
$LauncherPublish = "$RepoRoot\src\RynthCore.App.Avalonia\bin\$Configuration\net10.0-windows7.0\win-x86\publish"
$EnginePublish = "$RepoRoot\src\RynthCore.Engine\bin\$Configuration\net10.0-windows\win-x86\publish"
$LoaderPublish = "$RepoRoot\src\RynthCore.Loader\bin\$Configuration\net10.0-windows\win-x86\publish"
$PluginPublish = "$RynthSuiteRoot\Plugins\RynthCore.Plugin.RynthAi\bin\$Configuration\net10.0-windows\win-x86\publish"
$LootEditorPublish = "$RynthSuiteRoot\Tools\RynthCore.LootEditor\bin\$Configuration\net10.0\win-x86\publish"
$StagingDir = "$ScriptDir\staging\app"
# ── Validate projects ───────────────────────────────────────────────────────
foreach ($p in @($LauncherProject, $EngineProject, $PluginProject)) {
foreach ($p in @($LauncherProject, $EngineProject, $LoaderProject, $PluginProject, $LootEditorProject)) {
if (-not (Test-Path $p)) {
throw "Project not found: $p`nUpdate paths in Build-Installer.ps1 if your repo layout differs."
}
@ -64,21 +89,33 @@ foreach ($p in @($LauncherProject, $EngineProject, $PluginProject)) {
if (-not $SkipBuild) {
# ── 1. Launcher (self-contained Avalonia WinExe) ─────────────────────────
Write-Host ""
Write-Host "[1/3] Publishing Launcher (self-contained, x86)..." -ForegroundColor Cyan
dotnet publish $LauncherProject -c $Configuration -r win-x86 --self-contained true
Write-Host "[1/5] Publishing Launcher (self-contained, x86)..." -ForegroundColor Cyan
dotnet publish $LauncherProject -c $Configuration -r win-x86 --self-contained true @VersionArgs
if ($LASTEXITCODE -ne 0) { throw "Launcher publish failed (exit $LASTEXITCODE)" }
# ── 2. Engine (NativeAOT — the slow one) ──────────────────────────────────
Write-Host ""
Write-Host "[2/3] Publishing Engine (NativeAOT, ~2 min)..." -ForegroundColor Cyan
dotnet publish $EngineProject -c $Configuration
Write-Host "[2/5] Publishing Engine (NativeAOT, ~2 min)..." -ForegroundColor Cyan
dotnet publish $EngineProject -c $Configuration @VersionArgs
if ($LASTEXITCODE -ne 0) { throw "Engine publish failed (exit $LASTEXITCODE)" }
# ── 3. Plugin (NativeAOT) ─────────────────────────────────────────────────
# ── 3. Loader (NativeAOT, small) ──────────────────────────────────────────
Write-Host ""
Write-Host "[3/3] Publishing Plugin (NativeAOT)..." -ForegroundColor Cyan
dotnet publish $PluginProject -c $Configuration
Write-Host "[3/5] Publishing Loader (NativeAOT)..." -ForegroundColor Cyan
dotnet publish $LoaderProject -c $Configuration @VersionArgs
if ($LASTEXITCODE -ne 0) { throw "Loader publish failed (exit $LASTEXITCODE)" }
# ── 4. Plugin (NativeAOT) ─────────────────────────────────────────────────
Write-Host ""
Write-Host "[4/5] Publishing Plugin (NativeAOT)..." -ForegroundColor Cyan
dotnet publish $PluginProject -c $Configuration @VersionArgs
if ($LASTEXITCODE -ne 0) { throw "Plugin publish failed (exit $LASTEXITCODE)" }
# ── 5. Loot Editor (self-contained Avalonia tool) ─────────────────────────
Write-Host ""
Write-Host "[5/5] Publishing Loot Editor (self-contained, x86)..." -ForegroundColor Cyan
dotnet publish $LootEditorProject -c $Configuration -r win-x86 --self-contained true @VersionArgs
if ($LASTEXITCODE -ne 0) { throw "Loot Editor publish failed (exit $LASTEXITCODE)" }
}
# ── Stage ────────────────────────────────────────────────────────────────────
@ -89,7 +126,15 @@ if (Test-Path "$ScriptDir\staging") {
Remove-Item "$ScriptDir\staging" -Recurse -Force
}
New-Item -ItemType Directory -Path "$StagingDir\Runtime\Native" -Force | Out-Null
New-Item -ItemType Directory -Path "$StagingDir\Runtime\Plugins" -Force | Out-Null
New-Item -ItemType Directory -Path "$StagingDir\Tools\LootEditor" -Force | Out-Null
# Plugin DLLs are staged into a separate top-level folder (not under
# Runtime\) because the engine no longer auto-scans Runtime\Plugins\.
# The .iss file installs this folder to C:\Games\RynthSuite\<PluginName>\
# (an absolute destination outside {app}) so the plugin lives next to its
# data dirs and the user adds the path via the launcher's Plugins tab.
$pluginStagingDir = "$ScriptDir\staging\plugins"
if (Test-Path $pluginStagingDir) { Remove-Item $pluginStagingDir -Recurse -Force }
New-Item -ItemType Directory -Path "$pluginStagingDir\RynthAi" -Force | Out-Null
# Launcher root files (rename .exe → RynthCore.exe; drop .pdb)
foreach ($file in (Get-ChildItem "$LauncherPublish" -File)) {
@ -104,6 +149,26 @@ foreach ($file in (Get-ChildItem "$EnginePublish" -File)) {
Copy-Item $file.FullName "$StagingDir\Runtime\$($file.Name)" -Force
}
# Loader — the DLL the launcher injects (EngineInjectionService.EngineDllName); it
# maps RynthCore.Engine.dll and provides hot-reload. Without it a fresh install's
# launcher can't auto-find an engine to inject.
$loaderDll = "$LoaderPublish\RynthCore.Loader.dll"
if (-not (Test-Path $loaderDll)) { throw "Loader DLL not found at: $loaderDll" }
Copy-Item $loaderDll "$StagingDir\Runtime\" -Force
# SEH trampoline — hand-built native DLL (native\SehTrampoline\Build-SehTrampoline.ps1),
# NOT part of the engine publish output. Without it SehTrampoline.IsAvailable stays
# false and CombatActionHooks.CastSpell fails closed on every targeted cast, which
# includes self-buffs (the plugin passes the player id): the bot says "Casting: X"
# and nothing happens. Same missing/stale checks as scripts\Deploy-RynthCore.ps1.
$sehDll = "$RepoRoot\native\SehTrampoline\bin\RynthCore.SehTrampoline.dll"
$sehSrc = "$RepoRoot\native\SehTrampoline\SehTrampoline.c"
if (-not (Test-Path $sehDll)) { throw "SEH trampoline not found at: $sehDll`nBuild it with native\SehTrampoline\Build-SehTrampoline.ps1" }
if ((Test-Path $sehSrc) -and (Get-Item $sehSrc).LastWriteTime -gt (Get-Item $sehDll).LastWriteTime) {
throw "RynthCore.SehTrampoline.dll is STALE (SehTrampoline.c is newer). Rebuild with native\SehTrampoline\Build-SehTrampoline.ps1"
}
Copy-Item $sehDll "$StagingDir\Runtime\" -Force
# Engine Native subfolder
if (Test-Path "$EnginePublish\Native") {
foreach ($file in (Get-ChildItem "$EnginePublish\Native" -File)) {
@ -112,10 +177,41 @@ if (Test-Path "$EnginePublish\Native") {
}
}
# Plugin DLL only (cimgui.dll excluded — already in Runtime from Engine)
# Plugin DLL only — staged separately so the .iss file can install it to an
# absolute path outside {app}. The engine no longer auto-scans Runtime\Plugins\;
# the user explicitly adds the plugin path via the launcher's Plugins tab.
$pluginDll = "$PluginPublish\RynthCore.Plugin.RynthAi.dll"
if (-not (Test-Path $pluginDll)) { throw "Plugin DLL not found at: $pluginDll" }
Copy-Item $pluginDll "$StagingDir\Runtime\Plugins\" -Force
Copy-Item $pluginDll "$pluginStagingDir\RynthAi\" -Force
# Loot Editor (self-contained — copy everything from publish, drop pdbs)
if (-not (Test-Path $LootEditorPublish)) { throw "Loot Editor publish not found at: $LootEditorPublish" }
foreach ($file in (Get-ChildItem "$LootEditorPublish" -File)) {
if ($file.Extension -eq '.pdb') { continue }
Copy-Item $file.FullName "$StagingDir\Tools\LootEditor\$($file.Name)" -Force
}
foreach ($dir in (Get-ChildItem "$LootEditorPublish" -Directory)) {
Copy-Item $dir.FullName "$StagingDir\Tools\LootEditor\" -Recurse -Force
# Drop pdbs from copied subdirs
Get-ChildItem "$StagingDir\Tools\LootEditor\$($dir.Name)" -Recurse -File -Filter '*.pdb' | Remove-Item -Force
}
# release.txt — which core release this install is ($release, from -Version at the top).
Set-Content -Path "$StagingDir\release.txt" -Value @($release, $Version) -Encoding ASCII
# Everything a working install needs. The 2026-09-25 public installer went out
# without the Loader and the SEH trampoline because nothing checked.
$required = @(
"$StagingDir\RynthCore.exe",
"$StagingDir\Runtime\RynthCore.Loader.dll",
"$StagingDir\Runtime\RynthCore.Engine.dll",
"$StagingDir\Runtime\RynthCore.SehTrampoline.dll",
"$StagingDir\Runtime\minhook.x86.dll",
"$StagingDir\Runtime\cimgui.dll",
"$pluginStagingDir\RynthAi\RynthCore.Plugin.RynthAi.dll"
)
$missing = @($required | Where-Object { -not (Test-Path $_) })
if ($missing.Count -gt 0) { throw "Staging is missing required files:`n $($missing -join "`n ")" }
# Report staged sizes
$engineDll = "$StagingDir\Runtime\RynthCore.Engine.dll"
@ -129,13 +225,18 @@ Write-Host " Total staged: ${totalMb} MB"
Write-Host "Staging complete: $StagingDir" -ForegroundColor Green
# ── Inno Setup ───────────────────────────────────────────────────────────────
if (-not (Test-Path $IsccPath)) {
# Auto-detect ISCC if not specified: try standard install location then user-local.
if (-not $IsccPath) {
$candidates = @(
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe",
"$env:LOCALAPPDATA\Programs\Inno Setup 6\ISCC.exe"
)
foreach ($c in $candidates) { if (Test-Path $c) { $IsccPath = $c; break } }
}
if (-not $IsccPath -or -not (Test-Path $IsccPath)) {
Write-Host ""
Write-Warning "Inno Setup compiler not found at:"
Write-Warning " $IsccPath"
Write-Warning "Install Inno Setup 6 from: https://jrsoftware.org/isdl.php"
Write-Warning "Then re-run this script, or invoke ISCC manually:"
Write-Warning " `"$IsccPath`" `"$ScriptDir\RynthCore.iss`""
Write-Warning "Inno Setup compiler not found. Install Inno Setup 6 from: https://jrsoftware.org/isdl.php"
Write-Warning "Or pass -IsccPath to this script explicitly."
exit 0
}

View file

@ -0,0 +1,103 @@
#Requires -Version 7
<#
.SYNOPSIS
Creates the RynthCore update-signing keys. Run it once, yourself.
.DESCRIPTION
Launchers install an update only if its feed is signed by a key they trust. This makes
two ECDSA P-256 keys:
primary Signs every release. Saved to <KeyDir>\primary.key, encrypted with Windows
DPAPI for your user account: Publish-Update.ps1 signs without a prompt, and the
file is useless on any other account or PC.
backup Replaces the primary if it is ever lost (new PC, reinstall). Saved to
<KeyDir>\backup.key.p8, encrypted with a password you choose here. Move it
OFFLINE (a USB stick in a drawer) and delete the copy on this PC.
Both public halves are written into src\RynthCore.App.Avalonia\UpdateTrust.cs, so
launchers built afterwards trust either key. Commit that file, then build and release.
The private keys never leave this PC. Never copy them to the server: the point of signing
is that a compromised server still can't push code to players.
.PARAMETER Force
Replace existing keys. Launchers that only trust the old keys will refuse every release
signed with the new ones, so this strands them until they reinstall by hand.
#>
param(
[string]$KeyDir = (Join-Path $env:USERPROFILE ".rynthcore-update-signing"),
[string]$TrustFile = (Join-Path $PSScriptRoot "..\src\RynthCore.App.Avalonia\UpdateTrust.cs"),
# For scripted tests only; normally you are prompted.
[SecureString]$BackupPassword,
[switch]$Force
)
$ErrorActionPreference = "Stop"
Add-Type -AssemblyName System.Security
$crypto = [System.Security.Cryptography.ProtectedData].Assembly # DPAPI present (fails loudly if not)
$primaryPath = Join-Path $KeyDir "primary.key"
$backupPath = Join-Path $KeyDir "backup.key.p8"
if ((Test-Path $primaryPath) -and -not $Force) {
throw "Keys already exist in $KeyDir. Replacing them strands launchers that trust only the old ones; pass -Force only if you mean it."
}
if (-not (Test-Path $TrustFile)) { throw "UpdateTrust.cs not found at $TrustFile" }
if (-not $BackupPassword) {
$BackupPassword = Read-Host "Password for the BACKUP key (needed only if the primary is ever lost)" -AsSecureString
$again = Read-Host "Repeat it" -AsSecureString
if ((ConvertFrom-SecureString $BackupPassword -AsPlainText) -ne (ConvertFrom-SecureString $again -AsPlainText)) {
throw "The passwords don't match."
}
}
$plain = ConvertFrom-SecureString $BackupPassword -AsPlainText
if ($plain.Length -lt 12) { throw "Use at least 12 characters for the backup key password." }
New-Item -ItemType Directory -Force $KeyDir | Out-Null
$curve = [System.Security.Cryptography.ECCurve+NamedCurves]::nistP256
$primary = [System.Security.Cryptography.ECDsa]::Create($curve)
$backup = [System.Security.Cryptography.ECDsa]::Create($curve)
# Primary: DPAPI (CurrentUser), with fixed entropy so a stray DPAPI blob can't pose as it.
$entropy = [Text.Encoding]::UTF8.GetBytes("RynthCore update signing v1")
$pkcs8 = $primary.ExportPkcs8PrivateKey()
try {
$blob = [System.Security.Cryptography.ProtectedData]::Protect($pkcs8, $entropy, 'CurrentUser')
[IO.File]::WriteAllBytes($primaryPath, $blob)
} finally { [Array]::Clear($pkcs8) }
# Backup: password-encrypted PKCS#8 (AES-256, 600k PBKDF2 rounds).
$pbe = [System.Security.Cryptography.PbeParameters]::new(
[System.Security.Cryptography.PbeEncryptionAlgorithm]::Aes256Cbc,
[System.Security.Cryptography.HashAlgorithmName]::SHA256, 600000)
[IO.File]::WriteAllBytes($backupPath, $backup.ExportEncryptedPkcs8PrivateKey($plain, $pbe))
$plain = $null
function KeyId([byte[]]$spki) {
$h = [System.Security.Cryptography.SHA256]::HashData($spki)
return ([Convert]::ToHexString($h, 0, 8)).ToLowerInvariant()
}
$keys = foreach ($k in @(@{ Name = "primary"; Key = $primary }, @{ Name = "backup"; Key = $backup })) {
$spki = $k.Key.ExportSubjectPublicKeyInfo()
[pscustomobject]@{ Name = $k.Name; Id = KeyId $spki; Base64 = [Convert]::ToBase64String($spki) }
}
# Write the public keys between the markers in UpdateTrust.cs.
$src = Get-Content $TrustFile -Raw
$begin = "// BEGIN KEYS (New-UpdateSigningKey.ps1)"
$end = "// END KEYS"
$i = $src.IndexOf($begin); $j = $src.IndexOf($end)
if ($i -lt 0 -or $j -lt $i) { throw "Key markers not found in $TrustFile" }
$indent = " "
$lines = $keys | ForEach-Object { "$indent`"$($_.Base64)`", // $($_.Name) $($_.Id)" }
$new = $src.Substring(0, $i + $begin.Length) + "`r`n" + ($lines -join "`r`n") + "`r`n$indent" + $src.Substring($j)
Set-Content -Path $TrustFile -Value $new -NoNewline -Encoding utf8
Write-Host ""
Write-Host "Keys created in $KeyDir" -ForegroundColor Green
$keys | ForEach-Object { Write-Host (" {0,-8} {1}" -f $_.Name, $_.Id) }
Write-Host ""
Write-Host "Public keys written to $TrustFile" -ForegroundColor Green
Write-Host "Next:"
Write-Host " 1. Move $backupPath OFFLINE (USB stick), then delete it here. Keep its password somewhere safe."
Write-Host " 2. Commit UpdateTrust.cs, then publish with installer\Publish-Update.ps1 -Version <yyyy.m.d.n>."

View file

@ -0,0 +1,256 @@
#Requires -Version 7
<#
.SYNOPSIS
Builds, signs and publishes a RynthCore + RynthSuite release to the launchers' update feed.
.DESCRIPTION
One command per release:
1. Refuses if the signing key isn't set up or isn't trusted by the launcher being shipped,
if either repo has uncommitted changes, or if -Version isn't newer than the live feed.
2. Builds the installer (Build-Installer.ps1 -Version) and the RynthSuite plugins into
installer\Releases\<release>\ — never into the live C:\Games folders.
3. Writes the manifest (sizes + SHA-256 of every file), signs it with the DPAPI key
(Sign-Update.ps1, no prompt) and checks the signature the way the launcher will.
4. Uploads the release files, checks their hashes on the server, replaces the website's
RynthCore-Setup.exe and RynthSuite-Plugins.zip (old ones kept in ~/backups/rynth),
and swaps in update.json last, atomically.
5. Fetches the live feed back and compares it byte for byte.
Launchers pick it up at their next check (start-up, every 6 hours, or the button). Plugins
swap in place without touching running bots; the core installer waits until every
RynthCore client is closed.
.EXAMPLE
.\Publish-Update.ps1 -Version 2026.9.28.1 -Changes "Arrow crafting covers every head type.", "The Tell button works on players too."
#>
param(
[Parameter(Mandatory)][string]$Version,
# Release notes for players, one line per change: they become this release's entry in
# downloads/rynth/releases.json, which the "What's new" list on aelrynth.com/rynth.html shows.
[string[]]$Changes = @(),
# Short text the launcher shows next to an available update; defaults to the changes.
[string]$Notes = "",
[switch]$DryRun, # build + sign + verify, upload nothing
[switch]$AllowDirty, # publish with uncommitted changes (don't)
[string]$SshHost = "aelrynth-vps",
[string]$RemoteDir = "/var/www/site/downloads/rynth",
[string]$BaseUrl = "https://aelrynth.com/downloads/rynth",
[string]$KeyDir = (Join-Path $env:USERPROFILE ".rynthcore-update-signing"),
[string]$RynthSuiteRoot = "",
[string]$TrustFile = "" # defaults to the launcher's UpdateTrust.cs; override for tests
)
$ErrorActionPreference = "Stop"
$ScriptDir = $PSScriptRoot
$RepoRoot = Split-Path $ScriptDir -Parent
if (-not $RynthSuiteRoot) { $RynthSuiteRoot = Join-Path (Split-Path $RepoRoot -Parent) "RynthSuite" }
if (-not $TrustFile) { $TrustFile = Join-Path $RepoRoot "src\RynthCore.App.Avalonia\UpdateTrust.cs" }
function Step($m) { Write-Host ""; Write-Host "== $m" -ForegroundColor Cyan }
function Sha256([string]$path) { (Get-FileHash $path -Algorithm SHA256).Hash.ToLowerInvariant() }
# Same check as RynthUpdater.VerifyEnvelope: any trusted key's signature over the payload bytes.
function Test-Envelope([string]$path, [string[]]$keys) {
$envelope = Get-Content $path -Raw | ConvertFrom-Json
$payload = [Convert]::FromBase64String($envelope.payload)
foreach ($k in $keys) {
$spki = [Convert]::FromBase64String($k)
$id = ([Convert]::ToHexString([System.Security.Cryptography.SHA256]::HashData($spki), 0, 8)).ToLowerInvariant()
$ec = [System.Security.Cryptography.ECDsa]::Create()
$read = 0; $ec.ImportSubjectPublicKeyInfo($spki, [ref]$read)
foreach ($s in $envelope.signatures) {
if ($s.key -ne $id) { continue }
if ($ec.VerifyData($payload, [Convert]::FromBase64String($s.sig),
[System.Security.Cryptography.HashAlgorithmName]::SHA256,
[System.Security.Cryptography.DSASignatureFormat]::IeeeP1363FixedFieldConcatenation)) { return $true }
}
}
return $false
}
# ── 1. Preconditions ─────────────────────────────────────────────────────────
Step "Checking preconditions"
$p = $Version.Split('.')
if ($p.Count -ne 4 -or ($p | Where-Object { $_ -notmatch '^\d+$' })) { throw "-Version must be yyyy.m.d.n, got '$Version'" }
$release = [int]$p[0] * 1000000 + [int]$p[1] * 10000 + [int]$p[2] * 100 + [int]$p[3]
if ($Changes.Count -eq 0 -and $Notes) { $Changes = @($Notes -split ';\s*' | Where-Object { $_ }) }
if ($Changes.Count -eq 0) { throw "Give -Changes: the release notes players see on aelrynth.com/rynth.html (one string per change)." }
if (-not $Notes) { $Notes = $Changes -join " " }
$trusted = [regex]::Matches((Get-Content $TrustFile -Raw), '"([A-Za-z0-9+/=]{80,})"') | ForEach-Object { $_.Groups[1].Value }
if ($trusted.Count -lt 2) {
throw "UpdateTrust.cs has $($trusted.Count) key(s); it needs the primary and the backup. Run New-UpdateSigningKey.ps1 and commit UpdateTrust.cs."
}
$probe = New-TemporaryFile
try {
Set-Content $probe "probe $release" -NoNewline
& (Join-Path $ScriptDir "Sign-Update.ps1") -PayloadPath $probe -OutPath "$probe.sig" -KeyDir $KeyDir | Out-Null
if (-not (Test-Envelope "$probe.sig" $trusted)) {
throw "The signing key in $KeyDir is not one UpdateTrust.cs trusts: launchers would refuse this release."
}
} finally { Remove-Item $probe, "$probe.sig" -ErrorAction SilentlyContinue }
Write-Host " signing key is trusted by the launcher ($($trusted.Count) keys)"
if (-not $AllowDirty) {
foreach ($repo in $RepoRoot, $RynthSuiteRoot) {
$dirty = git -C $repo status --porcelain --untracked-files=no
if ($dirty) { throw "$repo has uncommitted changes — release from committed code (or pass -AllowDirty):`n$dirty" }
}
Write-Host " RynthCore $(git -C $RepoRoot rev-parse --short HEAD), RynthSuite $(git -C $RynthSuiteRoot rev-parse --short HEAD)"
}
try {
$live = Invoke-RestMethod "$BaseUrl/update.json" -TimeoutSec 20
$liveRelease = ([Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($live.payload)) | ConvertFrom-Json).release
if ($release -le $liveRelease) { throw "Release $release is not newer than the live feed's $liveRelease — bump -Version." }
Write-Host " live feed is at $liveRelease; publishing $release"
} catch [Microsoft.PowerShell.Commands.HttpResponseException] {
Write-Host " no live feed yet — this is the first release"
}
# ── 2. Build ─────────────────────────────────────────────────────────────────
$rel = Join-Path $ScriptDir "Releases\$release"
if (Test-Path $rel) { Remove-Item $rel -Recurse -Force }
New-Item -ItemType Directory -Force "$rel\plugins", "$rel\build" | Out-Null
Step "Building the installer ($Version)"
& (Join-Path $ScriptDir "Build-Installer.ps1") -Version $Version -RynthSuiteRoot $RynthSuiteRoot
if (-not $?) { throw "Build-Installer.ps1 failed" }
Copy-Item (Join-Path $ScriptDir "Output\RynthCore-Setup.exe") "$rel\RynthCore-Setup.exe"
Copy-Item (Join-Path $ScriptDir "staging\plugins\RynthAi\RynthCore.Plugin.RynthAi.dll") "$rel\plugins\"
$suitePlugins = "RynthChat", "RynthTracker", "RynthNav", "RynthVision"
foreach ($name in $suitePlugins) {
Step "Building $name"
$proj = Join-Path $RynthSuiteRoot "Plugins\RynthCore.Plugin.$name\RynthCore.Plugin.$name.csproj"
# PublishDir overrides the projects' own (RynthNav/RynthVision publish into the live C:\Games folders).
dotnet publish $proj -c Release "-p:Version=$Version" "-p:PublishDir=$rel\build\$name\" -v q -nologo
if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed for $name" }
Copy-Item "$rel\build\$name\RynthCore.Plugin.$name.dll" "$rel\plugins\"
}
Step "Packing RynthSuite-Plugins.zip"
$zipRoot = "$rel\build\zip"
foreach ($name in $suitePlugins) {
New-Item -ItemType Directory -Force "$zipRoot\RynthSuite\$name" | Out-Null
Copy-Item "$rel\plugins\RynthCore.Plugin.$name.dll" "$zipRoot\RynthSuite\$name\"
}
$navSrc = "C:\Games\RynthCore\NavData"
New-Item -ItemType Directory -Force "$zipRoot\RynthCore\NavData" | Out-Null
Get-ChildItem $navSrc -File | Where-Object { $_.Extension -eq ".tile" -or $_.Name -eq "portals.tsv" } |
Copy-Item -Destination "$zipRoot\RynthCore\NavData\"
@"
RynthSuite plugins for RynthCore (Asheron's Call, retail client) - $Version
Extract this zip into C:\Games - it creates:
C:\Games\RynthSuite\RynthChat\ RynthChat plugin
C:\Games\RynthSuite\RynthNav\ RynthNav plugin
C:\Games\RynthSuite\RynthTracker\ RynthTracker plugin
C:\Games\RynthSuite\RynthVision\ RynthVision plugin
C:\Games\RynthCore\NavData\ RynthNav's baked navmesh tiles
Then, in the RynthCore launcher's Plugins tab, add the full path of each
plugin DLL you want. Install RynthCore first (RynthCore-Setup.exe), which
also installs RynthAi and the Loot Editor. After that the launcher keeps
the plugins up to date by itself.
MIT licensed. https://aelrynth.com/projects.html
"@ -replace "`n", "`r`n" | Set-Content "$zipRoot\README.txt" -NoNewline
Compress-Archive -Path "$zipRoot\*" -DestinationPath "$rel\RynthSuite-Plugins.zip" -CompressionLevel Optimal
# ── 3. Manifest + signature ──────────────────────────────────────────────────
Step "Writing and signing the manifest"
$setup = Get-Item "$rel\RynthCore-Setup.exe"
$plugins = foreach ($dll in Get-ChildItem "$rel\plugins\*.dll" | Sort-Object Name) {
[ordered]@{
name = $dll.BaseName -replace '^RynthCore\.Plugin\.', ''
file = $dll.Name
url = "$BaseUrl/releases/$release/plugins/$($dll.Name)"
size = $dll.Length
sha256 = Sha256 $dll.FullName
}
}
$manifest = [ordered]@{
schema = 1
release = $release
version = $Version
published = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
notes = $Notes
core = [ordered]@{
release = $release
version = $Version
url = "$BaseUrl/releases/$release/RynthCore-Setup.exe"
size = $setup.Length
sha256 = Sha256 $setup.FullName
}
plugins = @($plugins)
}
Set-Content "$rel\update.payload.json" ($manifest | ConvertTo-Json -Depth 5) -Encoding utf8NoBOM
& (Join-Path $ScriptDir "Sign-Update.ps1") -PayloadPath "$rel\update.payload.json" -OutPath "$rel\update.json" -KeyDir $KeyDir
if (-not (Test-Envelope "$rel\update.json" $trusted)) { throw "Signed feed does not verify against UpdateTrust.cs" }
Write-Host " verified against the launcher's trusted keys"
# Release notes: this release on top of the live list (a re-run replaces its own entry).
$history = @()
try { $history = @((Invoke-RestMethod "$BaseUrl/releases.json" -TimeoutSec 20).releases) }
catch [Microsoft.PowerShell.Commands.HttpResponseException] { Write-Host " no releases.json yet — starting one" }
$entry = [ordered]@{ version = $Version; date = (Get-Date -Format "yyyy-MM-dd"); changes = @($Changes) }
$releaseNotes = [ordered]@{ releases = @($entry) + @($history | Where-Object { $_ -and $_.version -ne $Version }) }
Set-Content "$rel\releases.json" ($releaseNotes | ConvertTo-Json -Depth 5) -Encoding utf8NoBOM
Write-Host " releases.json: $($releaseNotes.releases.Count) release(s), $($Changes.Count) change(s) in this one"
if ($DryRun) {
Write-Host ""; Write-Host "Dry run: release built and signed in $rel; nothing uploaded." -ForegroundColor Yellow
return
}
# ── 4. Upload ────────────────────────────────────────────────────────────────
Step "Uploading release $release"
$remoteRel = "$RemoteDir/releases/$release"
ssh $SshHost "mkdir -p '$remoteRel/plugins'"
if ($LASTEXITCODE -ne 0) { throw "ssh mkdir failed" }
scp -q "$rel\RynthCore-Setup.exe" "${SshHost}:$remoteRel/RynthCore-Setup.exe"
if ($LASTEXITCODE -ne 0) { throw "scp of the installer failed" }
scp -q (Get-ChildItem "$rel\plugins\*.dll").FullName "${SshHost}:$remoteRel/plugins/"
if ($LASTEXITCODE -ne 0) { throw "scp of the plugins failed" }
$remoteSums = ssh $SshHost "cd '$remoteRel' && sha256sum RynthCore-Setup.exe plugins/*.dll"
$expect = @{ "RynthCore-Setup.exe" = $manifest.core.sha256 }
foreach ($pl in $plugins) { $expect["plugins/$($pl.file)"] = $pl.sha256 }
foreach ($line in $remoteSums) {
$sum, $name = $line -split '\s+', 2
if ($expect[$name.TrimStart('*')] -ne $sum) { throw "Hash mismatch on the server for $name — feed NOT published" }
}
Write-Host " $($expect.Count) files uploaded and hash-checked"
Step "Replacing the website downloads"
scp -q "$rel\RynthCore-Setup.exe" "${SshHost}:$RemoteDir/.RynthCore-Setup.exe.new"
if ($LASTEXITCODE -ne 0) { throw "scp of the website installer failed" }
scp -q "$rel\RynthSuite-Plugins.zip" "${SshHost}:$RemoteDir/.RynthSuite-Plugins.zip.new"
if ($LASTEXITCODE -ne 0) { throw "scp of the plugins zip failed" }
ssh $SshHost "set -e; mkdir -p ~/backups/rynth; cd '$RemoteDir'; for f in RynthCore-Setup.exe RynthSuite-Plugins.zip; do [ -f `$f ] && cp -p `$f ~/backups/rynth/`$f.before-$release || true; mv -f .`$f.new `$f; done"
if ($LASTEXITCODE -ne 0) { throw "Replacing the website downloads failed" }
Step "Publishing the feed"
scp -q "$rel\update.json" "${SshHost}:$RemoteDir/.update.json.new"
if ($LASTEXITCODE -ne 0) { throw "scp of update.json failed" }
ssh $SshHost "mv -f '$RemoteDir/.update.json.new' '$RemoteDir/update.json'"
if ($LASTEXITCODE -ne 0) { throw "Publishing update.json failed" }
# The release notes follow the feed, so the page never lists a release launchers can't get yet.
scp -q "$rel\releases.json" "${SshHost}:$RemoteDir/.releases.json.new"
if ($LASTEXITCODE -ne 0) { throw "scp of releases.json failed" }
ssh $SshHost "mv -f '$RemoteDir/.releases.json.new' '$RemoteDir/releases.json'"
if ($LASTEXITCODE -ne 0) { throw "Publishing releases.json failed" }
# ── 5. Verify ────────────────────────────────────────────────────────────────
Step "Verifying the live feed"
$tmp = New-TemporaryFile
try {
Invoke-WebRequest "$BaseUrl/update.json" -OutFile $tmp -UseBasicParsing -Headers @{ "Cache-Control" = "no-cache" }
if ((Sha256 $tmp) -ne (Sha256 "$rel\update.json")) { throw "The live update.json differs from the one just signed!" }
if (-not (Test-Envelope $tmp $trusted)) { throw "The live update.json does not verify!" }
} finally { Remove-Item $tmp -ErrorAction SilentlyContinue }
Write-Host ""
Write-Host "Published RynthCore $Version (release $release)." -ForegroundColor Green
Write-Host "Launchers pick it up at their next check, and aelrynth.com/rynth.html lists it. Still by hand: the public source snapshots."

View file

@ -13,7 +13,6 @@ AppId={{A8B4C2D1-E3F5-4678-9ABC-DEF012345678}
AppName=RynthCore
AppVersion=0.0.0
AppPublisher=RynthCore
; Canonical product/docs page (aelrynth.com); tombohar GitHub upstream is gone.
AppPublisherURL=https://aelrynth.com/rynth.html
DefaultDirName=C:\Games\RynthCore
DisableDirPage=no
@ -41,9 +40,14 @@ Name: desktopicon; Description: "Create a &desktop shortcut"; GroupDescription:
; Program files
[Files]
; Installs the entire staging layout (launcher, Runtime\, Runtime\Plugins\, etc.)
; Launcher + engine runtime + Loot Editor go to {app} (default C:\Games\RynthCore\)
Source: "staging\app\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; Plugin DLL goes to its canonical home next to plugin data dirs.
; Engine does NOT auto-scan this folder — user adds the full DLL path in the
; launcher's Plugins tab to enable the plugin. See BUILD.md "Deploy RynthAi Plugin".
Source: "staging\plugins\RynthAi\RynthCore.Plugin.RynthAi.dll"; DestDir: "C:\Games\RynthSuite\RynthAi"; Flags: ignoreversion
; Data directories (created once; never removed on uninstall)
[Dirs]
Name: "C:\Games\RynthSuite\RynthAi"; Flags: uninsneveruninstall
@ -62,7 +66,29 @@ Name: "C:\Games\RynthSuite\RynthAi\ItemGiver"; Flags: uninsnev
[Icons]
; Start Menu
Name: "{group}\RynthCore"; Filename: "{app}\RynthCore.exe"; WorkingDir: "{app}"; Comment: "Launch RynthCore and inject into Asheron's Call"
Name: "{group}\Loot Editor"; Filename: "{app}\Tools\LootEditor\RynthCore.LootEditor.exe"; WorkingDir: "{app}\Tools\LootEditor"; Comment: "Edit VTank-style loot profiles"
Name: "{group}\Uninstall RynthCore"; Filename: "{uninstallexe}"
; Optional Desktop shortcut (created only when the desktopicon task is checked)
Name: "{autodesktop}\RynthCore"; Filename: "{app}\RynthCore.exe"; WorkingDir: "{app}"; Tasks: desktopicon
[Run]
; Interactive install: offer to start the launcher on the last page.
Filename: "{app}\RynthCore.exe"; WorkingDir: "{app}"; Description: "Launch RynthCore"; Flags: nowait postinstall skipifsilent
; The launcher's updater runs this installer with /SILENT /RELAUNCH after closing itself;
; bring it back when the upgrade is done.
Filename: "{app}\RynthCore.exe"; WorkingDir: "{app}"; Flags: nowait runasoriginaluser; Check: CmdLineParamExists('/RELAUNCH')
[Code]
function CmdLineParamExists(const Value: string): Boolean;
var
I: Integer;
begin
Result := False;
for I := 1 to ParamCount do
if CompareText(ParamStr(I), Value) = 0 then
begin
Result := True;
Exit;
end;
end;

58
installer/Sign-Update.ps1 Normal file
View file

@ -0,0 +1,58 @@
#Requires -Version 7
<#
.SYNOPSIS
Signs an update manifest into the envelope the launcher verifies (RynthUpdater.VerifyEnvelope).
.DESCRIPTION
Output: {"payload": base64(manifest bytes), "signatures": [{"key": <id>, "sig": base64}]},
ECDSA P-256 / SHA-256 over the exact payload bytes, IEEE P1363 format. Signs with the DPAPI
primary key from New-UpdateSigningKey.ps1 — no prompt — or, with -UseBackupKey, the offline
backup key (asks for its password).
#>
param(
[Parameter(Mandatory)][string]$PayloadPath,
[Parameter(Mandatory)][string]$OutPath,
[string]$KeyDir = (Join-Path $env:USERPROFILE ".rynthcore-update-signing"),
[switch]$UseBackupKey,
[string]$BackupKeyPath,
# For scripted tests only; normally you are prompted.
[SecureString]$BackupPassword
)
$ErrorActionPreference = "Stop"
Add-Type -AssemblyName System.Security
$ec = [System.Security.Cryptography.ECDsa]::Create()
if ($UseBackupKey) {
if (-not $BackupKeyPath) { $BackupKeyPath = Join-Path $KeyDir "backup.key.p8" }
if (-not (Test-Path $BackupKeyPath)) { throw "Backup key not found at $BackupKeyPath" }
if (-not $BackupPassword) { $BackupPassword = Read-Host "Backup key password" -AsSecureString }
$pw = ConvertFrom-SecureString $BackupPassword -AsPlainText
$read = 0
$ec.ImportEncryptedPkcs8PrivateKey($pw, [IO.File]::ReadAllBytes($BackupKeyPath), [ref]$read)
$pw = $null
} else {
$primaryPath = Join-Path $KeyDir "primary.key"
if (-not (Test-Path $primaryPath)) {
throw "No signing key at $primaryPath. Run installer\New-UpdateSigningKey.ps1 first."
}
$entropy = [Text.Encoding]::UTF8.GetBytes("RynthCore update signing v1")
$pkcs8 = [System.Security.Cryptography.ProtectedData]::Unprotect([IO.File]::ReadAllBytes($primaryPath), $entropy, 'CurrentUser')
try {
$read = 0
$ec.ImportPkcs8PrivateKey($pkcs8, [ref]$read)
} finally { [Array]::Clear($pkcs8) }
}
$payload = [IO.File]::ReadAllBytes($PayloadPath)
$sig = $ec.SignData($payload, [System.Security.Cryptography.HashAlgorithmName]::SHA256,
[System.Security.Cryptography.DSASignatureFormat]::IeeeP1363FixedFieldConcatenation)
$spki = $ec.ExportSubjectPublicKeyInfo()
$id = ([Convert]::ToHexString([System.Security.Cryptography.SHA256]::HashData($spki), 0, 8)).ToLowerInvariant()
$envelope = [ordered]@{
payload = [Convert]::ToBase64String($payload)
signatures = @([ordered]@{ key = $id; sig = [Convert]::ToBase64String($sig) })
}
Set-Content -Path $OutPath -Value ($envelope | ConvertTo-Json -Depth 4) -Encoding utf8NoBOM
Write-Host "Signed $PayloadPath with key $id -> $OutPath"