|
| 1 | +namespace Magos.Modificus.Steam; |
| 2 | + |
| 3 | +/// <summary> |
| 4 | +/// Steam discovery + game-running detection. Steam **discovers** everything |
| 5 | +/// needed to launch Darktide modded on the current OS (Steam install, Darktide |
| 6 | +/// install, compatdata, Proton version) and reports missing pieces via |
| 7 | +/// <see cref="DiscoveryResult.Status"/>; it does NOT set env vars or invoke |
| 8 | +/// Proton — that is Enginseer-client's job (consuming the <see cref="DiscoveryResult"/>). |
| 9 | +/// </summary> |
| 10 | +/// <remarks> |
| 11 | +/// <para><b>Phase 1 → Phase 3 stability:</b> the discovery result is a flat |
| 12 | +/// record of nullables — Phase 3 (UI) reads it and the null fields drive the |
| 13 | +/// escape-hatch prompt form. A future Phase (non-steam shortcuts, Phase 5) adds |
| 14 | +/// methods here; the interface is designed to grow cleanly.</para> |
| 15 | +/// </remarks> |
| 16 | +public interface ISteamService |
| 17 | +{ |
| 18 | + /// <summary> |
| 19 | + /// Probes the OS-appropriate Steam install locations and resolves the |
| 20 | + /// Steam install, Darktide install, compatdata, and Proton version. Never |
| 21 | + /// throws on missing pieces — those are reported via <see cref="DiscoveryResult.Status"/> |
| 22 | + /// + the nullable fields (the escape hatch). |
| 23 | + /// </summary> |
| 24 | + DiscoveryResult Discover(); |
| 25 | + |
| 26 | + /// <summary> |
| 27 | + /// Whether Darktide is currently running. Cross-platform best-effort check |
| 28 | + /// against the game's process name; Phase 1 uses the simple name match |
| 29 | + /// (Linux-under-Proton naming may differ — refine if it proves wrong). |
| 30 | + /// </summary> |
| 31 | + bool IsGameRunning(); |
| 32 | +} |
| 33 | + |
| 34 | +/// <summary> |
| 35 | +/// The outcome of a Steam discovery pass. Fields are nullable: a null means |
| 36 | +/// "couldn't resolve this — the UI should prompt for it" (the escape hatch). |
| 37 | +/// <see cref="Status"/> summarizes whether everything critical for the current |
| 38 | +/// OS was found. |
| 39 | +/// </summary> |
| 40 | +/// <param name="SteamInstallPath">Steam client dir → <c>STEAM_COMPAT_CLIENT_INSTALL_PATH</c>.</param> |
| 41 | +/// <param name="DarktideGameBinaryPath">Native path to <c>Darktide.exe</c> |
| 42 | +/// (Enginseer-client Z:\-translates on Linux for <c>--game-binary</c>).</param> |
| 43 | +/// <param name="CompatdataPath">Wine prefix → <c>STEAM_COMPAT_DATA_PATH</c> (Linux only).</param> |
| 44 | +/// <param name="ProtonBinaryPath">The <c>proton</c> script for <c>proton run</c> (Linux only).</param> |
| 45 | +/// <param name="ProtonVersion">Informational label (e.g. "Proton - Experimental").</param> |
| 46 | +/// <param name="Status">Complete / Partial / Failed — see <see cref="DiscoveryStatus"/>.</param> |
| 47 | +/// <param name="Warnings">Non-fatal notes (e.g. "Flatpak Steam detected", Proton-selection reason).</param> |
| 48 | +public sealed record DiscoveryResult( |
| 49 | + string? SteamInstallPath, |
| 50 | + string? DarktideGameBinaryPath, |
| 51 | + string? CompatdataPath, |
| 52 | + string? ProtonBinaryPath, |
| 53 | + string? ProtonVersion, |
| 54 | + DiscoveryStatus Status, |
| 55 | + IReadOnlyList<string> Warnings); |
| 56 | + |
| 57 | +/// <summary> |
| 58 | +/// Coarse status of a discovery pass: |
| 59 | +/// <list type="bullet"> |
| 60 | +/// <item><term>Complete</term><description>Every critical field for the current OS is non-null.</description></item> |
| 61 | +/// <item><term>Partial</term><description>Steam was located but some critical fields are missing |
| 62 | +/// (the nullables indicate what the UI should prompt for).</description></item> |
| 63 | +/// <item><term>Failed</term><description>Could not even locate Steam (UI prompts for the Steam dir).</description></item> |
| 64 | +/// </list> |
| 65 | +/// </summary> |
| 66 | +public enum DiscoveryStatus |
| 67 | +{ |
| 68 | + Complete, |
| 69 | + Partial, |
| 70 | + Failed, |
| 71 | +} |
| 72 | + |
| 73 | +/// <summary> |
| 74 | +/// The platform discovery runs against. Production picks this from the runtime |
| 75 | +/// OS; tests can force a platform to exercise cross-platform logic on one OS. |
| 76 | +/// Darktide ships on Windows (native) and Linux (Proton) only. |
| 77 | +/// </summary> |
| 78 | +public enum DiscoveryPlatform |
| 79 | +{ |
| 80 | + /// <summary>Linux: discovers Steam + Darktide + compatdata + Proton.</summary> |
| 81 | + Linux, |
| 82 | + |
| 83 | + /// <summary>Windows: discovers Steam + Darktide only (native; Proton/compatdata unused).</summary> |
| 84 | + Windows, |
| 85 | +} |
0 commit comments