The ImGui developer-tools stack (AcDream.UI.ImGui), UI Studio (src/AcDream.App/Studio), and the DevToolsFramePresenter/ SettingsDevToolsCompositionPhase ImGui composition machinery are removed. Vulkan never composed a DevTools frontend (DevToolsEnabled already forced false whenever the backend was Vulkan); this commit makes that permanent by deleting the only implementation rather than leaving a dead branch behind. What moved: Studio/SampleData.cs is a live production dependency (InteractionRetainedUiComposition's character-sheet fallback, plus three UI.Layout test files) - git mv'd to src/AcDream.App/UI/Layout/SampleData.cs, namespace AcDream.App.UI.Layout, and trimmed to the SampleCharacter API that is actually still called (BuildObjectTable/AddItem/AddEquipped/the item-guid and icon constants had zero callers left once the Studio fixture provider that used them was deleted). What survives as backend-neutral seams, per the tests that still exercise them: IDevToolsFrameLifecycle (moved into RenderFramePreparationController.cs, now always bound to null), IFramebufferDevToolsTarget/FramebufferDevToolsBinding in FramebufferResizeController.cs (its concrete DevToolsFramebufferTarget adapter is deleted), and IDevToolsGameplayCommands in GameplayInputCommandController.cs (DevToolsGameplayCommands becomes a documented no-op instead of forwarding to the deleted presenter). A follow-up re-homes Settings/Debug onto the retained UI through IPanelRenderer; until then keybind remapping falls back to editing keybinds.json. DevToolsEnabled is now `private const bool DevToolsEnabled = false`. RuntimeOptions.DevTools is unchanged and still reaches VulkanGraphicsContext for the optional debug-utils extensions; Program.cs now logs one line when ACDREAM_DEVTOOLS=1 explaining that the ImGui UI is gone and the flag is Vulkan-only now. Removed: AcDream.UI.ImGui (project + ImGui.NET/Silk.NET.OpenGL.Extensions.ImGui package refs), src/AcDream.App/Studio (minus SampleData.cs), DevToolsFramePresenter.cs and everything only it constructed (ISettingsDevToolsCompositionFactory, RetailSettingsDevToolsCompositionFactory, DevToolsCompositionOwner, IGameWindowSettingsDevToolsPublication, SettingsDevToolsOptionalDependencies, the "developer tools" shutdown-ledger stage and its DevTools-typed fields on IngressShutdownRoots/ RenderShutdownRoots), the ui-studio Program.cs verb, and the cimgui native manifest entries in GraphicalHostPlatformServices. GameWindow.cs's DevTools composition branch, its _vitalsVm/_debugVm/_devToolsComposition/ _devToolsFramePresenter/_devToolsCommandBus fields, and every settingsDevTools .DevTools?.* access across FrameRootComposition.cs/SessionPlayerComposition.cs are gone with it. Build green; complete Release solution suite 8,830 / 5 skips (App Tests 4,097/3 skips run standalone - one #250-family zero-allocation test flakes under the full parallel `dotnet test AcDream.slnx` run, a pre-existing, documented class unrelated to this change). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
160 lines
4.7 KiB
C#
160 lines
4.7 KiB
C#
using AcDream.App;
|
|
using AcDream.App.Plugins;
|
|
using AcDream.App.Platform;
|
|
using AcDream.App.Rendering;
|
|
using AcDream.Core.Plugins;
|
|
using AcDream.Runtime.Platform;
|
|
using Serilog;
|
|
|
|
GraphicalHostPlatformServices graphicalPlatform =
|
|
GraphicalHostPlatformServices.Resolve();
|
|
graphicalPlatform.ConfigureWindowBackend();
|
|
ApplicationPathSet applicationPaths = graphicalPlatform.Paths;
|
|
IReadOnlyList<string> migratedConfigurationFiles =
|
|
GraphicalLegacyConfigurationMigrator.Migrate(applicationPaths);
|
|
|
|
Log.Logger = new LoggerConfiguration()
|
|
.MinimumLevel.Debug()
|
|
.WriteTo.Console()
|
|
.CreateLogger();
|
|
foreach (string migratedConfigurationFile in migratedConfigurationFiles)
|
|
{
|
|
Log.Information(
|
|
"migrated legacy graphical configuration to {Path}",
|
|
migratedConfigurationFile);
|
|
}
|
|
Log.Information(
|
|
"graphical platform {RuntimeIdentifier}; native closure: {NativeDependencies}",
|
|
graphicalPlatform.RuntimeIdentifier,
|
|
string.Join(
|
|
", ",
|
|
graphicalPlatform.NativeDependencies.Select(
|
|
dependency =>
|
|
$"{dependency.Feature}={dependency.PublishedFileName}")));
|
|
|
|
var datDir = args.FirstOrDefault() ?? Environment.GetEnvironmentVariable("ACDREAM_DAT_DIR");
|
|
if (string.IsNullOrWhiteSpace(datDir))
|
|
{
|
|
Log.Error("usage: AcDream.App <dat-directory> (or set ACDREAM_DAT_DIR)");
|
|
return 2;
|
|
}
|
|
|
|
// Single read of the startup-time process environment. Every downstream
|
|
// consumer (GameWindow + collaborators) reads the typed bundle, not the
|
|
// raw env vars. See docs/architecture/code-structure.md §2 Rule 4.
|
|
var runtimeOptions = RuntimeOptions.FromEnvironment(datDir);
|
|
|
|
if (runtimeOptions.DevTools)
|
|
{
|
|
Log.Information(
|
|
"ACDREAM_DEVTOOLS=1: the ImGui developer UI was removed at Campaign V " +
|
|
"slice V11 along with the OpenGL backend it required; this flag now " +
|
|
"only selects the optional Vulkan validation/debug-utils extensions.");
|
|
}
|
|
|
|
var worldGameState = new AcDream.Core.Plugins.WorldGameState();
|
|
var worldEvents = new AcDream.Core.Plugins.WorldEvents();
|
|
var uiRegistry = new AcDream.App.Plugins.BufferedUiRegistry();
|
|
using var window = new GameWindow(
|
|
runtimeOptions,
|
|
worldGameState,
|
|
worldEvents,
|
|
uiRegistry,
|
|
graphicalPlatform);
|
|
var host = new AppPluginHost(
|
|
new SerilogAdapter(Log.Logger),
|
|
worldGameState,
|
|
worldEvents,
|
|
window.Selection,
|
|
uiRegistry);
|
|
|
|
var loaded = new List<LoadedPlugin>();
|
|
var loadedPluginIds = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
|
StringComparer pathComparer =
|
|
graphicalPlatform.OperatingSystem
|
|
== GraphicalHostOperatingSystem.Windows
|
|
? StringComparer.OrdinalIgnoreCase
|
|
: StringComparer.Ordinal;
|
|
string[] pluginRoots =
|
|
[
|
|
.. new[]
|
|
{
|
|
Path.Combine(AppContext.BaseDirectory, "plugins"),
|
|
applicationPaths.PluginsDirectory,
|
|
}.Distinct(pathComparer),
|
|
];
|
|
|
|
foreach (string pluginsDir in pluginRoots)
|
|
{
|
|
Log.Information("scanning plugins in {PluginsDir}", pluginsDir);
|
|
foreach (var result in PluginDiscovery.Scan(pluginsDir))
|
|
{
|
|
if (!result.Success)
|
|
{
|
|
Log.Warning(
|
|
"plugin discovery failed for {Dir}: {Error}",
|
|
result.PluginDirectory,
|
|
result.Error);
|
|
continue;
|
|
}
|
|
|
|
if (loadedPluginIds.Contains(result.Manifest!.Id))
|
|
{
|
|
Log.Warning(
|
|
"skipping duplicate plugin id {Id} from {Dir}",
|
|
result.Manifest.Id,
|
|
result.PluginDirectory);
|
|
continue;
|
|
}
|
|
|
|
var loadResult = PluginLoader.Load(
|
|
result.PluginDirectory,
|
|
result.Manifest,
|
|
host);
|
|
if (!loadResult.Success)
|
|
{
|
|
Log.Warning(
|
|
"plugin load failed for {Id}: {Error}",
|
|
result.Manifest.Id,
|
|
loadResult.Error);
|
|
continue;
|
|
}
|
|
|
|
loadedPluginIds.Add(result.Manifest.Id);
|
|
loaded.Add(loadResult);
|
|
Log.Information(
|
|
"loaded plugin {Id} ({DisplayName})",
|
|
result.Manifest.Id,
|
|
result.Manifest.DisplayName);
|
|
}
|
|
}
|
|
|
|
try
|
|
{
|
|
foreach (var plugin in loaded)
|
|
{
|
|
try { plugin.Plugin!.Enable(); }
|
|
catch (Exception ex) { Log.Error(ex, "plugin enable failed: {Id}", plugin.Manifest.Id); }
|
|
}
|
|
|
|
try
|
|
{
|
|
window.Run();
|
|
}
|
|
catch (NotSupportedException error)
|
|
{
|
|
Log.Error("{GraphicalStartupFailure}", error.Message);
|
|
return 4;
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
foreach (var plugin in loaded)
|
|
{
|
|
try { plugin.Plugin!.Disable(); }
|
|
catch (Exception ex) { Log.Error(ex, "plugin disable failed: {Id}", plugin.Manifest.Id); }
|
|
}
|
|
Log.CloseAndFlush();
|
|
}
|
|
|
|
return 0;
|