diff --git a/.gitignore b/.gitignore index 6c1088b..be03e45 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,5 @@ installer/Releases/ # Process Monitor / debug log dumps (session junk) *.PML Logfile*.XML +# Archived installers (Build-Installer.ps1 keeps the previous release here; only the version marker is tracked) +installer/previous-release/*.exe diff --git a/Changelog/2026-10-04-full-installer-2026.10.4.2.md b/Changelog/2026-10-04-full-installer-2026.10.4.2.md new file mode 100644 index 0000000..7c63ef3 --- /dev/null +++ b/Changelog/2026-10-04-full-installer-2026.10.4.2.md @@ -0,0 +1,68 @@ +# RynthCore 2026.10.4.2: full RynthCore + RynthSuite installer + +**Release date:** 2026-10-04 +**Installer:** `installer\Output\RynthCore-Setup-2026.10.4.2.exe` (also copied to `RynthCore-Setup.exe`) +**Previous release:** `2026.10.4.1` (archived to `installer\previous-release\RynthCore-Setup-2026.10.4.1.exe`) +**Branch:** `feat/full-installer` (local test build, not on `main`), based on `fix/tmds-dbus-advisory` +**Bundled RynthSuite:** RynthAi `0.5.3`, Loot Editor, Monster Editor (from RynthSuite `feat/ilt-hub`) + +## Why: the launcher would not start + +On 2026-10-04 an old **RynthBundle 0.4.7** installer was run over the 2026.10.3.4 install. It replaced +`RynthCore.App.Avalonia.dll` with the 0.4.x build, which needs `RynthCore.DesktopLog.dll`, but left the newer +`RynthCore.App.Avalonia.deps.json`, which does not list it. The renamed apphost (`RynthCore.exe`) loads exactly +what the deps.json lists, so .NET failed at startup with `FileNotFoundException: RynthCore.DesktopLog` +(Event Log, .NET Runtime 1026). The new installer fixes such an install in place (see **Cleanup** below). + +## One installer, two folders you choose + +- **Wizard pages:** + - **Select Destination Location** picks the RynthCore folder (default `C:\Games\RynthCore`). + - **Select Components** offers Full, RynthCore only, or Custom. RynthCore is always installed; RynthAi and the + Monster Editor are optional. + - **Select RynthSuite Location** picks the RynthSuite folder. It defaults to a `RynthSuite` folder next to + the RynthCore folder you picked, or the folder used last time. The page is skipped when no Suite component is selected. +- **Silent installs:** `RynthCore-Setup-2026.10.4.2.exe /SILENT /DIR="D:\Games\RynthCore" /SUITEDIR="D:\Games\RynthSuite"`. + Without `/SUITEDIR` the Suite goes next to `/DIR`, or to the previously used folder. +- **Registry:** both folders are written to `Software\Rynth` (`CoreDir`, `SuiteDir`). That is HKCU for per-user installs + and HKLM for all-users installs. All of RynthCore and RynthSuite now read them. +- **Plugin auto-registration:** the installer leaves `PendingPluginRegistration` with the RynthAi DLL path. On the next + start the launcher adds it to the Plugins list (replacing any stale entry with the same file name whose file is gone), + syncs `engine.json` and clears the value. A fresh install therefore loads RynthAi with no manual setup. +- **Shortcuts:** RynthCore, Loot Editor, Monster Editor, RynthSuite folder, Uninstall, and an optional desktop icon. + +### Cleanup of older layouts +Before copying, the installer deletes leftovers from 0.4.x and RynthBundle installs in the RynthCore folder: +root `*.dll`/`*.json`/`*.pdb`, `RynthCore.App.Avalonia.exe`, old `Runtime\*.dll`/`*.json`, `Runtime\RynthCore.Injector.exe` +and `Runtime\Plugins\`. Then it lays down a complete, matching set. User data (`Logs`, settings in `%APPDATA%\RynthCore`, +everything under `\RynthAi`) is never touched, and the RynthSuite data folders survive an uninstall. + +## Code: no more hard-coded `C:\Games\...` + +New `src/RynthCore.App/RynthInstallPaths.cs`, linked into the launcher, engine, loader, injector and status agent. +It resolves the folders in this order: `RYNTHCORE_DIR`/`RYNTHSUITE_DIR` environment variables, then HKCU, then HKLM +(32-bit view), then the old `C:\Games\...` defaults. It uses a direct `RegGetValueW` P/Invoke, so it is NativeAOT-safe. +The engine resolves it on its init worker, never under the loader lock. + +| Was | Now | +|---|---| +| `C:\Games\RynthCore\Logs` (launcher, loader, injector, engine) | `\Logs` | +| `C:\Games\RynthCore\AcClient\acclient.exe` (injector) | `\AcClient\acclient.exe` | +| `C:\Games\RynthSuite\RynthAi\imgui.ini`, MetaFiles | `\RynthAi\...` | +| Status agent defaults | derived from the resolved folders | + +## Build script (`installer\Build-Installer.ps1`) +- **Publishes:** launcher, Engine, Loader, the RynthAi plugin, the Loot Editor, and now the **Monster Editor** + (self-contained win-x86). +- **Staging:** RynthCore goes to `staging\core`, RynthSuite to `staging\suite\RynthAi` (plugin plus `MonsterEditor\`). +- **Versions:** the RynthAi plugin is no longer stamped with the installer version. It keeps its own semantic version + (0.5.3), and everything else gets `-p:Version=`. +- **New check:** every project assembly listed in the launcher's `deps.json` must be staged next to it. This guards + directly against the DesktopLog failure above. +- **Previous release:** `installer\previous-release\last-built-version.txt` tracks the last build. When the version + changes, that build's installer is archived to `previous-release\` (git-ignored) before the new one is built. +- **Output:** `RynthCore-Setup-.exe`, plus a `RynthCore-Setup.exe` copy. + +## Not included +RynthChat, RynthJuice, RynthNav, RynthTracker and RynthVision are experimental and stay out of the installer. +RynthNav and RynthJuice still hard-code `C:\Games\RynthCore`. diff --git a/installer/Build-Installer.ps1 b/installer/Build-Installer.ps1 index 12fe70a..faa6a57 100644 --- a/installer/Build-Installer.ps1 +++ b/installer/Build-Installer.ps1 @@ -1,27 +1,42 @@ #Requires -Version 5.1 <# .SYNOPSIS - Builds all RynthCore components and produces RynthCore-Setup.exe via Inno Setup. + Builds RynthCore + RynthSuite from source and produces the full installer + (RynthCore-Setup-.exe) via Inno Setup. .DESCRIPTION 1. Publishes the Avalonia launcher (self-contained, x86) 2. Publishes RynthCore.Engine (NativeAOT, x86 -- ~2 min) 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 + 4. Publishes RynthCore.Plugin.RynthAi (NativeAOT, x86) from RynthSuite + 5. Publishes the Loot Editor (self-contained, x86) + 6. Publishes the Monster Editor (self-contained, x86) from RynthSuite + 7. Stages RynthCore under installer\staging\core\ and RynthSuite under + installer\staging\suite\, plus the hand-built RynthCore.SehTrampoline.dll, + and checks every required runtime file is there + 8. Archives the previous installer (installer\previous-release\) when -Version changes + 9. Invokes ISCC.exe to produce installer\Output\RynthCore-Setup-.exe + (and a RynthCore-Setup.exe copy) + + The installer lets the user choose both the RynthCore and the RynthSuite folders; the + code resolves them at runtime from HKA\Software\Rynth (see src\RynthCore.App\RynthInstallPaths.cs). .PARAMETER Configuration Build configuration. Default: Release .PARAMETER IsccPath - Path to ISCC.exe (Inno Setup compiler). Default looks in the standard Inno Setup 6 location. + Path to ISCC.exe (Inno Setup compiler). Default looks in the standard Inno Setup 6 locations. Install Inno Setup from: https://jrsoftware.org/isdl.php +.PARAMETER RynthSuiteRoot + RynthSuite repo root. Default: the sibling ..\RynthSuite next to this RynthCore repo. + +.PARAMETER Version + Release version yyyy.m.d.n (e.g. 2026.10.4.2). Stamped into the launcher/engine/tools, + release.txt and the installer. Omit for a dev build. + .PARAMETER SkipBuild - Skip dotnet publish steps and just re-run ISCC against the existing staging directory. + Skip dotnet publish steps and just re-stage + re-run ISCC against existing publish output. #> param( [string]$Configuration = "Release", @@ -29,7 +44,7 @@ param( # 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 = "", - # Version string injected into the installer (e.g. "0.3"). When omitted, + # Version string injected into the installer (yyyy.m.d.n). When omitted, # the version defined in RynthCore.iss is used as-is. [string]$Version = "", [switch]$SkipBuild @@ -51,8 +66,10 @@ if ($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. +# Stamp the core builds and tools 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. +# The RynthAi plugin keeps its own semantic version (RynthCore.Plugin.RynthAi.csproj), so it +# is published WITHOUT these args. $VersionArgs = @() if ($Version) { $VersionArgs = @("-p:Version=$Version") } @@ -65,22 +82,28 @@ if (-not $RynthSuiteRoot) { $RynthSuiteRoot = "$ProjectsRoot\RynthSuite" } -$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" +$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" +$MonsterEditorProject = "$RynthSuiteRoot\Tools\RynthCore.MonsterEditor\RynthCore.MonsterEditor.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" -$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" +$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" +$MonsterEditorPublish = "$RynthSuiteRoot\Tools\RynthCore.MonsterEditor\bin\$Configuration\net10.0\win-x86\publish" -$StagingDir = "$ScriptDir\staging\app" +# staging\core → {app} (user-chosen RynthCore folder) +# staging\suite → {code:GetSuiteDir} (user-chosen RynthSuite folder) +$StagingRoot = "$ScriptDir\staging" +$CoreStaging = "$StagingRoot\core" +$SuiteStaging = "$StagingRoot\suite" # ── Validate projects ─────────────────────────────────────────────────────── -foreach ($p in @($LauncherProject, $EngineProject, $LoaderProject, $PluginProject, $LootEditorProject)) { +foreach ($p in @($LauncherProject, $EngineProject, $LoaderProject, $PluginProject, $LootEditorProject, $MonsterEditorProject)) { if (-not (Test-Path $p)) { throw "Project not found: $p`nUpdate paths in Build-Installer.ps1 if your repo layout differs." } @@ -89,64 +112,76 @@ foreach ($p in @($LauncherProject, $EngineProject, $LoaderProject, $PluginProjec if (-not $SkipBuild) { # ── 1. Launcher (self-contained Avalonia WinExe) ───────────────────────── Write-Host "" - Write-Host "[1/5] Publishing Launcher (self-contained, x86)..." -ForegroundColor Cyan + Write-Host "[1/6] 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/5] Publishing Engine (NativeAOT, ~2 min)..." -ForegroundColor Cyan + Write-Host "[2/6] Publishing Engine (NativeAOT, ~2 min)..." -ForegroundColor Cyan dotnet publish $EngineProject -c $Configuration @VersionArgs if ($LASTEXITCODE -ne 0) { throw "Engine publish failed (exit $LASTEXITCODE)" } # ── 3. Loader (NativeAOT, small) ────────────────────────────────────────── Write-Host "" - Write-Host "[3/5] Publishing Loader (NativeAOT)..." -ForegroundColor Cyan + Write-Host "[3/6] Publishing Loader (NativeAOT)..." -ForegroundColor Cyan dotnet publish $LoaderProject -c $Configuration @VersionArgs if ($LASTEXITCODE -ne 0) { throw "Loader publish failed (exit $LASTEXITCODE)" } - # ── 4. Plugin (NativeAOT) ───────────────────────────────────────────────── + # ── 4. RynthAi plugin (NativeAOT; keeps its own version) ───────────────── Write-Host "" - Write-Host "[4/5] Publishing Plugin (NativeAOT)..." -ForegroundColor Cyan - dotnet publish $PluginProject -c $Configuration @VersionArgs + Write-Host "[4/6] Publishing RynthAi plugin (NativeAOT)..." -ForegroundColor Cyan + dotnet publish $PluginProject -c $Configuration 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 + Write-Host "[5/6] 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)" } + + # ── 6. Monster Editor (self-contained Avalonia tool) ────────────────────── + Write-Host "" + Write-Host "[6/6] Publishing Monster Editor (self-contained, x86)..." -ForegroundColor Cyan + dotnet publish $MonsterEditorProject -c $Configuration -r win-x86 --self-contained true @VersionArgs + if ($LASTEXITCODE -ne 0) { throw "Monster Editor publish failed (exit $LASTEXITCODE)" } } # ── Stage ──────────────────────────────────────────────────────────────────── Write-Host "" Write-Host "Staging files..." -ForegroundColor Cyan -if (Test-Path "$ScriptDir\staging") { - Remove-Item "$ScriptDir\staging" -Recurse -Force +if (Test-Path $StagingRoot) { + Remove-Item $StagingRoot -Recurse -Force +} +New-Item -ItemType Directory -Path "$CoreStaging\Runtime\Native" -Force | Out-Null +New-Item -ItemType Directory -Path "$CoreStaging\Tools\LootEditor" -Force | Out-Null +New-Item -ItemType Directory -Path "$SuiteStaging\RynthAi\MonsterEditor" -Force | Out-Null + +# Copies a publish folder (files + subfolders) without .pdb files. +function Copy-PublishTree([string]$Source, [string]$Dest) { + if (-not (Test-Path $Source)) { throw "Publish output not found: $Source" } + foreach ($file in (Get-ChildItem $Source -File)) { + if ($file.Extension -eq '.pdb') { continue } + Copy-Item $file.FullName (Join-Path $Dest $file.Name) -Force + } + foreach ($dir in (Get-ChildItem $Source -Directory)) { + Copy-Item $dir.FullName $Dest -Recurse -Force + Get-ChildItem (Join-Path $Dest $dir.Name) -Recurse -File -Filter '*.pdb' | Remove-Item -Force + } } -New-Item -ItemType Directory -Path "$StagingDir\Runtime\Native" -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\\ -# (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)) { if ($file.Extension -eq '.pdb') { continue } $destName = if ($file.Name -eq 'RynthCore.App.Avalonia.exe') { 'RynthCore.exe' } else { $file.Name } - Copy-Item $file.FullName "$StagingDir\$destName" -Force + Copy-Item $file.FullName "$CoreStaging\$destName" -Force } # Engine runtime files (into Runtime\, skip .pdb) foreach ($file in (Get-ChildItem "$EnginePublish" -File)) { if ($file.Extension -eq '.pdb') { continue } - Copy-Item $file.FullName "$StagingDir\Runtime\$($file.Name)" -Force + Copy-Item $file.FullName "$CoreStaging\Runtime\$($file.Name)" -Force } # Loader — the DLL the launcher injects (EngineInjectionService.EngineDllName); it @@ -154,7 +189,7 @@ foreach ($file in (Get-ChildItem "$EnginePublish" -File)) { # 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 +Copy-Item $loaderDll "$CoreStaging\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 @@ -167,62 +202,87 @@ if (-not (Test-Path $sehDll)) { throw "SEH trampoline not found at: $sehDll`nBui 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 +Copy-Item $sehDll "$CoreStaging\Runtime\" -Force # Engine Native subfolder if (Test-Path "$EnginePublish\Native") { foreach ($file in (Get-ChildItem "$EnginePublish\Native" -File)) { if ($file.Extension -eq '.pdb') { continue } - Copy-Item $file.FullName "$StagingDir\Runtime\Native\$($file.Name)" -Force + Copy-Item $file.FullName "$CoreStaging\Runtime\Native\$($file.Name)" -Force } } -# 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. +# Loot Editor → \Tools\LootEditor (the launcher/engine look for it there) +Copy-PublishTree $LootEditorPublish "$CoreStaging\Tools\LootEditor" + +# RynthAi plugin DLL → \RynthAi (next to its data dirs; the installer hands the +# path to the launcher via HKA\Software\Rynth\PendingPluginRegistration). $pluginDll = "$PluginPublish\RynthCore.Plugin.RynthAi.dll" if (-not (Test-Path $pluginDll)) { throw "Plugin DLL not found at: $pluginDll" } -Copy-Item $pluginDll "$pluginStagingDir\RynthAi\" -Force +Copy-Item $pluginDll "$SuiteStaging\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 -} +# Monster Editor → \RynthAi\MonsterEditor (RynthAi's dashboard launches it from there) +Copy-PublishTree $MonsterEditorPublish "$SuiteStaging\RynthAi\MonsterEditor" # 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 +Set-Content -Path "$CoreStaging\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" + "$CoreStaging\RynthCore.exe", + "$CoreStaging\RynthCore.App.Avalonia.dll", + "$CoreStaging\RynthCore.App.Avalonia.deps.json", + "$CoreStaging\RynthCore.App.Avalonia.runtimeconfig.json", + "$CoreStaging\Runtime\RynthCore.Loader.dll", + "$CoreStaging\Runtime\RynthCore.Engine.dll", + "$CoreStaging\Runtime\RynthCore.SehTrampoline.dll", + "$CoreStaging\Runtime\minhook.x86.dll", + "$CoreStaging\Runtime\cimgui.dll", + "$CoreStaging\Tools\LootEditor\RynthCore.LootEditor.exe", + "$SuiteStaging\RynthAi\RynthCore.Plugin.RynthAi.dll", + "$SuiteStaging\RynthAi\MonsterEditor\RynthCore.MonsterEditor.exe" ) $missing = @($required | Where-Object { -not (Test-Path $_) }) if ($missing.Count -gt 0) { throw "Staging is missing required files:`n $($missing -join "`n ")" } +# Every assembly the launcher's deps.json lists must be staged next to it — a launcher DLL whose +# deps.json doesn't match is exactly the "Could not load RynthCore.DesktopLog" failure of 2026-10-04. +$depsJson = Get-Content "$CoreStaging\RynthCore.App.Avalonia.deps.json" -Raw | ConvertFrom-Json +$projectLibs = $depsJson.libraries.PSObject.Properties | Where-Object { $_.Value.type -eq 'project' } | ForEach-Object { ($_.Name -split '/')[0] } +$missingLibs = @($projectLibs | Where-Object { -not (Test-Path "$CoreStaging\$_.dll") }) +if ($missingLibs.Count -gt 0) { throw "Launcher deps.json references project assemblies that were not staged:`n $($missingLibs -join "`n ")" } + # Report staged sizes -$engineDll = "$StagingDir\Runtime\RynthCore.Engine.dll" +$engineDll = "$CoreStaging\Runtime\RynthCore.Engine.dll" if (Test-Path $engineDll) { $sizeMb = [math]::Round((Get-Item $engineDll).Length / 1MB, 1) Write-Host " Engine.dll: ${sizeMb} MB" } -$totalMb = [math]::Round((Get-ChildItem "$StagingDir" -Recurse -File | Measure-Object Length -Sum).Sum / 1MB, 1) -Write-Host " Total staged: ${totalMb} MB" +$coreMb = [math]::Round((Get-ChildItem $CoreStaging -Recurse -File | Measure-Object Length -Sum).Sum / 1MB, 1) +$suiteMb = [math]::Round((Get-ChildItem $SuiteStaging -Recurse -File | Measure-Object Length -Sum).Sum / 1MB, 1) +Write-Host " Staged: RynthCore ${coreMb} MB, RynthSuite ${suiteMb} MB" -Write-Host "Staging complete: $StagingDir" -ForegroundColor Green +Write-Host "Staging complete: $StagingRoot" -ForegroundColor Green + +# ── Archive the previous installer when -Version bumps ───────────────────── +# installer\previous-release\last-built-version.txt records the last version built; when a new +# -Version is built, that version's installer is copied to previous-release\ first. +$previousReleaseDir = Join-Path $ScriptDir "previous-release" +$lastVersionFile = Join-Path $previousReleaseDir "last-built-version.txt" +if ($Version) { + New-Item -ItemType Directory -Path $previousReleaseDir -Force | Out-Null + $lastVer = if (Test-Path $lastVersionFile) { (Get-Content $lastVersionFile -Raw).Trim() } else { "" } + if ($lastVer -and $lastVer -ne $Version) { + $prevExe = Join-Path $ScriptDir "Output\RynthCore-Setup-$lastVer.exe" + if (-not (Test-Path $prevExe)) { $prevExe = Join-Path $ScriptDir "Output\RynthCore-Setup.exe" } + if (Test-Path $prevExe) { + $archive = Join-Path $previousReleaseDir "RynthCore-Setup-$lastVer.exe" + Write-Host "Archiving previous installer ($lastVer) -> $archive" -ForegroundColor Cyan + Copy-Item $prevExe $archive -Force + } + } +} # ── Inno Setup ─────────────────────────────────────────────────────────────── # Auto-detect ISCC if not specified: try standard install location then user-local. @@ -252,8 +312,13 @@ $issSource = "$ScriptDir\RynthCore.iss" # Source, staging\) still resolve from the installer\ directory. $issTmp = "$ScriptDir\RynthCore.tmp.iss" $issContent = Get-Content $issSource -Raw +$outputName = "RynthCore-Setup" if ($Version) { + # Versioned .exe avoids Inno error 32 when Output\RynthCore-Setup.exe is open in Explorer or AV. + $outputName = "RynthCore-Setup-$Version" $issContent = $issContent -replace 'AppVersion=0\.0\.0', "AppVersion=$Version" + $issContent = $issContent -replace 'AppVerName=RynthCore \+ RynthSuite 0\.0\.0', "AppVerName=RynthCore + RynthSuite $Version" + $issContent = $issContent -replace 'OutputBaseFilename=RynthCore-Setup', "OutputBaseFilename=$outputName" Write-Host " Version override: $Version" } Set-Content -Path $issTmp -Value $issContent -Encoding UTF8 @@ -265,6 +330,14 @@ try { Remove-Item $issTmp -Force -ErrorAction SilentlyContinue } +$builtInstaller = "$ScriptDir\Output\$outputName.exe" +if ($Version) { + # Canonical name for the launcher updater / docs; best effort if the file is locked. + try { Copy-Item $builtInstaller "$ScriptDir\Output\RynthCore-Setup.exe" -Force } + catch { Write-Warning "Could not refresh Output\RynthCore-Setup.exe (in use?). Primary artifact: $builtInstaller" } + [IO.File]::WriteAllText($lastVersionFile, $Version) +} + Write-Host "" Write-Host "SUCCESS" -ForegroundColor Green -Write-Host "Installer: $ScriptDir\Output\RynthCore-Setup.exe" +Write-Host "Installer: $builtInstaller" diff --git a/installer/RynthCore.iss b/installer/RynthCore.iss index b37744a..023a3ff 100644 --- a/installer/RynthCore.iss +++ b/installer/RynthCore.iss @@ -1,7 +1,16 @@ -; RynthCore + RynthAi Installer -; Build with: Build-Installer.ps1 (requires Inno Setup 6) +; RynthCore + RynthSuite full installer +; Build with: Build-Installer.ps1 (requires Inno Setup 6) — it builds every component from source +; (launcher, engine, loader, RynthAi plugin, Loot Editor, Monster Editor) and stages them under +; installer\staging\core and installer\staging\suite before invoking ISCC on this file. ; Source: https://jrsoftware.org/isdl.php ; +; Install locations are user-defined: +; * RynthCore folder ({app}) — the standard "Select Destination Location" page +; * RynthSuite folder ({code:GetSuiteDir}) — a second folder page right after it +; Both are recorded under HKA\Software\Rynth (CoreDir / SuiteDir); the engine, launcher and plugins +; resolve every path from there (RynthInstallPaths.cs), so neither folder has to be under C:\Games. +; Silent installs: /DIR="" /SUITEDIR="". +; ; NOTE: No ISPP (#define / {#...}) macros are used in this file. ; Build-Installer.ps1 replaces the AppVersion placeholder via text substitution ; before invoking ISCC, so the preprocessor has nothing to expand. @@ -9,13 +18,17 @@ ; APPVERSION_PLACEHOLDER=0.0.0 [Setup] +; Same AppId as every earlier RynthCore / RynthBundle installer, so this upgrades them in place. AppId={{A8B4C2D1-E3F5-4678-9ABC-DEF012345678} AppName=RynthCore +AppVerName=RynthCore + RynthSuite 0.0.0 AppVersion=0.0.0 AppPublisher=RynthCore AppPublisherURL=https://aelrynth.com/rynth.html +UninstallDisplayName=RynthCore + RynthSuite DefaultDirName=C:\Games\RynthCore DisableDirPage=no +UsePreviousAppDir=yes DefaultGroupName=RynthCore DisableProgramGroupPage=yes OutputDir=Output @@ -28,45 +41,89 @@ WizardStyle=modern ; the chosen install folder requires it (e.g. C:\Games\). PrivilegesRequired=lowest PrivilegesRequiredOverridesAllowed=dialog -; 32-bit app; works on 32/64-bit Windows -ArchitecturesAllowed=x86 x64 arm64 +; Close a running launcher / editors before replacing their files. +CloseApplications=yes +; 32-bit app; works on 32/64-bit Windows (HKA registry writes land in the 32-bit view, +; which is exactly where RynthInstallPaths reads HKLM from). +ArchitecturesAllowed=x86compatible ArchitecturesInstallIn64BitMode= [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" +[Types] +Name: "full"; Description: "Full install (RynthCore + RynthSuite)" +Name: "core"; Description: "RynthCore only" +Name: "custom"; Description: "Custom"; Flags: iscustom + +[Components] +Name: "core"; Description: "RynthCore launcher, engine and Loot Editor"; Types: full core custom; Flags: fixed +Name: "rynthai"; Description: "RynthSuite: RynthAi plugin (installed and registered with the launcher)"; Types: full +Name: "monstereditor"; Description: "RynthSuite: Monster Editor"; Types: full + [Tasks] Name: desktopicon; Description: "Create a &desktop shortcut"; GroupDescription: "Additional icons:" -; Program files +; Files left by older layouts (the 0.4.x RynthBundle put a framework-dependent launcher, the engine +; and plugins straight into {app}). Mixing those with a newer launcher is what broke 2026-10-04's +; reinstall (RynthCore.App.Avalonia.dll from 0.4.7 + a newer deps.json → missing DesktopLog). +; Only loose top-level binaries/metadata are removed; every file the new build needs is copied back +; by [Files] right after. User data (Logs, AcClient, NavData, DecalBridge, ...) is never touched. +[InstallDelete] +Type: files; Name: "{app}\*.dll" +Type: files; Name: "{app}\*.json" +Type: files; Name: "{app}\*.pdb" +Type: files; Name: "{app}\*.exp" +Type: files; Name: "{app}\*.lib" +Type: files; Name: "{app}\*.previous" +Type: files; Name: "{app}\RynthCore.App.Avalonia.exe" +Type: files; Name: "{app}\RynthCore-Prerequisites.txt" +Type: files; Name: "{app}\Runtime\*.dll" +Type: files; Name: "{app}\Runtime\*.json" +Type: files; Name: "{app}\Runtime\*.pdb" +Type: files; Name: "{app}\Runtime\RynthCore.Injector.exe" +Type: filesandordirs; Name: "{app}\Runtime\Plugins" + [Files] -; Launcher + engine runtime + Loot Editor go to {app} (default C:\Games\RynthCore\) -Source: "staging\app\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +; RynthCore: launcher, Runtime\ (engine, loader, native deps), Tools\LootEditor, release.txt +Source: "staging\core\*"; DestDir: "{app}"; Components: core; 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 +; RynthSuite: the RynthAi plugin lives next to its data folders in the chosen Suite folder. +Source: "staging\suite\RynthAi\RynthCore.Plugin.RynthAi.dll"; DestDir: "{code:GetSuiteDir}\RynthAi"; Components: rynthai; Flags: ignoreversion +; Monster Editor: RynthAi's dashboard launches it from \MonsterEditor\. +Source: "staging\suite\RynthAi\MonsterEditor\*"; DestDir: "{code:GetSuiteDir}\RynthAi\MonsterEditor"; Components: monstereditor; Flags: ignoreversion recursesubdirs createallsubdirs -; Data directories (created once; never removed on uninstall) +; RynthAi data directories (created once; never removed on uninstall — they hold user profiles) [Dirs] -Name: "C:\Games\RynthSuite\RynthAi"; Flags: uninsneveruninstall -Name: "C:\Games\RynthSuite\RynthAi\NavProfiles"; Flags: uninsneveruninstall -Name: "C:\Games\RynthSuite\RynthAi\LootProfiles"; Flags: uninsneveruninstall -Name: "C:\Games\RynthSuite\RynthAi\MetaFiles"; Flags: uninsneveruninstall -Name: "C:\Games\RynthSuite\RynthAi\MetaProfiles"; Flags: uninsneveruninstall -Name: "C:\Games\RynthSuite\RynthAi\SettingsProfiles"; Flags: uninsneveruninstall -Name: "C:\Games\RynthSuite\RynthAi\SettingsProfiles\ACEmulator"; Flags: uninsneveruninstall -Name: "C:\Games\RynthSuite\RynthAi\LuaScripts"; Flags: uninsneveruninstall -Name: "C:\Games\RynthSuite\RynthAi\Logs"; Flags: uninsneveruninstall -Name: "C:\Games\RynthSuite\RynthAi\pvars"; Flags: uninsneveruninstall -Name: "C:\Games\RynthSuite\RynthAi\ItemGiver"; Flags: uninsneveruninstall +Name: "{code:GetSuiteDir}\RynthAi"; Components: rynthai; Flags: uninsneveruninstall +Name: "{code:GetSuiteDir}\RynthAi\NavProfiles"; Components: rynthai; Flags: uninsneveruninstall +Name: "{code:GetSuiteDir}\RynthAi\LootProfiles"; Components: rynthai; Flags: uninsneveruninstall +Name: "{code:GetSuiteDir}\RynthAi\MetaFiles"; Components: rynthai; Flags: uninsneveruninstall +Name: "{code:GetSuiteDir}\RynthAi\MetaProfiles"; Components: rynthai; Flags: uninsneveruninstall +Name: "{code:GetSuiteDir}\RynthAi\SettingsProfiles"; Components: rynthai; Flags: uninsneveruninstall +Name: "{code:GetSuiteDir}\RynthAi\SettingsProfiles\ACEmulator"; Components: rynthai; Flags: uninsneveruninstall +Name: "{code:GetSuiteDir}\RynthAi\MonsterProfiles"; Components: rynthai; Flags: uninsneveruninstall +Name: "{code:GetSuiteDir}\RynthAi\LuaScripts"; Components: rynthai; Flags: uninsneveruninstall +Name: "{code:GetSuiteDir}\RynthAi\Logs"; Components: rynthai; Flags: uninsneveruninstall +Name: "{code:GetSuiteDir}\RynthAi\pvars"; Components: rynthai; Flags: uninsneveruninstall +Name: "{code:GetSuiteDir}\RynthAi\ItemGiver"; Components: rynthai; Flags: uninsneveruninstall +Name: "{code:GetSuiteDir}\RynthAi\AutoVendor"; Components: rynthai; Flags: uninsneveruninstall + +; Install locations for the engine / launcher / plugins (see RynthInstallPaths.cs), plus a one-shot +; hand-off the launcher consumes on next start to add the plugin to its Plugins list. +; HKA = HKCU for a per-user install, HKLM for an all-users (elevated) install. +[Registry] +Root: HKA; Subkey: "Software\Rynth"; ValueType: string; ValueName: "CoreDir"; ValueData: "{app}"; Flags: uninsdeletevalue uninsdeletekeyifempty +Root: HKA; Subkey: "Software\Rynth"; ValueType: string; ValueName: "SuiteDir"; ValueData: "{code:GetSuiteDir}"; Flags: uninsdeletevalue uninsdeletekeyifempty +Root: HKA; Subkey: "Software\Rynth"; ValueType: string; ValueName: "PendingPluginRegistration"; ValueData: "{code:GetSuiteDir}\RynthAi\RynthCore.Plugin.RynthAi.dll"; Components: rynthai; Flags: uninsdeletevalue ; Shortcuts [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}\Monster Editor"; Filename: "{code:GetSuiteDir}\RynthAi\MonsterEditor\RynthCore.MonsterEditor.exe"; WorkingDir: "{code:GetSuiteDir}\RynthAi\MonsterEditor"; Components: monstereditor; Comment: "Edit RynthAi monster profiles" +Name: "{group}\RynthSuite Folder"; Filename: "{code:GetSuiteDir}"; Components: rynthai Name: "{group}\Uninstall RynthCore"; Filename: "{uninstallexe}" ; Optional Desktop shortcut (created only when the desktopicon task is checked) @@ -80,6 +137,15 @@ Filename: "{app}\RynthCore.exe"; WorkingDir: "{app}"; Description: "Launch Rynth Filename: "{app}\RynthCore.exe"; WorkingDir: "{app}"; Flags: nowait runasoriginaluser; Check: CmdLineParamExists('/RELAUNCH') [Code] +const + DefaultSuiteDir = 'C:\Games\RynthSuite'; + +var + SuiteDirPage: TInputDirWizardPage; + { True once the user (or /SUITEDIR / a previous install) chose the Suite folder explicitly; + until then it follows the RynthCore folder as a sibling "RynthSuite" folder. } + SuiteDirPinned: Boolean; + function CmdLineParamExists(const Value: string): Boolean; var I: Integer; @@ -92,3 +158,117 @@ begin Exit; end; end; + +{ Returns the value of a /NAME=value command-line switch, or '' when absent. } +function CmdLineParamValue(const Name: string): string; +var + I: Integer; + Prefix: string; +begin + Result := ''; + Prefix := '/' + Name + '='; + for I := 1 to ParamCount do + if CompareText(Copy(ParamStr(I), 1, Length(Prefix)), Prefix) = 0 then + begin + Result := RemoveQuotes(Copy(ParamStr(I), Length(Prefix) + 1, MaxInt)); + Exit; + end; +end; + +{ Suite folder recorded by an earlier install (HKCU first, then HKLM), or ''. } +function RegisteredSuiteDir: string; +begin + Result := ''; + if not RegQueryStringValue(HKCU, 'Software\Rynth', 'SuiteDir', Result) then + if not RegQueryStringValue(HKLM, 'Software\Rynth', 'SuiteDir', Result) then + Result := ''; +end; + +{ Default Suite folder for a given RynthCore folder: its sibling "RynthSuite". } +function SiblingSuiteDir(const CoreDir: string): string; +begin + Result := AddBackslash(ExtractFileDir(RemoveBackslashUnlessRoot(CoreDir))) + 'RynthSuite'; +end; + +// {code:GetSuiteDir}: the chosen RynthSuite folder, without a trailing backslash. +function GetSuiteDir(Param: string): string; +begin + if SuiteDirPage = nil then + Result := DefaultSuiteDir + else if WizardSilent and not SuiteDirPinned then + { Silent installs never run NextButtonClick: follow /DIR= with a sibling RynthSuite folder. } + Result := SiblingSuiteDir(WizardDirValue) + else + Result := RemoveBackslashUnlessRoot(Trim(SuiteDirPage.Values[0])); +end; + +procedure InitializeWizard; +var + Initial: string; +begin + { After the Components page, so ShouldSkipPage knows whether any Suite component was picked. } + SuiteDirPage := CreateInputDirPage(wpSelectComponents, + 'Select RynthSuite Location', + 'Where should the RynthSuite plugins and their data be installed?', + 'RynthAi and the Monster Editor will be installed into the RynthSuite folder below, and your ' + + 'profiles (nav, loot, meta, settings) are kept there. To continue, click Next. ' + + 'If you would like to select a different folder, click Browse.', + False, 'RynthSuite'); + SuiteDirPage.Add(''); + + { Priority: /SUITEDIR= → previous install of this setup → registry → C:\Games\RynthSuite. } + Initial := CmdLineParamValue('SUITEDIR'); + if Initial = '' then Initial := GetPreviousData('SuiteDir', ''); + if Initial = '' then Initial := RegisteredSuiteDir; + SuiteDirPinned := Initial <> ''; + if Initial = '' then Initial := DefaultSuiteDir; + SuiteDirPage.Values[0] := Initial; +end; + +procedure RegisterPreviousData(PreviousDataKey: Integer); +begin + SetPreviousData(PreviousDataKey, 'SuiteDir', GetSuiteDir('')); +end; + +function ShouldSkipPage(PageID: Integer): Boolean; +begin + { No Suite components selected → no Suite folder to choose. } + Result := (SuiteDirPage <> nil) and (PageID = SuiteDirPage.ID) + and not WizardIsComponentSelected('rynthai') + and not WizardIsComponentSelected('monstereditor'); +end; + +function NextButtonClick(CurPageID: Integer): Boolean; +var + Dir: string; +begin + Result := True; + + { Leaving the RynthCore folder page: keep an un-pinned Suite folder beside the chosen Core folder. } + if (CurPageID = wpSelectDir) and not SuiteDirPinned then + SuiteDirPage.Values[0] := SiblingSuiteDir(WizardDirValue); + + if (SuiteDirPage <> nil) and (CurPageID = SuiteDirPage.ID) then + begin + Dir := GetSuiteDir(''); + { Require an absolute local or UNC path (e.g. D:\Games\RynthSuite or \\server\share\RynthSuite). } + if (Length(Dir) < 3) or not ((Copy(Dir, 2, 2) = ':\') or (Copy(Dir, 1, 2) = '\\')) then + begin + MsgBox('Please choose a full folder path for RynthSuite, for example D:\Games\RynthSuite.', mbError, MB_OK); + Result := False; + Exit; + end; + SuiteDirPinned := True; + end; +end; + +function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, + MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String; +begin + Result := MemoDirInfo + NewLine; + if WizardIsComponentSelected('rynthai') or WizardIsComponentSelected('monstereditor') then + Result := Result + 'RynthSuite location:' + NewLine + Space + GetSuiteDir('') + NewLine; + Result := Result + NewLine + MemoComponentsInfo; + if MemoTasksInfo <> '' then + Result := Result + NewLine + MemoTasksInfo; +end; diff --git a/installer/previous-release/last-built-version.txt b/installer/previous-release/last-built-version.txt new file mode 100644 index 0000000..7dddf66 --- /dev/null +++ b/installer/previous-release/last-built-version.txt @@ -0,0 +1 @@ +2026.10.4.2 \ No newline at end of file diff --git a/src/RynthCore.App.Avalonia/LauncherDiag.cs b/src/RynthCore.App.Avalonia/LauncherDiag.cs index a73faf0..494e6d3 100644 --- a/src/RynthCore.App.Avalonia/LauncherDiag.cs +++ b/src/RynthCore.App.Avalonia/LauncherDiag.cs @@ -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; /// 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(); diff --git a/src/RynthCore.App.Avalonia/MainWindow.axaml.cs b/src/RynthCore.App.Avalonia/MainWindow.axaml.cs index e60f08b..beee5fc 100644 --- a/src/RynthCore.App.Avalonia/MainWindow.axaml.cs +++ b/src/RynthCore.App.Avalonia/MainWindow.axaml.cs @@ -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)."); } + /// + /// 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 + /// Software\Rynth\PendingPluginRegistration (';'-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:\Games\RynthSuite\... 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). + /// + 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(); + + // 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 { diff --git a/src/RynthCore.App.Avalonia/RynthCore.App.Avalonia.csproj b/src/RynthCore.App.Avalonia/RynthCore.App.Avalonia.csproj index ea075ac..454d760 100644 --- a/src/RynthCore.App.Avalonia/RynthCore.App.Avalonia.csproj +++ b/src/RynthCore.App.Avalonia/RynthCore.App.Avalonia.csproj @@ -48,4 +48,9 @@ + + + + + diff --git a/src/RynthCore.App/AppSettings.cs b/src/RynthCore.App/AppSettings.cs index ac7e180..1e108f7 100644 --- a/src/RynthCore.App/AppSettings.cs +++ b/src/RynthCore.App/AppSettings.cs @@ -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 DisabledPluginDllPaths { get; set; } = []; + + /// + /// Last installer plugin hand-off (registry Software\Rynth\PendingPluginRegistration) + /// 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. + /// + public string? AppliedInstallerPluginRegistration { get; set; } + public List ServerProfiles { get; set; } = []; public List AccountProfiles { get; set; } = []; diff --git a/src/RynthCore.App/RynthInstallPaths.cs b/src/RynthCore.App/RynthInstallPaths.cs new file mode 100644 index 0000000..ddf0554 --- /dev/null +++ b/src/RynthCore.App/RynthInstallPaths.cs @@ -0,0 +1,128 @@ +using System; +using System.IO; +using System.Runtime.InteropServices; + +namespace RynthCore.Install; + +/// +/// Resolves where RynthCore and RynthSuite are installed. The installer lets the user pick +/// both folders and records them under Software\Rynth (HKCU for a per-user install, +/// HKLM for an all-users install), so nothing may assume C:\Games\... any more. +/// +/// Resolution order per folder: environment override (RYNTHCORE_DIR / +/// RYNTHSUITE_DIR, for dev setups) → HKCU → HKLM (32-bit view, where the 32-bit +/// installer writes) → the historical default under C:\Games. Results are cached +/// for the life of the process. +/// +/// Linked into every RynthCore project (Engine, Loader, Injector, launcher, StatusAgent); +/// RynthSuite keeps an identical copy in Shared/RynthInstallPaths.cs — change both together. +/// Registry access is a direct RegGetValueW P/Invoke so it works under NativeAOT and trimming +/// without pulling in Microsoft.Win32.Registry. +/// +internal static class RynthInstallPaths +{ + /// Default RynthCore folder (pre-2026.10.4.2 installs always used this). + public const string DefaultCoreDir = @"C:\Games\RynthCore"; + + /// Default RynthSuite folder (pre-2026.10.4.2 installs always used this). + public const string DefaultSuiteDir = @"C:\Games\RynthSuite"; + + /// Registry key (under HKCU or HKLM) written by the installer. + public const string RegistryKey = @"Software\Rynth"; + + private static string? _coreDir; + private static string? _suiteDir; + + /// RynthCore install folder (launcher, Runtime\, Logs\, Tools\). + public static string CoreDir => _coreDir ??= Resolve("RYNTHCORE_DIR", "CoreDir", DefaultCoreDir); + + /// RynthSuite folder (plugins and their data, e.g. RynthAi\). + public static string SuiteDir => _suiteDir ??= Resolve("RYNTHSUITE_DIR", "SuiteDir", DefaultSuiteDir); + + /// Unified RynthCore log folder (<CoreDir>\Logs). + public static string CoreLogsDir => Path.Combine(CoreDir, "Logs"); + + /// RynthAi plugin home and data root (<SuiteDir>\RynthAi). + public static string RynthAiDir => Path.Combine(SuiteDir, "RynthAi"); + + /// Reads a string value from Software\Rynth (HKCU first, then HKLM 32-bit view); null when absent. + public static string? ReadSetting(string valueName) + => ReadRegistryString(HKEY_CURRENT_USER, valueName, 0) + ?? ReadRegistryString(HKEY_LOCAL_MACHINE, valueName, RRF_SUBKEY_WOW6432KEY); + + /// Deletes a value from HKCU Software\Rynth (used for one-shot installer hand-offs). Best effort. + 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; + } + + /// Accepts only absolute paths; trims whitespace, quotes and trailing separators. + 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; + } + } +} diff --git a/src/RynthCore.Engine/EntryPoint.cs b/src/RynthCore.Engine/EntryPoint.cs index e836237..9b13368 100644 --- a/src/RynthCore.Engine/EntryPoint.cs +++ b/src/RynthCore.Engine/EntryPoint.cs @@ -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 \Logs (installer-chosen; + // resolved here on the init worker, never under the loader lock). LogPaths.EnsureLogDirectory(); if (_initCount <= 1) { diff --git a/src/RynthCore.Engine/ImGui/EngineFrameController.cs b/src/RynthCore.Engine/ImGui/EngineFrameController.cs index 35faa73..9fd4f18 100644 --- a/src/RynthCore.Engine/ImGui/EngineFrameController.cs +++ b/src/RynthCore.Engine/ImGui/EngineFrameController.cs @@ -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}"); diff --git a/src/RynthCore.Engine/ImGui/ImGuiController.cs b/src/RynthCore.Engine/ImGui/ImGuiController.cs index 837a3f6..fc67460 100644 --- a/src/RynthCore.Engine/ImGui/ImGuiController.cs +++ b/src/RynthCore.Engine/ImGui/ImGuiController.cs @@ -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}"); diff --git a/src/RynthCore.Engine/LogPaths.cs b/src/RynthCore.Engine/LogPaths.cs index 8cc3008..91095fb 100644 --- a/src/RynthCore.Engine/LogPaths.cs +++ b/src/RynthCore.Engine/LogPaths.cs @@ -21,13 +21,15 @@ using System; using System.IO; +using RynthCore.Install; namespace RynthCore.Engine; internal static class LogPaths { /// Unified log directory for all RynthCore components. - 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; /// Shared launch/orchestration log (injector + launcher + per-engine session pointer). internal const string SharedLogFileName = "RynthCore.log"; diff --git a/src/RynthCore.Engine/RynthCore.Engine.csproj b/src/RynthCore.Engine/RynthCore.Engine.csproj index 08d3270..d412cd7 100644 --- a/src/RynthCore.Engine/RynthCore.Engine.csproj +++ b/src/RynthCore.Engine/RynthCore.Engine.csproj @@ -119,4 +119,9 @@ SkipUnchangedFiles="true" /> + + + + + diff --git a/src/RynthCore.Engine/UI/Panels/MetaPanel.cs b/src/RynthCore.Engine/UI/Panels/MetaPanel.cs index 73109a0..2f8fc04 100644 --- a/src/RynthCore.Engine/UI/Panels/MetaPanel.cs +++ b/src/RynthCore.Engine/UI/Panels/MetaPanel.cs @@ -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; diff --git a/src/RynthCore.Injector/LaunchCommand.cs b/src/RynthCore.Injector/LaunchCommand.cs index 1e51f57..74ca2e1 100644 --- a/src/RynthCore.Injector/LaunchCommand.cs +++ b/src/RynthCore.Injector/LaunchCommand.cs @@ -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)"; diff --git a/src/RynthCore.Injector/Program.cs b/src/RynthCore.Injector/Program.cs index 0294939..7203fd7 100644 --- a/src/RynthCore.Injector/Program.cs +++ b/src/RynthCore.Injector/Program.cs @@ -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) diff --git a/src/RynthCore.Injector/RynthCore.Injector.csproj b/src/RynthCore.Injector/RynthCore.Injector.csproj index 2bb48f3..ecf5c14 100644 --- a/src/RynthCore.Injector/RynthCore.Injector.csproj +++ b/src/RynthCore.Injector/RynthCore.Injector.csproj @@ -10,4 +10,9 @@ enable + + + + + diff --git a/src/RynthCore.Loader/EntryPoint.cs b/src/RynthCore.Loader/EntryPoint.cs index ba9ca0e..1db01ed 100644 --- a/src/RynthCore.Loader/EntryPoint.cs +++ b/src/RynthCore.Loader/EntryPoint.cs @@ -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"; /// /// Subdirectory beside the loader where reload-generation copies of the diff --git a/src/RynthCore.Loader/RynthCore.Loader.csproj b/src/RynthCore.Loader/RynthCore.Loader.csproj index 2c8e0eb..adc15cf 100644 --- a/src/RynthCore.Loader/RynthCore.Loader.csproj +++ b/src/RynthCore.Loader/RynthCore.Loader.csproj @@ -26,4 +26,9 @@ false + + + + + diff --git a/src/RynthCore.StatusAgent/AgentConfig.cs b/src/RynthCore.StatusAgent/AgentConfig.cs index 97b4b9d..d48e310 100644 --- a/src/RynthCore.StatusAgent/AgentConfig.cs +++ b/src/RynthCore.StatusAgent/AgentConfig.cs @@ -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; /// Directory holding the engine's per-client status files. - [JsonPropertyName("StatusDirectory")] public string StatusDirectory { get; set; } = @"C:\Games\RynthCore\Logs\status"; + [JsonPropertyName("StatusDirectory")] public string StatusDirectory { get; set; } = Path.Combine(RynthInstallPaths.CoreLogsDir, "status"); /// Directory holding per-client RynthCore.<pid>.log files (heartbeat fallback). - [JsonPropertyName("LogDirectory")] public string LogDirectory { get; set; } = @"C:\Games\RynthCore\Logs"; + [JsonPropertyName("LogDirectory")] public string LogDirectory { get; set; } = RynthInstallPaths.CoreLogsDir; /// 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 /// 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. - [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"); /// 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. - [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), diff --git a/src/RynthCore.StatusAgent/RynthCore.StatusAgent.csproj b/src/RynthCore.StatusAgent/RynthCore.StatusAgent.csproj index 31cf6d9..49bc151 100644 --- a/src/RynthCore.StatusAgent/RynthCore.StatusAgent.csproj +++ b/src/RynthCore.StatusAgent/RynthCore.StatusAgent.csproj @@ -30,4 +30,9 @@ + + + + +