railroader-setons-special-s.../src/Main.cs
seton 7acf6b6841 Core: log ring buffer and live module TrySetActive
Agents can read recent S3 log lines without scraping UMM files.
TrySetActive changes session state only, so benchmarks and MCP
can toggle modules without writing the UMM enabled flags.
2026-09-11 15:19:22 -04:00

51 lines
1.9 KiB
C#

using S3.Core;
using S3.Core.Ui;
using UnityModManagerNet;
namespace S3;
/// <summary>
/// UMM entry point for Seton's Special Sauce.
///
/// S³ is an umbrella "everything mod": a thin core that hosts independent,
/// optional modules (each disabled by default). The core initializes settings
/// storage, registers the modules, enables the ones turned on, and hands the
/// settings UI to <see cref="SettingsPanel"/>. Each module owns its own flat
/// settings file (see <see cref="SettingsStore"/>).
/// </summary>
public static class Main
{
internal static UnityModManager.ModEntry ModEntry { get; private set; } = null!;
public static ModuleRegistry Registry { get; private set; } = null!;
private static ModuleRegistry _registry = null!;
public static bool Load(UnityModManager.ModEntry modEntry)
{
ModEntry = modEntry;
Log.Init(modEntry);
SettingsStore.Init(modEntry.Path);
_registry = new ModuleRegistry();
Registry = _registry;
// Modules are registered here. Each module loads its own settings in its
// constructor. Order here is display order in the settings panel.
_registry.Register(new Modules.PhysicsOptimizer.PhysicsOptimizerModule());
_registry.Register(new Modules.MeshLod.MeshLodModule());
_registry.Register(new Modules.Profiler.ProfilerModule());
_registry.Register(new Modules.Popout.PopoutModule());
_registry.EnableConfigured();
ModConflicts.CheckAtLoad();
// Always-on core UI service: hosts Dear ImGui inside the game, intercepts
// the base-game map hotkey, and enforces popout<->in-game mutual exclusion.
UiService.Install();
modEntry.OnGUI = _ => SettingsPanel.Draw(_registry);
modEntry.OnSaveGUI = _ => _registry.SaveAll();
Log.Info("Seton's Special Sauce loaded.");
return true;
}
}