merge: bring feat/full-installer into SK-local

Integrates the aelrynth snapshot port (main), the full installer, the
tmds.dbus advisory fix and all launcher/engine work into SK-local.

Conflict resolutions:
- Logging: keep SK-local's level-based logging (EngineLogLevel, ShouldLog,
  engine.json LoggingLevel) and adopt full-installer's tagged WRN/ERR,
  LastIssue and per-PID logs; the Desktop rolling log is superseded.
- Launcher: keep the inject-all-sessions toggle and Logging level combo
  alongside the new stagger/crash-relaunch/stuck-client options; the
  LoggingLevel is now written through EngineJsonStore.SetString.
- PluginManager: keep SK-local's basename/canonical-path de-duplication,
  drop the default-directory scan (opt-in via PluginPaths).
- Injector, installer, CI workflow, BUILD.md: take full-installer.
- Solution: add DesktopLog + Loader, drop the stale Plugins/RynthAi stub.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
BlankenshipG 2026-10-04 16:16:24 -04:00
commit 36ffa94252
256 changed files with 62130 additions and 3382 deletions

202
BUILD.md
View file

@ -4,59 +4,78 @@ RynthCore is the injection framework. RynthSuite (separate repo) contains the pl
## Prerequisites
- Windows 10/11
- .NET 9 SDK (x86)
- Visual Studio 2022 Build Tools with the .NET desktop and C++ desktop workloads (required by the NativeAOT ILC linker)
- Windows 10 or 11
- **.NET 10 SDK (x86)**
- Visual Studio 2022 Build Tools with the **.NET desktop** and **C++ desktop** workloads (required by the NativeAOT ILC linker)
- Asheron's Call client installed
## Projects
| Project | Type | Output |
|---------|------|--------|
| `src/RynthCore.Engine` | NativeAOT x86 DLL | Injected into acclient.exe — hooks D3D9 EndScene, hosts ImGui overlay |
| `src/RynthCore.Injector` | Console app | Injects the engine DLL via LoadLibrary + CreateRemoteThread |
| `src/RynthCore.App.Avalonia` | Avalonia desktop app | Desktop launcher — server/account profiles, plugin management, launches + injects |
| `src/RynthCore.PluginSdk` | Class library | Public host API surface for plugins |
| `src/RynthCore.PluginCore` | Class library | Runtime helpers for plugin bootstrap/lifecycle |
| `src/RynthCore.App` | Shared source | Model and service files linked by both the Avalonia app and the Engine (not a standalone project) |
| `src/RynthCore.Loader` | NativeAOT x86 DLL | Injected into acclient.exe — owns `RynthCoreInit` export and hot-loads the Engine. |
| `src/RynthCore.Engine` | NativeAOT x86 DLL | The runtime engine — pattern-scans `acclient.exe` hooks, hosts D3D9/ImGui overlay, runs plugins. |
| `src/RynthCore.Injector` | x86 console | Standalone CLI injector via `LoadLibrary` + `CreateRemoteThread`. The launcher embeds the same `EngineInjectionService` directly. |
| `src/RynthCore.App.Avalonia` | Avalonia desktop app | The launcher — server/account profiles, plugin management, suspended-launch + early-inject. |
| `src/RynthCore.PluginSdk` | Class library | Public host API surface for plugins. |
| `src/RynthCore.PluginCore` | Class library | `RynthPluginBase` + lifecycle dispatch helpers. |
| `src/RynthCore.App` | Shared source | Service classes linked into both Engine and Avalonia launcher (not a standalone build target). |
All projects target **`net10.0-windows`**. NativeAOT projects (Loader, Engine, plugins) are `x86` only with `RuntimeIdentifier=win-x86` and `PublishAot=true`.
## Publish Commands
### Launcher (Avalonia)
### Whole solution
```bash
cd C:\Projects\RynthCore\src\RynthCore.App.Avalonia
dotnet build -c Release
```powershell
dotnet build .\RynthCore.sln -c Release
```
Output: `bin\Release\net9.0-windows7.0\RynthCore.App.Avalonia.dll`
This compiles every project including the Loader (which is now in the .sln). Note: `dotnet build` is enough for the launcher and SDK projects, but **NativeAOT projects require `dotnet publish`** to actually produce the native DLL with exports — see below.
### Engine (NativeAOT — slow first build, ~2 min)
### Loader (NativeAOT x86 — small, fast)
```powershell
dotnet publish .\src\RynthCore.Loader\RynthCore.Loader.csproj -c Release
```
Output: `src\RynthCore.Loader\bin\Release\net10.0-windows\win-x86\publish\RynthCore.Loader.dll`
### Engine (NativeAOT x86 — slow first build, ~2 min)
Requires `vswhere.exe` on PATH. If the build fails with `'vswhere.exe' is not recognized`, add the VS Installer directory:
```bash
set PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio\Installer
```powershell
$env:PATH += ";C:\Program Files (x86)\Microsoft Visual Studio\Installer"
```
```bash
cd C:\Projects\RynthCore\src\RynthCore.Engine
dotnet publish -c Release
```powershell
dotnet publish .\src\RynthCore.Engine\RynthCore.Engine.csproj -c Release
```
Output: `bin\Release\net9.0-windows\win-x86\publish\RynthCore.Engine.dll` (~26 MB)
Output: `src\RynthCore.Engine\bin\Release\net10.0-windows\win-x86\publish\RynthCore.Engine.dll` (~26 MB)
### Launcher (Avalonia)
```powershell
dotnet build .\src\RynthCore.App.Avalonia\RynthCore.App.Avalonia.csproj -c Release
```
Output: `src\RynthCore.App.Avalonia\bin\Release\net10.0-windows\RynthCore.App.Avalonia.dll`
### RynthAi Plugin (NativeAOT — separate repo)
Always clean first — incremental builds can silently skip NativeAOT and produce a stale DLL.
Always clean first — incremental NativeAOT builds can silently skip recompilation and produce a stale DLL.
```bash
```powershell
cd C:\Projects\RynthSuite\Plugins\RynthCore.Plugin.RynthAi
rmdir /s /q obj\Release bin\Release 2>nul
Remove-Item -Recurse -Force obj\Release, bin\Release -ErrorAction SilentlyContinue
dotnet publish -c Release
```
Output: `bin\Release\net9.0-windows\win-x86\publish\RynthCore.Plugin.RynthAi.dll` (~7 MB)
Output: `bin\Release\net10.0-windows\win-x86\publish\RynthCore.Plugin.RynthAi.dll` (~7 MB)
The plugin's MSBuild target also copies the published DLL into the engine's `bin\...\Plugins\` folder so a freshly built engine picks it up automatically.
## Deploy
@ -64,82 +83,97 @@ Output: `bin\Release\net9.0-windows\win-x86\publish\RynthCore.Plugin.RynthAi.dll
```
C:\Games\RynthCore\
├── RynthCore.exe ← Launcher (renamed from RynthCore.App.Avalonia.exe)
├── RynthCore.App.Avalonia.dll ← Launcher assembly
├── RynthCore.exe ← Launcher (renamed from RynthCore.App.Avalonia.exe)
├── RynthCore.App.Avalonia.dll ← Launcher assembly
├── RynthCore.App.Avalonia.deps.json
├── RynthCore.App.Avalonia.runtimeconfig.json
├── Avalonia.*.dll ← Avalonia framework DLLs
├── Avalonia.*.dll ← Avalonia framework DLLs
└── Runtime\
├── RynthCore.Engine.dll ← Engine (NativeAOT x86)
├── minhook.x86.dll ← MinHook (x86), preloaded by EntryPoint
├── cimgui.dll ← ImGui C bindings (x86, docking branch)
├── RynthCore.Loader.dll ← Loader (NativeAOT x86) — injection target
├── RynthCore.Engine.dll ← Engine (NativeAOT x86)
├── minhook.x86.dll ← MinHook (x86), preloaded by EntryPoint
├── cimgui.dll ← ImGui C bindings (x86, docking branch)
└── Plugins\
└── *.dll ← Plugin DLLs (built-in directory)
└── *.dll ← Built-in plugin directory
C:\Games\RynthSuite\RynthAi\
├── RynthCore.Plugin.RynthAi.dll ← RynthAi plugin (recommended deploy location)
├── NavProfiles\ ← Navigation profiles
├── LootProfiles\ ← Loot profiles
└── Metas\ ← Meta files
├── RynthCore.Plugin.RynthAi.dll ← RynthAi plugin (recommended deploy location)
├── NavProfiles\ ← Navigation profiles
├── LootProfiles\ ← Loot profiles
└── Metas\ ← Meta files
```
The injector's saved-path resolver prefers `Runtime\RynthCore.Loader.dll`. It falls back to `Runtime\RynthCore.Engine.dll` for legacy direct-load setups, and walks parent directories and sibling layouts (`Runtime\Engine\`, `Runtime\Native\`, etc.) so manual layouts continue to work.
### Deploy Launcher
The launcher can stay open while you replace its DLL.
```bash
copy src\RynthCore.App.Avalonia\bin\Release\net9.0-windows7.0\RynthCore.App.Avalonia.dll C:\Games\RynthCore\
copy src\RynthCore.App.Avalonia\bin\Release\net9.0-windows7.0\RynthCore.App.Avalonia.deps.json C:\Games\RynthCore\
```powershell
copy src\RynthCore.App.Avalonia\bin\Release\net10.0-windows\RynthCore.App.Avalonia.dll C:\Games\RynthCore\
copy src\RynthCore.App.Avalonia\bin\Release\net10.0-windows\RynthCore.App.Avalonia.deps.json C:\Games\RynthCore\
```
Restart the launcher after deploying.
### Deploy Engine
### Deploy Loader + Engine
**AC must be closed** — the running client holds a file lock on the engine DLL.
**AC must be closed** — the running client holds a file lock on the Loader and Engine DLLs.
```bash
copy src\RynthCore.Engine\bin\Release\net9.0-windows\win-x86\publish\RynthCore.Engine.dll C:\Games\RynthCore\Runtime\
```powershell
copy src\RynthCore.Loader\bin\Release\net10.0-windows\win-x86\publish\RynthCore.Loader.dll C:\Games\RynthCore\Runtime\
copy src\RynthCore.Engine\bin\Release\net10.0-windows\win-x86\publish\RynthCore.Engine.dll C:\Games\RynthCore\Runtime\
```
If you only changed Engine source, you can deploy just `RynthCore.Engine.dll` and rely on the Loader's hot-reload to swap it in (click **RL** on the overlay bar with AC running).
### Deploy RynthAi Plugin
**AC can stay open** — plugins are shadow-copied at load time, so the file is not locked.
The recommended deploy location is `C:\Games\RynthSuite\RynthAi\` — alongside the plugin's data files. Add this path in the launcher's **Plugins** tab. Paths are persisted to `%AppData%\RynthCore\engine.json`.
**Plugin discovery is opt-in:** the engine no longer auto-scans `Runtime\Plugins\` for DLLs. Plugins load only from paths the user has added via the launcher's **Plugins** tab → "Add Plugin DLL". Those paths are persisted to `%AppData%\RynthCore\engine.json` as `PluginPaths` and read by the engine on each (re)init.
```bash
copy C:\Projects\RynthSuite\Plugins\RynthCore.Plugin.RynthAi\bin\Release\net9.0-windows\win-x86\publish\RynthCore.Plugin.RynthAi.dll C:\Games\RynthSuite\RynthAi\
Deploy the plugin DLL to its canonical home and add the full path in the launcher:
```
C:\Games\RynthSuite\RynthAi\
├── RynthCore.Plugin.RynthAi.dll ← add this path in launcher's Plugins tab
├── NavProfiles\
├── LootProfiles\
└── Metas\
```
Alternatively, deploy to the engine's built-in plugin directory:
```bash
copy ... C:\Games\RynthCore\Runtime\Plugins\
```powershell
copy C:\Projects\RynthSuite\Plugins\RynthCore.Plugin.RynthAi\bin\Release\net10.0-windows\win-x86\publish\RynthCore.Plugin.RynthAi.dll C:\Games\RynthSuite\RynthAi\
```
After deploying a plugin with AC running, click **RL** on the RynthCore overlay bar to hot-reload.
After deploying the DLL:
1. Open the RynthCore launcher
2. **Plugins** tab → **Add Plugin DLL** → select `C:\Games\RynthSuite\RynthAi\RynthCore.Plugin.RynthAi.dll`
3. Launch AC (cold start) — the engine picks up the new path on init.
If AC is already running, click **RL** on the RynthCore overlay bar to hot-reload the engine; it re-reads `engine.json` and loads the newly-added plugin path.
## Verify
| File | Expected Size | If Wrong |
|------|--------------|----------|
| `Runtime\RynthCore.Engine.dll` | ~26 MB | NativeAOT didn't run — check for `Generating native code` in build output |
| `RynthSuite\RynthAi\RynthCore.Plugin.RynthAi.dll` | ~7 MB | If ~1 MB, you built the stale stub at `C:\Projects\RynthCore\Plugins\` instead of `C:\Projects\RynthSuite\Plugins\` |
| `Runtime\RynthCore.Loader.dll` | small (~1–2 MB) | NativeAOT didn't run — check for `Generating native code` in build output |
| `Runtime\RynthCore.Engine.dll` | ~26 MB | NativeAOT didn't run — same diagnosis |
| `RynthSuite\RynthAi\RynthCore.Plugin.RynthAi.dll` | ~7 MB | Built `dotnet build` instead of `dotnet publish` |
| `Runtime\cimgui.dll` | ~1.5 MB | Must match ImGui.NET 1.91.6.1 |
To confirm NativeAOT actually ran, check that `.lib` and `.exp` files exist alongside the DLL in the `native\` directory.
To confirm NativeAOT actually ran, check that `.lib` and `.exp` files exist alongside the DLL in the publish output's `native\` directory.
## Installer
The `installer/` directory contains an Inno Setup script and a PowerShell build script that publishes the launcher, engine, **injector**, all discovered `RynthSuite` plugins, **ub-Rythai** (`RynthCore.Plugin.UbRythai`) when `..\ub-Rythai\` is present, and the RynthSuite tools, stages the output, and produces a single **`RynthBundle-Setup.exe`**.
The `installer/` directory contains an Inno Setup script and a PowerShell build script that publishes all required projects, stages the output, and produces a single `RynthBundle-Setup.exe`.
### Prerequisites
- [Inno Setup 6](https://jrsoftware.org/isdl.php) installed to the default location (`C:\Program Files (x86)\Inno Setup 6\`)
- All build prerequisites listed above (matching .NET SDK for the solution, VS Build Tools for NativeAOT as needed)
- **RynthCore.exe** and **Runtime\RynthCore.Injector.exe** are published **self-contained** (they bundle .NET 10 x86) — no separate Desktop Runtime install is required to run the launcher or injector from the install folder.
- **LootEditor** and **MonsterEditor** remain framework-dependent (x64). If either fails to start, install [.NET Desktop Runtime 10 x64](https://dotnet.microsoft.com/en-us/download/dotnet/10.0/runtime).
- All build prerequisites listed above (.NET 10 SDK, VS Build Tools)
### Build the full release + installer (recommended)
@ -161,7 +195,7 @@ cd C:\Projects\RynthCore\installer
.\Build-Installer.ps1 -Version 0.4.2
```
This runs publish steps for launcher (self-contained x86) + engine (NativeAOT) + injector (self-contained x86) + all `RynthCore.Plugin.*` projects under RynthSuite, bundles the RynthSuite tools (`LootEditor`, `MonsterEditor`) as framework-dependent win-x64 apps (x64 runtime may be required for those two), stages everything under `installer\staging\app\`, then invokes `ISCC.exe` to produce the installer.
This runs `dotnet publish` for the Launcher, Loader, Engine, and RynthAi plugin (from RynthSuite), stages everything under `installer\staging\app\`, then invokes `ISCC.exe` to produce the installer.
Output: `installer\Output\RynthBundle-Setup.exe` (or `installer\Output\RynthBundle-Setup-<version>.exe` when `-Version` is set — Inno **`OutputBaseFilename`** is versioned so the compile is not blocked by a locked `RynthBundle-Setup.exe`; the script then copies to the canonical name when possible).
@ -185,23 +219,45 @@ After a **successful** Inno compile, `last-built-version.txt` is updated to the
### What the installer does
- On **interactive** installs, shows an **advisory** wizard page after **Welcome** that checks for **.NET 10 (x64)** in the registry (see `RynthCore.iss` `[Code]`): **(1)** `Microsoft.WindowsDesktop.App` 10+ under `HKLM\SOFTWARE\dotnet\shared\...`, **(2)** `InstalledManifests\x64` keys containing `Manifest-10.`, **(3)** `sharedhost` **Version** 10+ under `SOFTWARE\dotnet\Setup\InstalledVersions\x64\` (and the parallel `SOFTWARE\Microsoft\dotnet\Setup\...` path). The same logic is implemented in C# as **`RynthCore.DesktopLog.NetDesktopX64Prerequisite`**; the launcher reports it in the activity line and `RynthCore-Launcher.log`. **Next is never disabled** for missing x64 runtime — install can complete; Loot/Monster may not start until you install the desktop/runtime from the linked page. On 32-bit Windows the page explains the tools are N/A. **Silent** installs skip that page.
- Installs the launcher and injector (self-contained x86 — .NET 10 is bundled with `RynthCore.exe` and `RynthCore.Injector.exe`), the engine, and native dependencies under `C:\Games\RynthCore` (user-selectable; default matches this layout)
- Installs all default `RynthSuite` plugin DLLs and **ub-Rythai** (when built) into `Runtime\Plugins` so they auto-load on first inject
- Installs `RynthCore.LootEditor` and `RynthCore.MonsterEditor` into `Tools\` as framework-dependent apps (requires .NET Desktop Runtime x64).
- Installs the launcher, loader, engine, and native dependencies to `C:\Games\RynthCore` (user-selectable)
- Creates data directories under `C:\Games\RynthSuite\RynthAi\` (NavProfiles, LootProfiles, MetaFiles, etc.) — these are preserved on uninstall
- Adds Start Menu and optional Desktop shortcuts
- Warns if `acclient.exe` is running (the engine DLL would be locked)
- Warns if `acclient.exe` is running (the engine + loader DLLs would be locked)
- Shows getting-started instructions on the finish page
## Multi-Client Coexistence (with ThwargLauncher etc.)
If you also run AC through ThwargLauncher, aclauncher, or any other launcher that may not patch AC's `OpenDataFile` for shared access, the two stacks will fight over the same DAT files. Once one launcher's clients have the DATs locked exclusively, the other can't open them — symptom is **"cannot access the data files"** when launching from the second launcher.
**Required setup**: a second AC client install for RynthCore launches.
```
C:\Turbine\Asheron's Call\ ← left untouched, used by ThwargLauncher etc.
C:\Games\RynthCore\AcClient\ ← full copy of the AC client (~1.4 GB), used by RynthCore
```
Setup:
```powershell
robocopy "C:\Turbine\Asheron's Call" "C:\Games\RynthCore\AcClient" /E /MT:8 /NFL /NDL /NJH /NJS /NP `
/XF "acclient_*.log" "acclient.log"
```
Then in the RynthCore launcher:
1. Set **AC Client Path** to `C:\Games\RynthCore\AcClient\acclient.exe`
2. Click somewhere else / save so the change persists
The two installs share `Documents\Asheron's Call\UserPreferences.ini` (it's user-scoped), so `ComputeUniquePort=True` applies to all instances regardless of which install they came from.
If your AC client ever gets a real-world patch, apply it to both copies (or `robocopy /MIR` to re-sync from the canonical install).
## Gotchas
- **`dotnet publish`, not `dotnet build` for Engine and Plugins.** NativeAOT only runs during `dotnet publish`. A `dotnet build` produces a valid managed DLL that compiles fine but has no unmanaged exports and will be silently ignored by the engine. The Avalonia launcher is the exception — `dotnet build` is fine since it's a normal .NET app.
- **Clean before plugin publish.** Incremental NativeAOT builds can silently reuse stale output. Delete `obj\Release` and `bin\Release` before every publish to guarantee a fresh compile.
- **Engine deploy path is `Runtime\`**, not `C:\Games\RynthCore\`. The injector resolves `Runtime\RynthCore.Engine.dll` by default.
- **Two RynthAi projects exist.** The real plugin is at `C:\Projects\RynthSuite\Plugins\RynthCore.Plugin.RynthAi\`. There is a stale stub at `C:\Projects\RynthCore\Plugins\RynthCore.Plugin.RynthAi\` — do not build or deploy from there.
- **Engine publish copies a stale plugin** into the engine's publish output. Always deploy the plugin from the RynthSuite path last.
- **cimgui.dll version must match ImGui.NET NuGet.** Post-1.90 struct layouts changed. A mismatched cimgui.dll causes `DisplaySize = <1, 1>` or font crashes.
- **vswhere.exe must be on PATH** for NativeAOT link step. Add `C:\Program Files (x86)\Microsoft Visual Studio\Installer` to PATH if missing.
- **`dotnet publish`, not `dotnet build` for Loader, Engine, and plugins.** NativeAOT only runs during `dotnet publish`. A `dotnet build` produces a valid managed DLL that compiles fine but has no unmanaged exports and will be silently ignored. The Avalonia launcher is the exception — `dotnet build` is fine since it's a normal .NET app.
- **Clean before plugin publish.** Incremental NativeAOT builds can silently reuse stale output. Delete `obj\Release` and `bin\Release` before every plugin publish to guarantee a fresh compile.
- **Engine deploy path is `Runtime\`**, not `C:\Games\RynthCore\` directly. The injector resolves `Runtime\RynthCore.Loader.dll` (preferred) and `Runtime\RynthCore.Engine.dll` (legacy) by default.
- **Close AC before redeploying Loader or Engine.** Both are loaded into `acclient.exe` and locked while the game is running. Plugins are shadow-copied so they can be hot-swapped without closing AC.
- **cimgui.dll version must match ImGui.NET NuGet.** Post-1.90 struct layouts changed. A mismatched cimgui.dll causes `DisplaySize = <1, 1>` or font crashes on frame 2.
- **vswhere.exe must be on PATH** for the NativeAOT link step. Add `C:\Program Files (x86)\Microsoft Visual Studio\Installer` to PATH if missing.
- **Decal coexistence mode.** If `decal.dll`, `UBLoader.dll`, `Decal.Adapter.dll`, or `phatacd.dll` is loaded into acclient.exe, the engine skips the entire D3D9/ImGui path and runs plugins on a 30 Hz worker tick with Avalonia floating panels via `LayeredWindow` (GDI). This is intentional — two D3D9 hookers can't symmetrically save/restore render state. Check `RynthCore.log` for `D3D9: Decal coexistence` to confirm.