feat(installer): full RynthCore + RynthSuite installer with user-chosen folders

- RynthCore.iss: one installer for the launcher/engine/Loot Editor and RynthSuite
  (RynthAi plugin, Monster Editor), with a second folder page for RynthSuite
  (/SUITEDIR= for silent installs), HKA Software\Rynth CoreDir/SuiteDir values and
  cleanup of 0.4.x / RynthBundle leftovers that broke the 2026-10-04 reinstall
- RynthInstallPaths: env var -> HKCU -> HKLM (32-bit) -> C:\Games default resolver,
  linked into launcher, engine, loader, injector and status agent; replaces every
  hard-coded C:\Games\RynthCore / RynthSuite path
- Launcher consumes PendingPluginRegistration on start (adds the installed RynthAi
  DLL, prunes rows for files the installer removed, syncs engine.json)
- Build-Installer.ps1: Monster Editor publish, core/suite staging, deps.json staging
  check, previous-release archiving, versioned RynthCore-Setup-<ver>.exe
- Release 2026.10.4.2 (previous 2026.10.4.1)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
BlankenshipG 2026-10-04 14:30:28 -04:00
commit f5002902c9
23 changed files with 689 additions and 116 deletions

View file

@ -2,6 +2,7 @@ using System;
using System.IO;
using System.Text;
using System.Threading;
using RynthCore.Install;
namespace RynthCore.App.Avalonia;
@ -18,7 +19,8 @@ namespace RynthCore.App.Avalonia;
/// </summary>
internal static class LauncherDiag
{
private const string UnifiedLogDirectory = @"C:\Games\RynthCore\Logs";
// Installer-chosen RynthCore folder (falls back to C:\Games\RynthCore).
private static readonly string UnifiedLogDirectory = RynthInstallPaths.CoreLogsDir;
private const string UnifiedLogFileName = "RynthCore.log";
private static readonly object LogLock = new();

View file

@ -18,6 +18,7 @@ using Avalonia.Media;
using Avalonia.Platform.Storage;
using Avalonia.Threading;
using RynthCore.Injector;
using RynthCore.Install;
namespace RynthCore.App.Avalonia;
@ -136,6 +137,7 @@ internal partial class MainWindow : Window
SessionList.ItemsSource = _sessionItems;
LoadSettings();
LoadRuntimeControls();
ApplyInstallerPluginRegistration();
LoadPluginDllPaths();
BuildPluginLoadout();
WireEvents();
@ -1639,6 +1641,78 @@ internal partial class MainWindow : Window
AppendActivity($"Runtime loadout updated: {Path.GetFileName(dllPath)} {(enabled ? "enabled" : "disabled")} (engine.json synced).");
}
/// <summary>
/// Applies the installer's one-shot plugin hand-off: the full installer writes the plugin
/// DLL paths it placed in the user-chosen RynthSuite folder to
/// <c>Software\Rynth\PendingPluginRegistration</c> (';'-separated). Each existing DLL is added
/// to the Plugins list, and any entry with the same file name that no longer exists (e.g. the
/// old <c>C:\Games\RynthSuite\...</c> path after moving the Suite folder) is replaced.
/// Rows pointing inside the RynthCore folder whose file the installer removed are dropped too.
/// The value is consumed once (deleted from HKCU; remembered in settings for HKLM).
/// </summary>
private void ApplyInstallerPluginRegistration()
{
try
{
string? pending = RynthInstallPaths.ReadSetting("PendingPluginRegistration");
if (string.IsNullOrWhiteSpace(pending)
|| string.Equals(pending, _settings.AppliedInstallerPluginRegistration, StringComparison.OrdinalIgnoreCase))
return;
_settings.PluginDllPaths ??= [];
var added = new List<string>();
// The installer clears loose DLLs out of the RynthCore folder (old 0.4.x layouts kept plugins
// and SDK DLLs there), so drop rows that pointed inside it and are now gone. Rows elsewhere are
// left alone, since a missing file there may just be on a drive that isn't mounted.
string coreRoot = Path.TrimEndingDirectorySeparator(RynthInstallPaths.CoreDir) + Path.DirectorySeparatorChar;
bool IsRemovedCoreFile(string p) =>
p.StartsWith(coreRoot, StringComparison.OrdinalIgnoreCase) && !File.Exists(p);
int pruned = _settings.PluginDllPaths.RemoveAll(IsRemovedCoreFile);
_settings.DisabledPluginDllPaths.RemoveAll(IsRemovedCoreFile);
foreach (string raw in pending.Split(';', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries))
{
string path;
try { path = Path.GetFullPath(raw); } catch { continue; }
if (!File.Exists(path)) continue;
string fileName = Path.GetFileName(path);
// Drop stale rows for the same plugin that point at a file which is gone.
_settings.PluginDllPaths.RemoveAll(p =>
string.Equals(Path.GetFileName(p), fileName, StringComparison.OrdinalIgnoreCase)
&& !string.Equals(p, path, StringComparison.OrdinalIgnoreCase)
&& !File.Exists(p));
if (!_settings.PluginDllPaths.Any(p => string.Equals(p, path, StringComparison.OrdinalIgnoreCase)))
{
_settings.PluginDllPaths.Add(path);
added.Add(fileName);
}
}
_settings.AppliedInstallerPluginRegistration = pending;
SaveSettings();
RynthInstallPaths.DeleteUserSetting("PendingPluginRegistration");
_pluginDllPaths.Clear();
foreach (string p in _settings.PluginDllPaths) _pluginDllPaths.Add(p);
SyncPluginPathsToEngineSettings();
string msg = added.Count > 0
? $"Installer registered plugin(s): {string.Join(", ", added)} (engine.json synced)."
: "Installer plugin registration already up to date.";
if (pruned > 0)
msg += $" Removed {pruned} plugin path(s) for files the installer cleared from {RynthInstallPaths.CoreDir}.";
LauncherDiag.Info("PLUGINS: " + msg);
try { AppendActivity(msg); } catch { }
}
catch (Exception ex)
{
LauncherDiag.Info("PLUGINS: installer registration failed: " + ex.Message);
}
}
private void LoadPluginDllPaths()
{
_pluginDllPaths.Clear();
@ -2338,7 +2412,7 @@ internal partial class MainWindow : Window
// Tail the per-PID log for the last heartbeat line. Cheap: seek to
// the end, read ~2KB, FileShare-tolerant of the engine's writer.
string logPath = System.IO.Path.Combine(@"C:\Games\RynthCore\Logs", $"RynthCore.{pid}.log");
string logPath = System.IO.Path.Combine(RynthInstallPaths.CoreLogsDir, $"RynthCore.{pid}.log");
string tail;
try
{

View file

@ -48,4 +48,9 @@
<Compile Include="..\RynthCore.Injector\InjectionResult.cs" Link="Shared\InjectionResult.cs" />
</ItemGroup>
<ItemGroup>
<!-- Install-location resolver (installer-chosen RynthCore / RynthSuite folders). -->
<Compile Include="..\RynthCore.App\RynthInstallPaths.cs" Link="Shared\RynthInstallPaths.cs" />
</ItemGroup>
</Project>

View file

@ -55,6 +55,14 @@ internal sealed class AppSettings
/// the UI), but is filtered out when syncing PluginPaths into engine.json.
/// Case-insensitive set semantics; comparisons must use OrdinalIgnoreCase.
public List<string> DisabledPluginDllPaths { get; set; } = [];
/// <summary>
/// Last installer plugin hand-off (registry <c>Software\Rynth\PendingPluginRegistration</c>)
/// the launcher applied. Lets an all-users install, whose HKLM value the launcher cannot
/// delete, register its plugins once without re-adding a plugin the user later removed.
/// </summary>
public string? AppliedInstallerPluginRegistration { get; set; }
public List<LaunchServerProfile> ServerProfiles { get; set; } = [];
public List<LaunchAccountProfile> AccountProfiles { get; set; } = [];

View file

@ -0,0 +1,128 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace RynthCore.Install;
/// <summary>
/// Resolves where RynthCore and RynthSuite are installed. The installer lets the user pick
/// both folders and records them under <c>Software\Rynth</c> (HKCU for a per-user install,
/// HKLM for an all-users install), so nothing may assume <c>C:\Games\...</c> any more.
/// <para>
/// Resolution order per folder: environment override (<c>RYNTHCORE_DIR</c> /
/// <c>RYNTHSUITE_DIR</c>, for dev setups) → HKCU → HKLM (32-bit view, where the 32-bit
/// installer writes) → the historical default under <c>C:\Games</c>. Results are cached
/// for the life of the process.
/// </para>
/// Linked into every RynthCore project (Engine, Loader, Injector, launcher, StatusAgent);
/// RynthSuite keeps an identical copy in <c>Shared/RynthInstallPaths.cs</c> — change both together.
/// Registry access is a direct RegGetValueW P/Invoke so it works under NativeAOT and trimming
/// without pulling in Microsoft.Win32.Registry.
/// </summary>
internal static class RynthInstallPaths
{
/// <summary>Default RynthCore folder (pre-2026.10.4.2 installs always used this).</summary>
public const string DefaultCoreDir = @"C:\Games\RynthCore";
/// <summary>Default RynthSuite folder (pre-2026.10.4.2 installs always used this).</summary>
public const string DefaultSuiteDir = @"C:\Games\RynthSuite";
/// <summary>Registry key (under HKCU or HKLM) written by the installer.</summary>
public const string RegistryKey = @"Software\Rynth";
private static string? _coreDir;
private static string? _suiteDir;
/// <summary>RynthCore install folder (launcher, <c>Runtime\</c>, <c>Logs\</c>, <c>Tools\</c>).</summary>
public static string CoreDir => _coreDir ??= Resolve("RYNTHCORE_DIR", "CoreDir", DefaultCoreDir);
/// <summary>RynthSuite folder (plugins and their data, e.g. <c>RynthAi\</c>).</summary>
public static string SuiteDir => _suiteDir ??= Resolve("RYNTHSUITE_DIR", "SuiteDir", DefaultSuiteDir);
/// <summary>Unified RynthCore log folder (<c>&lt;CoreDir&gt;\Logs</c>).</summary>
public static string CoreLogsDir => Path.Combine(CoreDir, "Logs");
/// <summary>RynthAi plugin home and data root (<c>&lt;SuiteDir&gt;\RynthAi</c>).</summary>
public static string RynthAiDir => Path.Combine(SuiteDir, "RynthAi");
/// <summary>Reads a string value from <c>Software\Rynth</c> (HKCU first, then HKLM 32-bit view); null when absent.</summary>
public static string? ReadSetting(string valueName)
=> ReadRegistryString(HKEY_CURRENT_USER, valueName, 0)
?? ReadRegistryString(HKEY_LOCAL_MACHINE, valueName, RRF_SUBKEY_WOW6432KEY);
/// <summary>Deletes a value from HKCU <c>Software\Rynth</c> (used for one-shot installer hand-offs). Best effort.</summary>
public static void DeleteUserSetting(string valueName)
{
try { RegDeleteKeyValueW(HKEY_CURRENT_USER, RegistryKey, valueName); } catch { }
}
private static string Resolve(string envVar, string valueName, string fallback)
{
string? fromEnv = null;
try { fromEnv = Environment.GetEnvironmentVariable(envVar); } catch { }
foreach (string? candidate in new[] { fromEnv, ReadSetting(valueName) })
{
string? normalized = Normalize(candidate);
if (normalized != null) return normalized;
}
return fallback;
}
/// <summary>Accepts only absolute paths; trims whitespace, quotes and trailing separators.</summary>
private static string? Normalize(string? path)
{
if (string.IsNullOrWhiteSpace(path)) return null;
string p = path.Trim().Trim('"').TrimEnd('\\', '/');
if (p.Length == 2 && p[1] == ':') p += "\\"; // keep "D:" as the drive root "D:\"
try
{
if (!Path.IsPathFullyQualified(p)) return null;
string full = Path.GetFullPath(p);
return full.Length > 3 ? full.TrimEnd('\\') : full; // "D:\" stays a root
}
catch
{
return null;
}
}
// ── Win32 registry (advapi32) ───────────────────────────────────────────
private static readonly IntPtr HKEY_CURRENT_USER = new(unchecked((int)0x80000001));
private static readonly IntPtr HKEY_LOCAL_MACHINE = new(unchecked((int)0x80000002));
private const uint RRF_RT_REG_SZ = 0x00000002;
private const uint RRF_RT_REG_EXPAND_SZ = 0x00000004;
private const uint RRF_SUBKEY_WOW6432KEY = 0x00020000;
private const int ERROR_SUCCESS = 0;
[DllImport("advapi32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
private static extern int RegGetValueW(IntPtr hkey, string lpSubKey, string lpValue, uint dwFlags,
IntPtr pdwType, char[]? pvData, ref uint pcbData);
[DllImport("advapi32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
private static extern int RegDeleteKeyValueW(IntPtr hkey, string lpSubKey, string lpValueName);
private static string? ReadRegistryString(IntPtr root, string valueName, uint viewFlags)
{
try
{
uint flags = RRF_RT_REG_SZ | RRF_RT_REG_EXPAND_SZ | viewFlags;
uint bytes = 0;
if (RegGetValueW(root, RegistryKey, valueName, flags, IntPtr.Zero, null, ref bytes) != ERROR_SUCCESS || bytes < 2)
return null;
var buffer = new char[(bytes + 1) / 2];
if (RegGetValueW(root, RegistryKey, valueName, flags, IntPtr.Zero, buffer, ref bytes) != ERROR_SUCCESS)
return null;
int len = Array.IndexOf(buffer, '\0');
return new string(buffer, 0, len >= 0 ? len : buffer.Length);
}
catch
{
// Missing advapi32 entry point or access denied — fall back to the defaults.
return null;
}
}
}

View file

@ -97,7 +97,8 @@ public static class EntryPoint
catch { }
// Set up the unified log sink BEFORE anything else so all
// subsequent failures are captured in C:\Games\RynthCore\Logs.
// subsequent failures are captured in <CoreDir>\Logs (installer-chosen;
// resolved here on the init worker, never under the loader lock).
LogPaths.EnsureLogDirectory();
if (_initCount <= 1)
{

View file

@ -23,6 +23,7 @@ using System.Runtime.InteropServices;
using ImGuiNET;
using RynthCore.Engine.D3D9;
using RynthCore.Engine.Plugins;
using RynthCore.Install;
namespace RynthCore.Engine.ImGuiBackend;
@ -131,8 +132,8 @@ internal static class EngineFrameController
// between launches. Allocated once, kept alive for the process lifetime.
try
{
const string iniPath = @"C:\Games\RynthSuite\RynthAi\imgui.ini";
System.IO.Directory.CreateDirectory(@"C:\Games\RynthSuite\RynthAi");
string iniPath = System.IO.Path.Combine(RynthInstallPaths.RynthAiDir, "imgui.ini");
System.IO.Directory.CreateDirectory(RynthInstallPaths.RynthAiDir);
IntPtr iniPtr = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(iniPath);
unsafe { io.NativePtr->IniFilename = (byte*)iniPtr; }
RynthLog.Render($"EngineFrameController: imgui.ini pinned to {iniPath}");

View file

@ -10,6 +10,7 @@ using System.Runtime.InteropServices;
using ImGuiNET;
using RynthCore.Engine.D3D9;
using RynthCore.Engine.Plugins;
using RynthCore.Install;
namespace RynthCore.Engine.ImGuiBackend;
@ -89,8 +90,8 @@ internal static class ImGuiController
// between launches. Allocated once, kept alive for the process lifetime.
try
{
const string iniPath = @"C:\Games\RynthSuite\RynthAi\imgui.ini";
System.IO.Directory.CreateDirectory(@"C:\Games\RynthSuite\RynthAi");
string iniPath = System.IO.Path.Combine(RynthInstallPaths.RynthAiDir, "imgui.ini");
System.IO.Directory.CreateDirectory(RynthInstallPaths.RynthAiDir);
IntPtr iniPtr = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(iniPath);
unsafe { io.NativePtr->IniFilename = (byte*)iniPtr; }
RynthLog.Render($"ImGuiController: imgui.ini pinned to {iniPath}");

View file

@ -21,13 +21,15 @@
using System;
using System.IO;
using RynthCore.Install;
namespace RynthCore.Engine;
internal static class LogPaths
{
/// <summary>Unified log directory for all RynthCore components.</summary>
internal const string LogDirectory = @"C:\Games\RynthCore\Logs";
// Installer-chosen RynthCore folder (registry Software\Rynth\CoreDir; falls back to C:\Games\RynthCore).
internal static readonly string LogDirectory = RynthInstallPaths.CoreLogsDir;
/// <summary>Shared launch/orchestration log (injector + launcher + per-engine session pointer).</summary>
internal const string SharedLogFileName = "RynthCore.log";

View file

@ -119,4 +119,9 @@
SkipUnchangedFiles="true" />
</Target>
<ItemGroup>
<!-- Install-location resolver (installer-chosen RynthCore / RynthSuite folders). -->
<Compile Include="..\RynthCore.App\RynthInstallPaths.cs" Link="Shared\RynthInstallPaths.cs" />
</ItemGroup>
</Project>

View file

@ -20,6 +20,7 @@ using Avalonia.Layout;
using Avalonia.Media;
using Avalonia.Threading;
using RynthCore.Engine.Plugins;
using RynthCore.Install;
namespace RynthCore.Engine.UI.Panels;
@ -955,7 +956,7 @@ internal static class MetaPanel
string n = ps.SaveName.Trim();
if (!string.IsNullOrEmpty(n))
{
string path = @$"C:\Games\RynthSuite\RynthAi\MetaFiles\{n}.af";
string path = System.IO.Path.Combine(RynthInstallPaths.RynthAiDir, "MetaFiles", $"{n}.af");
Send(new MetaCmd { Op = "save_file", Path = path });
}
ps.ShowSaveInput = false;

View file

@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using RynthCore.Install;
namespace RynthCore.Injector;
@ -33,7 +34,7 @@ internal static class LaunchCommand
{
// The "bulletproof" private AC copy intended for RynthCore launches — a
// separate DAT lock domain from the shared Turbine install.
private const string PrivateAcClientPath = @"C:\Games\RynthCore\AcClient\acclient.exe";
private static readonly string PrivateAcClientPath = Path.Combine(RynthInstallPaths.CoreDir, "AcClient", "acclient.exe");
// Matches LaunchAccountProfile.NoneOption — explicit opt-out of auto-login.
private const string NoneOption = "(None — no auto-login)";

View file

@ -2,13 +2,15 @@ using System;
using System.IO;
using System.Linq;
using System.Text;
using RynthCore.Install;
namespace RynthCore.Injector;
internal static class Program
{
// Unified log path — must stay in sync with RynthCore.Engine.LogPaths.
private const string UnifiedLogDirectory = @"C:\Games\RynthCore\Logs";
// Installer-chosen RynthCore folder (falls back to C:\Games\RynthCore).
private static readonly string UnifiedLogDirectory = RynthInstallPaths.CoreLogsDir;
private const string UnifiedLogFileName = "RynthCore.log";
private static int Main(string[] args)

View file

@ -10,4 +10,9 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<!-- Install-location resolver (installer-chosen RynthCore / RynthSuite folders). -->
<Compile Include="..\RynthCore.App\RynthInstallPaths.cs" Link="Shared\RynthInstallPaths.cs" />
</ItemGroup>
</Project>

View file

@ -19,6 +19,7 @@ using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using RynthCore.Install;
namespace RynthCore.Loader;
@ -31,7 +32,8 @@ public static class EntryPoint
// Unified log path — must stay in sync with RynthCore.Engine.LogPaths.
// The loader cannot reference the engine assembly (it loads it
// dynamically), so the constants are mirrored here.
private const string UnifiedLogDirectory = @"C:\Games\RynthCore\Logs";
// Installer-chosen RynthCore folder (falls back to C:\Games\RynthCore).
private static readonly string UnifiedLogDirectory = RynthInstallPaths.CoreLogsDir;
private const string UnifiedLogFileName = "RynthCore.log";
/// <summary>
/// Subdirectory beside the loader where reload-generation copies of the

View file

@ -26,4 +26,9 @@
<Optimize>false</Optimize>
</PropertyGroup>
<ItemGroup>
<!-- Install-location resolver (installer-chosen RynthCore / RynthSuite folders). -->
<Compile Include="..\RynthCore.App\RynthInstallPaths.cs" Link="Shared\RynthInstallPaths.cs" />
</ItemGroup>
</Project>

View file

@ -1,5 +1,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using RynthCore.Install;
namespace RynthCore.StatusAgent;
@ -27,10 +28,10 @@ internal sealed class AgentConfig
[JsonPropertyName("TimeoutSeconds")] public int TimeoutSeconds { get; set; } = 15;
/// <summary>Directory holding the engine's per-client status files.</summary>
[JsonPropertyName("StatusDirectory")] public string StatusDirectory { get; set; } = @"C:\Games\RynthCore\Logs\status";
[JsonPropertyName("StatusDirectory")] public string StatusDirectory { get; set; } = Path.Combine(RynthInstallPaths.CoreLogsDir, "status");
/// <summary>Directory holding per-client RynthCore.&lt;pid&gt;.log files (heartbeat fallback).</summary>
[JsonPropertyName("LogDirectory")] public string LogDirectory { get; set; } = @"C:\Games\RynthCore\Logs";
[JsonPropertyName("LogDirectory")] public string LogDirectory { get; set; } = RynthInstallPaths.CoreLogsDir;
/// <summary>When true and no status file exists for a running client, derive
/// basic status from that client's heartbeat log line. Lets the agent work
@ -97,12 +98,12 @@ internal sealed class AgentConfig
/// <summary>portal.dat used to decode item icons for GET /icon (read-only inventory viewer). Defaults to
/// the RynthCore client's private copy. If the file is absent (e.g. an agent running off the game box)
/// /icon 404s and the app falls back to text rows — no other feature is affected.</summary>
[JsonPropertyName("IconDatPath")] public string IconDatPath { get; set; } = @"C:\Games\RynthCore\AcClient\client_portal.dat";
[JsonPropertyName("IconDatPath")] public string IconDatPath { get; set; } = Path.Combine(RynthInstallPaths.CoreDir, "AcClient", "client_portal.dat");
/// <summary>Directory of RynthAi's baked dungeon floor-plan maps ({landblock:X8}_{layer}.bin), served as
/// PNGs via GET /map for the app's dungeon-map viewer. If the folder is absent (agent off the game box)
/// /maps returns an empty list and /map 404s — no other feature is affected.</summary>
[JsonPropertyName("MapsDirectory")] public string MapsDirectory { get; set; } = @"C:\Games\RynthSuite\RynthAi\Maps";
[JsonPropertyName("MapsDirectory")] public string MapsDirectory { get; set; } = Path.Combine(RynthInstallPaths.RynthAiDir, "Maps");
public static string DefaultConfigPath => Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),

View file

@ -30,4 +30,9 @@
<PackageReference Include="SIPSorcery" Version="10.0.14" />
</ItemGroup>
<ItemGroup>
<!-- Install-location resolver (installer-chosen RynthCore / RynthSuite folders). -->
<Compile Include="..\RynthCore.App\RynthInstallPaths.cs" Link="Shared\RynthInstallPaths.cs" />
</ItemGroup>
</Project>