merge: bring main (engine 2026.10.5.16) into QOL-items for PR #10

Resolves the 15 conflicting files between QOL-items and main's upstream
snapshot line. Plugin API is now 80: main's v77-v79 numbering stays and
GetMergeStackResultFn (v77 on QOL-items) moves to the end of the table as v80
in the engine and the SDK.

Details in Changelog/2026-10-07-merge-main-into-QOL-items.md.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
BlankenshipG 2026-10-07 09:01:16 -04:00
commit 50056c1d6f
123 changed files with 13415 additions and 1182 deletions

View file

@ -0,0 +1,86 @@
#Requires -Version 7
<#
.SYNOPSIS
Reads RynthCore plugin manifests and the engine's plugin API version, for Publish-Update.ps1.
.DESCRIPTION
Dot-source it: . (Join-Path $PSScriptRoot "PluginManifest.ps1")
Get-RynthPluginManifest <dll> the manifest embedded in a plugin DLL (RCDATA resource
RYNTH_PLUGIN_MANIFEST, written by the SDK's build targets)
as an object, or $null when the DLL has none. The DLL is
mapped as a data file only (LOAD_LIBRARY_AS_DATAFILE): none
of its code runs.
Get-RynthEngineApi <repoRoot> PluginContractVersion.Current from the engine's source.
Read-only; safe to run on its own (tools\PluginManifestTests\Test-PluginManifestPs.ps1 does).
#>
if (-not ('RynthCore.Publish.PeResource' -as [type])) {
Add-Type -Language CSharp -TypeDefinition @'
using System;
using System.Runtime.InteropServices;
namespace RynthCore.Publish
{
public static class PeResource
{
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
private static extern IntPtr LoadLibraryExW(string path, IntPtr file, uint flags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool FreeLibrary(IntPtr module);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
private static extern IntPtr FindResourceW(IntPtr module, string name, IntPtr type);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern IntPtr LoadResource(IntPtr module, IntPtr res);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern IntPtr LockResource(IntPtr data);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern uint SizeofResource(IntPtr module, IntPtr res);
private const uint LOAD_LIBRARY_AS_DATAFILE = 0x2;
private const uint LOAD_LIBRARY_AS_IMAGE_RESOURCE = 0x20;
/// <summary>RCDATA resource <paramref name="name"/> of a PE file, or null if it has none.</summary>
public static byte[] ReadRcData(string path, string name)
{
IntPtr module = LoadLibraryExW(path, IntPtr.Zero, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE);
if (module == IntPtr.Zero)
throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error(), "can't map " + path);
try
{
IntPtr res = FindResourceW(module, name, (IntPtr)10); // RT_RCDATA
if (res == IntPtr.Zero) return null;
uint size = SizeofResource(module, res);
IntPtr data = LockResource(LoadResource(module, res));
if (data == IntPtr.Zero) return null;
byte[] bytes = new byte[size];
Marshal.Copy(data, bytes, 0, (int)size);
return bytes;
}
finally
{
FreeLibrary(module);
}
}
}
}
'@
}
function Get-RynthPluginManifest([Parameter(Mandatory)][string]$Path) {
$bytes = [RynthCore.Publish.PeResource]::ReadRcData((Resolve-Path $Path).Path, "RYNTH_PLUGIN_MANIFEST")
if ($null -eq $bytes) { return $null }
$json = [Text.Encoding]::UTF8.GetString($bytes).TrimStart([char]0xFEFF).TrimEnd([char]0)
$m = $json | ConvertFrom-Json
if (-not $m.name) { throw "$Path has a plugin manifest without a name" }
if ($null -ne $m.minEngineApi -and -not ("$($m.minEngineApi)" -match '^\d+$')) { throw "$Path has a plugin manifest with a bad minEngineApi '$($m.minEngineApi)'" }
return $m
}
function Get-RynthEngineApi([Parameter(Mandatory)][string]$RepoRoot) {
$file = Join-Path $RepoRoot "src\RynthCore.Engine\Plugins\PluginContractVersion.cs"
$m = [regex]::Match((Get-Content $file -Raw), 'const\s+uint\s+Current\s*=\s*(\d+)')
if (-not $m.Success) { throw "No PluginContractVersion.Current in $file" }
return [int]$m.Groups[1].Value
}

View file

@ -271,6 +271,13 @@ $pluginDescriptions = @{
RynthOracle = "Quests, character, titles and leaderboards."
RynthInventory = "Search every character's items."
}
# Plugin manifests (embedded in each DLL by the SDK's build targets): each plugin's minEngineApi
# goes into its feed entry, and the core entry says its engine's API ("engineApi"), so launchers
# (from plugin manifests on) don't install a plugin build the installed engine would refuse; they
# say "needs RynthCore <version>" instead. Older launchers ignore both fields.
. (Join-Path $ScriptDir "PluginManifest.ps1")
$engineApi = Get-RynthEngineApi $RepoRoot
Write-Host " engine plugin API: $engineApi"
$plugins = foreach ($dll in Get-ChildItem "$rel\plugins\*.dll" | Sort-Object Name) {
$pluginName = $dll.BaseName -replace '^RynthCore\.Plugin\.', ''
$entry = [ordered]@{
@ -282,6 +289,17 @@ $plugins = foreach ($dll in Get-ChildItem "$rel\plugins\*.dll" | Sort-Object Nam
}
if ($pluginDescriptions[$pluginName]) { $entry.description = $pluginDescriptions[$pluginName] }
else { Write-Warning "No description for $pluginName - the launcher shows its own (or none). Add one to `$pluginDescriptions." }
$pm = Get-RynthPluginManifest $dll.FullName
if ($pm) {
if ($pm.name -ne $pluginName) { throw "$($dll.Name): its manifest says '$($pm.name)', the feed would say '$pluginName'." }
if ($pm.version -and $pm.version -ne $Version) { throw "$($dll.Name): its manifest is version $($pm.version), not $Version (stale build?)." }
$min = [int]$pm.minEngineApi
if ($min -gt $engineApi) { throw "$($dll.Name) needs engine API $min but this release's engine is $engineApi - it would never load." }
if ($min -gt 0) { $entry.minEngineApi = $min }
Write-Host " $pluginName $($pm.version): engine API $min+"
} else {
Write-Warning "$($dll.Name) has no plugin manifest - launchers install it on any engine."
}
$entry
}
$manifest = [ordered]@{
@ -299,6 +317,8 @@ $manifest = [ordered]@{
url = "$BaseUrl/releases/$release/RynthCore-Setup.exe"
size = $setup.Length
sha256 = Sha256 $setup.FullName
# The plugin API of the engine in this installer (see the plugins' minEngineApi above).
engineApi = $engineApi
}
plugins = @($plugins)
}