Add Plugins tab, remove WinForms launcher, add BUILD.md

- Add Plugins tab to Avalonia launcher with add/remove plugin DLL management
- Plugin paths sync to engine.json for runtime loading
- Engine loads plugins from custom DLL paths via EngineSettings
- Remove defunct WinForms launcher (RynthCore.App project, MainForm, Program)
- Shared source files remain in src/RynthCore.App for Avalonia and Engine
- Add BUILD.md with full publish/deploy instructions for all components

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
tombohar 2026-04-16 17:08:26 -04:00
commit 36e8208caa
14 changed files with 584 additions and 2233 deletions

141
BUILD.md Normal file
View file

@ -0,0 +1,141 @@
# Build & Deploy
RynthCore is the injection framework. RynthSuite (separate repo) contains the plugins that run on top of it.
## 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)
- 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) |
## Publish Commands
### Launcher (Avalonia)
```bash
cd C:\Projects\RynthCore\src\RynthCore.App.Avalonia
dotnet build -c Release
```
Output: `bin\Release\net9.0-windows7.0\RynthCore.App.Avalonia.dll`
### Engine (NativeAOT — 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
```
```bash
cd C:\Projects\RynthCore\src\RynthCore.Engine
dotnet publish -c Release
```
Output: `bin\Release\net9.0-windows\win-x86\publish\RynthCore.Engine.dll` (~26 MB)
### RynthAi Plugin (NativeAOT — separate repo)
Always clean first — incremental builds can silently skip NativeAOT and produce a stale DLL.
```bash
cd C:\Projects\RynthSuite\Plugins\RynthCore.Plugin.RynthAi
rmdir /s /q obj\Release bin\Release 2>nul
dotnet publish -c Release
```
Output: `bin\Release\net9.0-windows\win-x86\publish\RynthCore.Plugin.RynthAi.dll` (~7 MB)
## Deploy
### Directory Layout
```
C:\Games\RynthCore\
├── 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
└── Runtime\
├── 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)
C:\Games\RynthSuite\RynthAi\
├── RynthCore.Plugin.RynthAi.dll ← RynthAi plugin (recommended deploy location)
├── NavProfiles\ ← Navigation profiles
├── LootProfiles\ ← Loot profiles
└── Metas\ ← Meta files
```
### 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\
```
Restart the launcher after deploying.
### Deploy Engine
**AC must be closed** — the running client holds a file lock on the engine DLL.
```bash
copy src\RynthCore.Engine\bin\Release\net9.0-windows\win-x86\publish\RynthCore.Engine.dll C:\Games\RynthCore\Runtime\
```
### 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`.
```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\
```
Alternatively, deploy to the engine's built-in plugin directory:
```bash
copy ... C:\Games\RynthCore\Runtime\Plugins\
```
After deploying a plugin with AC running, click **RL** on the RynthCore overlay bar to hot-reload.
## 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\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.
## 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.

View file

@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RynthCore.Engine", "src\Ryn
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RynthCore.Injector", "src\RynthCore.Injector\RynthCore.Injector.csproj", "{A1B2C3D4-0002-0002-0002-000000000002}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RynthCore.App", "src\RynthCore.App\RynthCore.App.csproj", "{A1B2C3D4-0003-0003-0003-000000000003}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RynthCore.Plugin.RynthAi", "Plugins\RynthCore.Plugin.RynthAi\RynthCore.Plugin.RynthAi.csproj", "{A1B2C3D4-0005-0005-0005-000000000005}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}"
@ -53,19 +51,7 @@ Global
{A1B2C3D4-0002-0002-0002-000000000002}.Release|Any CPU.Build.0 = Release|Any CPU
{A1B2C3D4-0002-0002-0002-000000000002}.Release|x64.ActiveCfg = Release|Any CPU
{A1B2C3D4-0002-0002-0002-000000000002}.Release|x64.Build.0 = Release|Any CPU
{A1B2C3D4-0003-0003-0003-000000000003}.Debug|x86.ActiveCfg = Debug|x86
{A1B2C3D4-0003-0003-0003-000000000003}.Debug|x86.Build.0 = Debug|x86
{A1B2C3D4-0003-0003-0003-000000000003}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1B2C3D4-0003-0003-0003-000000000003}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1B2C3D4-0003-0003-0003-000000000003}.Debug|x64.ActiveCfg = Debug|Any CPU
{A1B2C3D4-0003-0003-0003-000000000003}.Debug|x64.Build.0 = Debug|Any CPU
{A1B2C3D4-0003-0003-0003-000000000003}.Release|x86.ActiveCfg = Release|x86
{A1B2C3D4-0003-0003-0003-000000000003}.Release|x86.Build.0 = Release|x86
{A1B2C3D4-0003-0003-0003-000000000003}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1B2C3D4-0003-0003-0003-000000000003}.Release|Any CPU.Build.0 = Release|Any CPU
{A1B2C3D4-0003-0003-0003-000000000003}.Release|x64.ActiveCfg = Release|Any CPU
{A1B2C3D4-0003-0003-0003-000000000003}.Release|x64.Build.0 = Release|Any CPU
{A1B2C3D4-0005-0005-0005-000000000005}.Debug|x86.ActiveCfg = Debug|x86
{A1B2C3D4-0005-0005-0005-000000000005}.Debug|x86.ActiveCfg = Debug|x86
{A1B2C3D4-0005-0005-0005-000000000005}.Debug|x86.Build.0 = Debug|x86
{A1B2C3D4-0005-0005-0005-000000000005}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1B2C3D4-0005-0005-0005-000000000005}.Debug|Any CPU.Build.0 = Debug|Any CPU

View file

@ -226,23 +226,31 @@
</ScrollViewer>
</TabItem>
<TabItem Header="Runtime">
<TabItem Header="Plugins">
<ScrollViewer>
<StackPanel Spacing="12" Margin="6">
<Border Background="#132028" CornerRadius="16" Padding="18">
<StackPanel Spacing="8">
<TextBlock Text="Runtime Surface" FontSize="19" FontWeight="Bold" Foreground="#EAF0F4" />
<TextBlock Text="Runtime controls are also safe to migrate because they live in the desktop host, not the game overlay. This is the start of that second wave so we can make the launcher genuinely usable."
<TextBlock Text="Plugins" FontSize="16" FontWeight="SemiBold" Foreground="#26C1A6" />
<TextBlock Text="Manage the runtime modules loaded into RynthCore. Add plugins by browsing for their DLL file."
TextWrapping="Wrap"
Foreground="#9AA8B3" />
<StackPanel x:Name="PluginLoadoutPanel" Spacing="10" />
<Button x:Name="AddPluginDllButton" Content="Add Plugin" HorizontalAlignment="Left" />
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
</TabItem>
<TabItem Header="Runtime">
<ScrollViewer>
<StackPanel Spacing="12" Margin="6">
<Grid ColumnDefinitions="*,Auto,*">
<Border Grid.Column="0" Background="#132028" CornerRadius="16" Padding="18" MinWidth="280">
<StackPanel Spacing="8">
<TextBlock Text="Paths" FontSize="16" FontWeight="SemiBold" Foreground="#26C1A6" />
<TextBlock Text="These values are backed by the shared app settings store, so they persist across the WinForms and Avalonia hosts."
<TextBlock Text="These values are backed by the shared app settings store and persist across sessions."
TextWrapping="Wrap"
Foreground="#9AA8B3" />
<TextBlock Text="AC Client Path" Foreground="#EAF0F4" />
@ -269,7 +277,7 @@
<Border Grid.Column="2" Background="#132028" CornerRadius="16" Padding="18" MinWidth="280">
<StackPanel Spacing="8">
<TextBlock Text="Launch Behavior" FontSize="16" FontWeight="SemiBold" Foreground="#26C1A6" />
<TextBlock Text="These are the same host-side toggles the current launcher uses. They are safe to migrate independently of the injected engine."
<TextBlock Text="Host-side toggles for launch and injection behavior."
TextWrapping="Wrap"
Foreground="#9AA8B3" />
<CheckBox x:Name="AllowMultipleClientsCheckBox" Content="Allow multiple clients" />
@ -284,38 +292,21 @@
</Border>
</Grid>
<Grid ColumnDefinitions="*,Auto,*">
<Border Grid.Column="0" Background="#132028" CornerRadius="16" Padding="18" MinWidth="280">
<StackPanel Spacing="8">
<TextBlock Text="Runtime Loadout" FontSize="16" FontWeight="SemiBold" Foreground="#26C1A6" />
<TextBlock Text="This is the first pass of plugin selection in Avalonia. RynthCore Engine remains the required injectable runtime; future loadout items can layer in beside it."
TextWrapping="Wrap"
Foreground="#9AA8B3" />
<StackPanel x:Name="PluginLoadoutPanel" Spacing="10" />
</StackPanel>
</Border>
<GridSplitter Grid.Column="1"
Width="12"
ResizeDirection="Columns"
Background="Transparent" />
<Border Grid.Column="2" Background="#132028" CornerRadius="16" Padding="18" MinWidth="280">
<StackPanel Spacing="8">
<TextBlock Text="Recovery Actions" FontSize="16" FontWeight="SemiBold" Foreground="#26C1A6" />
<TextBlock Text="Use these when AC is already running and you need to attach RynthCore manually or refresh the live session readout."
TextWrapping="Wrap"
Foreground="#9AA8B3" />
<WrapPanel Orientation="Horizontal" ItemWidth="176" ItemHeight="40">
<Button x:Name="InjectRunningAcButton" Content="Inject Into Running AC" Margin="0,0,8,8" />
<Button x:Name="RefreshSessionsButton" Content="Refresh Sessions" Margin="0,0,8,8" />
</WrapPanel>
<TextBlock Text="Manual inject targets the first detected acclient.exe session."
TextWrapping="Wrap"
Foreground="#9AA8B3" />
</StackPanel>
</Border>
</Grid>
<Border Background="#132028" CornerRadius="16" Padding="18">
<StackPanel Spacing="8">
<TextBlock Text="Recovery Actions" FontSize="16" FontWeight="SemiBold" Foreground="#26C1A6" />
<TextBlock Text="Use these when AC is already running and you need to attach RynthCore manually or refresh the live session readout."
TextWrapping="Wrap"
Foreground="#9AA8B3" />
<WrapPanel Orientation="Horizontal" ItemWidth="176" ItemHeight="40">
<Button x:Name="InjectRunningAcButton" Content="Inject Into Running AC" Margin="0,0,8,8" />
<Button x:Name="RefreshSessionsButton" Content="Refresh Sessions" Margin="0,0,8,8" />
</WrapPanel>
<TextBlock Text="Manual inject targets the first detected acclient.exe session."
TextWrapping="Wrap"
Foreground="#9AA8B3" />
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
</TabItem>
@ -346,19 +337,11 @@
<Border Background="#132028" CornerRadius="16" Padding="18">
<StackPanel Spacing="8">
<TextBlock Text="Important Constraint" FontSize="19" FontWeight="Bold" Foreground="#EAF0F4" />
<TextBlock Text="Switching the desktop host to Avalonia does not replace the in-game ImGui overlay. If ImGui is causing client crashes, we should keep treating that as a separate engine-side stabilization track."
<TextBlock Text="The Avalonia desktop host does not replace the in-game ImGui overlay. If ImGui is causing client crashes, that is a separate engine-side stabilization track."
TextWrapping="Wrap"
Foreground="#9AA8B3" />
</StackPanel>
</Border>
<Border Background="#132028" CornerRadius="16" Padding="18">
<StackPanel Spacing="8">
<TextBlock Text="Phase 1 Exit Criteria" FontSize="16" FontWeight="SemiBold" Foreground="#E2B348" />
<TextBlock Text="• Avalonia app builds in the solution&#x0A;• Shared launcher styling direction is established&#x0A;• One real launcher workflow is ported end to end&#x0A;• Current WinForms host stays available until parity is good enough to cut over"
Foreground="#EAF0F4" />
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
</TabItem>

View file

@ -4,11 +4,13 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Layout;
using Avalonia.Media;
using Avalonia.Platform.Storage;
using Avalonia.Threading;
using RynthCore.Injector;
@ -25,6 +27,7 @@ internal partial class MainWindow : Window
private readonly ServerStatusProbeService _serverStatusProbe = new();
private readonly ObservableCollection<string> _activityItems = [];
private readonly ObservableCollection<string> _sessionItems = [];
private readonly ObservableCollection<string> _pluginDllPaths = [];
private readonly HashSet<int> _launchedSessionPids = [];
private readonly Dictionary<string, TextBlock> _launchTargetStatusTexts = [];
private readonly Dictionary<string, CheckBox> _launchTargetChecks = [];
@ -41,14 +44,6 @@ internal partial class MainWindow : Window
Summary = "Injects the in-process runtime and overlay host into acclient.exe.",
StatusText = "Implemented now",
RuntimeImplemented = true
},
new PluginDefinition
{
Id = "nexai",
Name = "RynthAi",
Summary = "Selection is persisted now so the desktop host becomes the future loadout surface for adopted runtime modules.",
StatusText = "Planned adoption",
RuntimeImplemented = false
}
];
private readonly Dictionary<string, CheckBox> _pluginChecks = [];
@ -68,6 +63,7 @@ internal partial class MainWindow : Window
SessionList.ItemsSource = _sessionItems;
LoadSettings();
LoadRuntimeControls();
LoadPluginDllPaths();
BuildPluginLoadout();
WireEvents();
RefreshLists();
@ -103,6 +99,7 @@ internal partial class MainWindow : Window
SaveBehaviorButton.Click += (_, _) => SaveLaunchBehavior();
InjectRunningAcButton.Click += async (_, _) => await InjectRunningAcAsync();
RefreshSessionsButton.Click += (_, _) => RefreshSessionState();
AddPluginDllButton.Click += async (_, _) => await AddPluginDllAsync();
ServerProfilesList.SelectionChanged += (_, _) => OnPrimarySelectionChanged();
AccountProfilesList.SelectionChanged += (_, _) => OnPrimarySelectionChanged();
@ -164,41 +161,87 @@ internal partial class MainWindow : Window
foreach (PluginDefinition plugin in _plugins)
{
var host = new Border
{
Background = Brush.Parse("#0F161D"),
BorderBrush = Brush.Parse("#243742"),
BorderThickness = new Thickness(1),
CornerRadius = new CornerRadius(12),
Padding = new Thickness(12)
};
var stack = new StackPanel { Spacing = 6 };
var checkBox = new CheckBox
{
Content = plugin.Name,
IsChecked = _settings.EnabledPluginIds.Contains(plugin.Id, StringComparer.OrdinalIgnoreCase)
};
checkBox.IsCheckedChanged += (_, _) => OnPluginSelectionChanged(plugin, checkBox);
stack.Children.Add(checkBox);
stack.Children.Add(new TextBlock
{
Text = plugin.StatusText.ToUpperInvariant(),
Foreground = Brush.Parse(plugin.RuntimeImplemented ? "#66D687" : "#E2B348"),
FontWeight = FontWeight.Bold
});
stack.Children.Add(new TextBlock
{
Text = plugin.Summary,
TextWrapping = TextWrapping.Wrap,
Foreground = Brush.Parse("#9AA8B3")
});
host.Child = stack;
PluginLoadoutPanel.Children.Add(host);
_pluginChecks[plugin.Id] = checkBox;
PluginLoadoutPanel.Children.Add(BuildPluginCard(checkBox, plugin.Summary, null));
}
foreach (string dllPath in _pluginDllPaths)
{
string capturedPath = dllPath;
string pluginName = Path.GetFileNameWithoutExtension(dllPath);
var checkBox = new CheckBox { Content = pluginName, IsChecked = true };
PluginLoadoutPanel.Children.Add(BuildPluginCard(checkBox, capturedPath, () =>
{
for (int j = _pluginDllPaths.Count - 1; j >= 0; j--)
{
if (string.Equals(_pluginDllPaths[j], capturedPath, StringComparison.OrdinalIgnoreCase))
{
_pluginDllPaths.RemoveAt(j);
break;
}
}
SavePluginDllPaths();
BuildPluginLoadout();
AppendActivity($"Removed plugin: {Path.GetFileName(capturedPath)}");
}));
}
}
private static Border BuildPluginCard(CheckBox checkBox, string description, Action? onRemove)
{
var host = new Border
{
Background = Brush.Parse("#0F161D"),
BorderBrush = Brush.Parse("#243742"),
BorderThickness = new Thickness(1),
CornerRadius = new CornerRadius(12),
Padding = new Thickness(12)
};
var stack = new StackPanel { Spacing = 6 };
stack.Children.Add(checkBox);
stack.Children.Add(new TextBlock
{
Text = description,
TextWrapping = TextWrapping.Wrap,
Foreground = Brush.Parse("#9AA8B3")
});
if (onRemove == null)
{
host.Child = stack;
return host;
}
var row = new Grid { ColumnDefinitions = new ColumnDefinitions("*, Auto") };
var removeButton = new Button
{
Content = "\u2715",
FontSize = 14,
Padding = new Thickness(6, 2),
VerticalAlignment = VerticalAlignment.Top,
Background = Brushes.Transparent,
Foreground = Brush.Parse("#9AA8B3"),
BorderThickness = new Thickness(0)
};
removeButton.Click += (_, _) => onRemove();
Grid.SetColumn(stack, 0);
Grid.SetColumn(removeButton, 1);
row.Children.Add(stack);
row.Children.Add(removeButton);
host.Child = row;
return host;
}
private void RefreshLists()
@ -997,6 +1040,87 @@ internal partial class MainWindow : Window
AppendActivity($"Runtime loadout updated: {plugin.Name} {(checkBox.IsChecked == true ? "enabled" : "disabled")}.");
}
private void LoadPluginDllPaths()
{
_pluginDllPaths.Clear();
if (_settings.PluginDllPaths != null)
{
foreach (string path in _settings.PluginDllPaths)
_pluginDllPaths.Add(path);
}
}
private async Task AddPluginDllAsync()
{
var topLevel = GetTopLevel(this);
if (topLevel == null)
return;
var files = await topLevel.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
{
Title = "Select a plugin DLL",
AllowMultiple = false,
FileTypeFilter =
[
new FilePickerFileType("Plugin DLL") { Patterns = ["*.dll"] },
new FilePickerFileType("All Files") { Patterns = ["*"] }
]
});
if (files.Count == 0)
return;
string fullPath = Path.GetFullPath(files[0].Path.LocalPath);
if (_pluginDllPaths.Any(p => string.Equals(p, fullPath, StringComparison.OrdinalIgnoreCase)))
{
AppendActivity($"Plugin path already added: {fullPath}");
return;
}
_pluginDllPaths.Add(fullPath);
SavePluginDllPaths();
BuildPluginLoadout();
AppendActivity($"Added plugin: {Path.GetFileName(fullPath)}");
}
private void SavePluginDllPaths()
{
_settings.PluginDllPaths = _pluginDllPaths.ToList();
SaveSettings();
SyncPluginPathsToEngineSettings();
}
private void SyncPluginPathsToEngineSettings()
{
string engineSettingsPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"RynthCore",
"engine.json");
try
{
string? dir = Path.GetDirectoryName(engineSettingsPath);
if (dir != null) Directory.CreateDirectory(dir);
using var ms = new MemoryStream();
using (var w = new Utf8JsonWriter(ms, new JsonWriterOptions { Indented = true }))
{
w.WriteStartObject();
w.WriteStartArray("PluginPaths");
foreach (string p in _pluginDllPaths)
w.WriteStringValue(p);
w.WriteEndArray();
w.WriteEndObject();
}
File.WriteAllBytes(engineSettingsPath, ms.ToArray());
}
catch (Exception ex)
{
AppendActivity($"Failed to sync plugin paths to engine.json: {ex.Message}");
}
}
private async Task InjectRunningAcAsync()
{
if (_operationBusy)
@ -1035,9 +1159,6 @@ internal partial class MainWindow : Window
Process target = targets.OrderBy(process => process.Id).First();
AppendActivity($"Applying selected loadout to running AC (PID {target.Id}).");
if (GetSelectedPluginIds().Contains("nexai", StringComparer.OrdinalIgnoreCase))
AppendActivity("RynthAi is selected and saved in the loadout. Runtime adoption is still a future step.");
InjectionResult result = await Task.Run(() => _injector.InjectIntoProcess(target, enginePath, AppendActivity));
if (result.Success)
{

View file

@ -18,6 +18,7 @@ internal sealed class AppSettings
public bool AutoInjectAfterLaunch { get; set; } = true;
public bool WatchForAcStart { get; set; } = true;
public List<string> EnabledPluginIds { get; set; } = [];
public List<string> PluginDllPaths { get; set; } = [];
public List<LaunchServerProfile> ServerProfiles { get; set; } = [];
public List<LaunchAccountProfile> AccountProfiles { get; set; } = [];

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

View file

@ -1,224 +0,0 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace RynthCore.App;
internal static class LaunchProfileDialogs
{
public static bool TryEditServer(IWin32Window owner, LaunchServerProfile profile)
{
using var dialog = CreateEditorDialog("Server Profile", 520, 300);
var nameBox = CreateTextBox(profile.Name);
var aliasBox = CreateTextBox(profile.Alias);
var hostBox = CreateTextBox(profile.Host);
var portBox = CreateTextBox(profile.Port > 0 ? profile.Port.ToString() : string.Empty);
var emulatorCombo = CreateComboBox();
emulatorCombo.Items.AddRange(Enum.GetNames<AcEmulatorKind>());
emulatorCombo.SelectedItem = profile.Emulator.ToString();
var rodatCheck = new CheckBox
{
Text = "Enable Rodat",
AutoSize = true,
Checked = profile.RodatEnabled,
ForeColor = Color.White,
BackColor = Color.Transparent,
Margin = new Padding(0, 6, 0, 0)
};
var body = CreateFormLayout();
body.Controls.Add(CreateLabeledRow("Server Name", nameBox), 0, 0);
body.Controls.Add(CreateLabeledRow("Alias", aliasBox), 0, 1);
body.Controls.Add(CreateLabeledRow("Host", hostBox), 0, 2);
body.Controls.Add(CreateLabeledRow("Port", portBox), 0, 3);
body.Controls.Add(CreateLabeledRow("Emulator", emulatorCombo), 0, 4);
body.Controls.Add(rodatCheck, 0, 5);
dialog.Controls.Add(body);
void SaveAndClose(object? _, EventArgs __)
{
if (string.IsNullOrWhiteSpace(nameBox.Text))
{
ShowValidation(dialog, "Server name is required.");
return;
}
if (string.IsNullOrWhiteSpace(hostBox.Text))
{
ShowValidation(dialog, "Server host is required.");
return;
}
if (!int.TryParse(portBox.Text.Trim(), out int port) || port <= 0)
{
ShowValidation(dialog, "Server port must be a positive integer.");
return;
}
if (emulatorCombo.SelectedItem is not string emulatorText ||
!Enum.TryParse(emulatorText, ignoreCase: true, out AcEmulatorKind emulator))
{
ShowValidation(dialog, "Select an emulator type.");
return;
}
profile.Name = nameBox.Text.Trim();
profile.Alias = aliasBox.Text.Trim();
profile.Host = hostBox.Text.Trim();
profile.Port = port;
profile.Emulator = emulator;
profile.RodatEnabled = rodatCheck.Checked;
dialog.DialogResult = DialogResult.OK;
dialog.Close();
}
WireDialogButtons(dialog, SaveAndClose);
return dialog.ShowDialog(owner) == DialogResult.OK;
}
public static bool TryEditAccount(IWin32Window owner, LaunchAccountProfile profile)
{
using var dialog = CreateEditorDialog("Account Profile", 520, 300);
var accountBox = CreateTextBox(profile.AccountName);
var passwordBox = CreateTextBox(profile.Password);
passwordBox.UseSystemPasswordChar = true;
var characterBox = CreateTextBox(profile.CharacterName);
var aliasBox = CreateTextBox(profile.Alias);
var body = CreateFormLayout();
body.Controls.Add(CreateLabeledRow("Account", accountBox), 0, 0);
body.Controls.Add(CreateLabeledRow("Password", passwordBox), 0, 1);
body.Controls.Add(CreateLabeledRow("Character / Slot", characterBox), 0, 2);
body.Controls.Add(CreateLabeledRow("Alias (Optional)", aliasBox), 0, 3);
dialog.Controls.Add(body);
void SaveAndClose(object? _, EventArgs __)
{
if (string.IsNullOrWhiteSpace(accountBox.Text))
{
ShowValidation(dialog, "Account name is required.");
return;
}
profile.AccountName = accountBox.Text.Trim();
profile.Password = passwordBox.Text;
profile.CharacterName = characterBox.Text.Trim();
profile.Alias = aliasBox.Text.Trim();
dialog.DialogResult = DialogResult.OK;
dialog.Close();
}
WireDialogButtons(dialog, SaveAndClose);
return dialog.ShowDialog(owner) == DialogResult.OK;
}
private static Form CreateEditorDialog(string title, int width, int height)
{
return new Form
{
Text = title,
FormBorderStyle = FormBorderStyle.FixedDialog,
StartPosition = FormStartPosition.CenterParent,
MinimizeBox = false,
MaximizeBox = false,
ShowInTaskbar = false,
Width = width,
Height = height,
BackColor = Color.FromArgb(20, 28, 36),
ForeColor = Color.White
};
}
private static TableLayoutPanel CreateFormLayout()
{
return new TableLayoutPanel
{
Dock = DockStyle.Fill,
ColumnCount = 1,
RowCount = 6,
Padding = new Padding(14, 14, 14, 56),
AutoSize = false
};
}
private static Panel CreateLabeledRow(string labelText, Control editor)
{
var panel = new Panel
{
Dock = DockStyle.Top,
Height = 54
};
var label = new Label
{
Text = labelText,
AutoSize = true,
ForeColor = Color.Gainsboro,
Location = new Point(0, 2)
};
editor.Location = new Point(0, 22);
editor.Width = 458;
panel.Controls.Add(label);
panel.Controls.Add(editor);
return panel;
}
private static TextBox CreateTextBox(string value)
{
return new TextBox
{
Text = value,
BorderStyle = BorderStyle.FixedSingle,
BackColor = Color.FromArgb(15, 22, 30),
ForeColor = Color.White
};
}
private static ComboBox CreateComboBox()
{
return new ComboBox
{
DropDownStyle = ComboBoxStyle.DropDownList,
BackColor = Color.FromArgb(15, 22, 30),
ForeColor = Color.White,
FlatStyle = FlatStyle.Flat
};
}
private static void WireDialogButtons(Form dialog, EventHandler saveHandler)
{
var okButton = new Button
{
Text = "Save",
Width = 96,
Height = 34,
Anchor = AnchorStyles.Bottom | AnchorStyles.Right,
Location = new Point(dialog.ClientSize.Width - 214, dialog.ClientSize.Height - 46),
DialogResult = DialogResult.None
};
okButton.Click += saveHandler;
var cancelButton = new Button
{
Text = "Cancel",
Width = 96,
Height = 34,
Anchor = AnchorStyles.Bottom | AnchorStyles.Right,
Location = new Point(dialog.ClientSize.Width - 108, dialog.ClientSize.Height - 46),
DialogResult = DialogResult.Cancel
};
dialog.AcceptButton = okButton;
dialog.CancelButton = cancelButton;
dialog.Controls.Add(okButton);
dialog.Controls.Add(cancelButton);
}
private static void ShowValidation(IWin32Window owner, string message)
{
MessageBox.Show(owner, message, "Incomplete Profile", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,14 +0,0 @@
using System;
using System.Windows.Forms;
namespace RynthCore.App;
internal static class Program
{
[STAThread]
private static void Main()
{
ApplicationConfiguration.Initialize();
Application.Run(new MainForm());
}
}

View file

@ -1,19 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<PlatformTarget>x86</PlatformTarget>
<RootNamespace>RynthCore.App</RootNamespace>
<AssemblyName>RynthCore.App</AssemblyName>
<Platforms>x86</Platforms>
<Nullable>enable</Nullable>
<ApplicationIcon>Assets\RynthCore.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\RynthCore.Injector\RynthCore.Injector.csproj" />
</ItemGroup>
</Project>

View file

@ -47,6 +47,7 @@ internal static class RynthCoreShell
private static long _nextLogRefreshTick;
private static int _selectedPlugin = 0;
private static bool _showPluginTips = true;
private static string _newPluginPathInput = "";
private static readonly bool[] PluginBarButtonsVisible = [true, false, false, false];
private static Vector2 _barPosition = new(12f, 12f);
private static bool _barPositionInitialized;
@ -389,22 +390,38 @@ internal static class RynthCoreShell
}
RenderShellToolbar();
DrawHero();
ImGui.Spacing();
if (ImGui.BeginTable("ShellMain", 2, ImGuiTableFlags.SizingStretchProp))
if (ImGui.BeginTabBar("##ShellTabs"))
{
ImGui.TableSetupColumn("Left", ImGuiTableColumnFlags.WidthStretch, 0.60f);
ImGui.TableSetupColumn("Right", ImGuiTableColumnFlags.WidthStretch, 0.40f);
ImGui.TableNextRow();
if (ImGui.BeginTabItem("Dashboard"))
{
DrawHero();
ImGui.Spacing();
ImGui.TableNextColumn();
RenderControlDeck();
if (ImGui.BeginTable("ShellMain", 2, ImGuiTableFlags.SizingStretchProp))
{
ImGui.TableSetupColumn("Left", ImGuiTableColumnFlags.WidthStretch, 0.60f);
ImGui.TableSetupColumn("Right", ImGuiTableColumnFlags.WidthStretch, 0.40f);
ImGui.TableNextRow();
ImGui.TableNextColumn();
RenderPluginDeck();
ImGui.TableNextColumn();
RenderControlDeck();
ImGui.EndTable();
ImGui.TableNextColumn();
RenderPluginDeck();
ImGui.EndTable();
}
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem("Plugins"))
{
RenderPluginsTab();
ImGui.EndTabItem();
}
ImGui.EndTabBar();
}
ImGui.End();
@ -656,6 +673,109 @@ internal static class RynthCoreShell
ImGui.EndChild();
}
private static void RenderPluginsTab()
{
ImGui.Spacing();
// ── Loaded plugins ──────────────────────────────────────────────────
var loadedPlugins = PluginManager.Plugins;
ImGui.TextColored(Accent, $"Loaded Plugins ({loadedPlugins.Count})");
ImGui.Separator();
if (loadedPlugins.Count == 0)
{
ImGui.TextColored(TextMute, "No plugins loaded.");
}
else
{
for (int i = 0; i < loadedPlugins.Count; i++)
{
var p = loadedPlugins[i];
bool waitingForLogin = p.Initialized && !p.Failed && p.OnLoginComplete != null && !p.LoginCompleteDispatched;
Vector4 statusColor = p.Failed ? Warn : waitingForLogin ? Gold : p.Initialized ? Good : TextMute;
string statusText = p.Failed ? "FAILED" : waitingForLogin ? "WAIT LOGIN" : p.Initialized ? "ACTIVE" : "PENDING";
string ver = string.IsNullOrEmpty(p.VersionString) ? "" : $" v{p.VersionString}";
ImGui.BulletText("");
ImGui.SameLine();
ImGui.TextColored(Accent, p.DisplayName);
ImGui.SameLine();
ImGui.TextColored(TextMute, ver);
ImGui.SameLine(280f);
ImGui.TextColored(statusColor, statusText);
ImGui.TextColored(TextMute, $" {p.SourceFilePath}");
}
}
ImGui.Spacing();
ImGui.Spacing();
// ── Plugin sources ──────────────────────────────────────────────────
ImGui.TextColored(Accent, "Plugin Sources");
ImGui.Separator();
string builtInDir = PluginManager.PluginDirectory;
if (!string.IsNullOrEmpty(builtInDir))
{
ImGui.TextColored(TextMute, "Built-in directory:");
ImGui.SameLine();
ImGui.TextColored(TextDim, builtInDir);
}
ImGui.Spacing();
ImGui.TextColored(TextMute, "Additional plugin DLLs:");
var extraPaths = PluginManager.ExtraPluginPaths;
int removeIdx = -1;
if (extraPaths.Count == 0)
{
ImGui.TextColored(TextMute, " (none)");
}
else
{
for (int i = 0; i < extraPaths.Count; i++)
{
ImGui.PushID($"pluginpath_{i}");
bool exists = File.Exists(extraPaths[i]);
ImGui.TextColored(exists ? Good : Warn, exists ? " OK" : " ??");
ImGui.SameLine();
ImGui.TextColored(TextDim, extraPaths[i]);
ImGui.SameLine();
if (ImGui.SmallButton("Remove"))
removeIdx = i;
ImGui.PopID();
}
}
if (removeIdx >= 0)
{
EngineSettings.RemovePluginPath(removeIdx);
PluginManager.RequestRescan();
}
ImGui.Spacing();
ImGui.TextColored(TextMute, "Add plugin DLL path:");
ImGui.SetNextItemWidth(-80f);
ImGui.InputText("##newpath", ref _newPluginPathInput, 512);
ImGui.SameLine();
bool canAdd = !string.IsNullOrWhiteSpace(_newPluginPathInput);
if (!canAdd) ImGui.BeginDisabled();
if (ImGui.SmallButton("Add"))
{
EngineSettings.AddPluginPath(_newPluginPathInput.Trim());
_newPluginPathInput = "";
PluginManager.RequestRescan();
}
if (!canAdd) ImGui.EndDisabled();
ImGui.Spacing();
ImGui.Separator();
ImGui.Spacing();
if (ImGui.Button("Rescan Plugins"))
PluginManager.RequestRescan();
ShowTooltip("Unload all plugins, re-scan built-in directory and all extra paths, reload.");
}
private static void RenderCompatibilityDeck()
{
ClientActionHookStatus status = ClientActionHooks.GetStatus();

View file

@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;
namespace RynthCore.Engine.Plugins;
internal static class EngineSettings
{
private static readonly string SettingsPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"RynthCore",
"engine.json");
private static List<string> _pluginPaths = new();
private static bool _loaded;
public static IReadOnlyList<string> PluginPaths
{
get
{
EnsureLoaded();
return _pluginPaths;
}
}
public static void AddPluginPath(string path)
{
EnsureLoaded();
string full = Path.GetFullPath(path);
for (int i = 0; i < _pluginPaths.Count; i++)
{
if (string.Equals(_pluginPaths[i], full, StringComparison.OrdinalIgnoreCase))
return;
}
_pluginPaths.Add(full);
Save();
}
public static void RemovePluginPath(int index)
{
EnsureLoaded();
if (index >= 0 && index < _pluginPaths.Count)
{
_pluginPaths.RemoveAt(index);
Save();
}
}
private static void EnsureLoaded()
{
if (_loaded) return;
_loaded = true;
try
{
if (!File.Exists(SettingsPath)) return;
using var doc = JsonDocument.Parse(File.ReadAllBytes(SettingsPath));
if (doc.RootElement.TryGetProperty("PluginPaths", out var arr) &&
arr.ValueKind == JsonValueKind.Array)
{
foreach (var el in arr.EnumerateArray())
{
string? val = el.GetString();
if (!string.IsNullOrWhiteSpace(val))
_pluginPaths.Add(val);
}
}
}
catch (Exception ex)
{
RynthLog.Plugin($"EngineSettings: Failed to load {SettingsPath}: {ex.Message}");
}
}
private static void Save()
{
try
{
string? dir = Path.GetDirectoryName(SettingsPath);
if (dir != null) Directory.CreateDirectory(dir);
using var ms = new MemoryStream();
using (var w = new Utf8JsonWriter(ms, new JsonWriterOptions { Indented = true }))
{
w.WriteStartObject();
w.WriteStartArray("PluginPaths");
foreach (string p in _pluginPaths)
w.WriteStringValue(p);
w.WriteEndArray();
w.WriteEndObject();
}
File.WriteAllBytes(SettingsPath, ms.ToArray());
}
catch (Exception ex)
{
RynthLog.Plugin($"EngineSettings: Failed to save: {ex.Message}");
}
}
}

View file

@ -106,6 +106,12 @@ internal static class PluginLoader
}
}
public static LoadedPlugin? LoadSingle(string sourcePath, string shadowRootDir, int generation)
{
string sessionShadowDir = PrepareShadowDirectory(shadowRootDir, generation);
return TryLoad(sourcePath, sessionShadowDir);
}
private static LoadedPlugin? TryLoad(string sourcePath, string sessionShadowDir)
{
string fileName = Path.GetFileName(sourcePath);

View file

@ -196,6 +196,7 @@ internal static class PluginManager
public static IReadOnlyList<LoadedPlugin> Plugins => _plugins;
public static bool IsRescanQueued => _rescanRequested;
public static string PluginDirectory => _pluginsDir;
public static IReadOnlyList<string> ExtraPluginPaths => EngineSettings.PluginPaths;
public static bool HasObservedUIInitialized => _uiInitializedObserved;
public static bool HasObservedLoginComplete => _loginCompleteObserved;
@ -1493,8 +1494,26 @@ internal static class PluginManager
private static void LoadPluginsFromDisk()
{
_loadGeneration++;
// Default directory
var loaded = PluginLoader.LoadAll(_pluginsDir, _shadowRootDir, _loadGeneration);
_plugins.AddRange(loaded);
// Extra DLL paths from engine settings
var extraPaths = EngineSettings.PluginPaths;
for (int i = 0; i < extraPaths.Count; i++)
{
string dllPath = extraPaths[i];
if (!File.Exists(dllPath))
{
RynthLog.Plugin($"PluginManager: Extra plugin not found: {dllPath}");
continue;
}
RynthLog.Plugin($"PluginManager: Loading extra plugin: {dllPath}");
var plugin = PluginLoader.LoadSingle(dllPath, _shadowRootDir, _loadGeneration);
if (plugin != null)
_plugins.Add(plugin);
}
}
private static void InitializeLoadedPlugins()