railroader-setons-special-s.../src/Main.cs
seton 4853015eff Profiler: new unified overlay module; absorb PhysicsOverlayGUI
Add a standalone Profiler module (S3.profiler.json, disabled by default)
that hosts the in-game frame-time overlay previously owned by Physics
Optimizer.  The overlay now adapts to whichever modules are enabled:

- Always shows: render + physics frame-time graph, timing report.
- Physics Optimizer section (if enabled): LOD fast-path and auto-freeze
  quick-toggles with live stats, debug car count line.
- Mesh LOD section (if enabled): total tracked cars, loco/freight split,
  per-LOD-level counts refreshed once per second.

PhysicsOptimizerModule retains only the Harmony patches and
CarDebugVisualizer; ShowOverlay/OverlayOpacity removed from PhysicsSettings.
MeshLodInjector gains GetLodStats() and GetLodLevel() for the overlay.
BBox material shader search now tries URP/Lit before Standard.
/rpf overlay toggle redirected to ProfilerOverlayGUI.Instance.
2026-06-25 19:06:46 -04:00

49 lines
1.8 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!;
private static ModuleRegistry _registry = null!;
public static bool Load(UnityModManager.ModEntry modEntry)
{
ModEntry = modEntry;
Log.Init(modEntry);
SettingsStore.Init(modEntry.Path);
_registry = new ModuleRegistry();
// 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;
}
}