TerbinService includes a set of integration helpers for locating and launching Farlands through Steam and Proton. These live under theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/FarlandsModdingTeam/TerbinProyect/llms.txt
Use this file to discover all available pages before exploring further.
TerbinService/Valve/ and TerbinLibrary/SteamFarlands/ directories and cover everything from reading Steam library manifests to launching a game through the steam:// protocol URL or a Proton compatibility layer binary.
SteamLocator
TerbinLibrary.SteamFarlands.SteamLocator is the low-level path resolver. Given a Steam AppID it walks every Steam library on the machine and returns the game’s installation directory.
GetGamePath(int appId)
- Calls the private
GetSteamLibraries()iterator to discover all library roots. - For each library root, constructs the path to the ACF manifest:
- Reads the manifest line by line looking for the
"installdir"key. - Returns
<library>/steamapps/common/<installdir>on the first match, ornullif the game is not found in any library.
Library discovery
GetSteamLibraries() finds library roots differently on each platform:
- Windows — reads
HKEY_CURRENT_USER\Software\Valve\Steam→SteamPathfrom the Windows registry. - Linux — checks
~/.steam/steamand~/.local/share/Steam.
steamapps/libraryfolders.vdf file in each root, extracting every "path" entry to include additional library locations (e.g. games installed on a secondary drive).
Farlands AppID constant
GetGamePath to resolve the Farlands install directory:
On Linux,
GetSteamLibraries() checks both the legacy ~/.steam/steam symlink path and the modern ~/.local/share/Steam data directory. Proton acts as a compatibility layer between these Steam libraries and Windows executables — see the Proton section below for how TerbinService handles Proton-launched instances.ManagerFarlands
TerbinLibrary.SteamFarlands.ManagerFarlands is the high-level game management helper. All members are static.
LaunchGame(string path) — launch directly
LaunchGame(string path) — launch directly
pPath using Process.Start with UseShellExecute = true and the executable’s own directory as WorkingDirectory. Returns false if the path is empty or the file does not exist; returns true if the process started successfully.Typical use: launching a modded instance from an absolute path.LaunchFarlandsBySteam() — launch via Steam protocol
LaunchFarlandsBySteam() — launch via Steam protocol
steam://run/2252680 protocol URL, which tells the Steam client to launch Farlands through its own launcher (respecting Steam overlay, cloud saves, etc.).Before opening the URL it calls SteamLocator.GetGamePath(KEY_FARLANDS) to verify the game is installed. Returns false if Farlands cannot be located; true if Steam was instructed to launch it.IsFarlands(string dir) — validate installation directory
IsFarlands(string dir) — validate installation directory
true if pDir exists as a directory and contains Farlands.exe at its root. Use this before trusting a user-supplied path.GetVersion() — read file version from the executable
GetVersion() — read file version from the executable
FileVersionInfo from Farlands.exe via FileVersionInfo.GetVersionInfo(path) and returns FileVersion ?? ProductVersion ?? "0.0.0". Returns an empty string if the game cannot be located or the file is missing.GetVersion() currently reads the Unity engine version embedded in the executable rather than the game’s own version. This is a known issue tracked with a [TODO] annotation in the source.GetRuteSteamFarlands() — resolve the Steam install path
GetRuteSteamFarlands() — resolve the Steam install path
SteamLocator.GetGamePath(KEY_FARLANDS). This is the canonical way for the rest of the service to obtain the Farlands installation path without coupling to SteamLocator directly.Manager.Configuration calls this method when building the default config.json on first run.GetDirectorySize(string path) — sum file sizes recursively
GetDirectorySize(string path) — sum file sizes recursively
pPath recursively and sums their FileInfo.Length values. Individual I/O exceptions on locked or inaccessible files are silently swallowed so the method always returns a best-effort total in bytes.GetDLCs(string manifestPath) — parse DLC AppIDs from an ACF manifest
GetDLCs(string manifestPath) — parse DLC AppIDs from an ACF manifest
pManifestPath line by line and collects every quoted key that can be parsed as an integer. In the Steam ACF format the DLC section contains numeric AppID keys as quoted strings, so this extraction logic captures them without a full VDF parser.Steam Static Class
TerbinService.Valve.Steam provides a single process-detection property:
IsOpenSteam returns true if either the main steam process or the steamwebhelper subprocess is currently running. Use this as a guard before attempting protocol URL launches or Proton invocations that require the Steam client to be active.
Proton
TerbinService.Valve.Proton provides the basic scaffolding for launching Windows game executables through the Proton compatibility layer on Linux.
LauncheGame(string pPath)— invokes Proton with therun <path>arguments to execute a Windows binary through the compatibility layer. The Proton binary path is stored in_rute_proton, which is populated from therute_protonconfiguration key.FindProton(out string pPathProton)— stub for automatic Proton installation detection. Returns the detected path via theoutparameter.
On Linux, Steam installs Proton as a versioned tool inside the Steam library (e.g.
~/.steam/steam/steamapps/common/Proton 9.0). TerbinService’s Proton helpers are designed to detect these installations automatically and use the configured rute_proton path as an override when automatic detection is insufficient.Configuration Keys Reference
The Steam and Proton helpers read their paths fromTerbinService/config/config.json via Manager.Configuration.GetConfg(...). The relevant keys and their TerbinConfiguration constants are:
| JSON key | Constant | Used by |
|---|---|---|
rute_steam | TerbinConfiguration.RUTE_STEAM | Steam library path override for SteamLocator / Proton |
rute_proton | TerbinConfiguration.RUTE_PROTON | Path to the Proton binary (Proton.LauncheGame) |
rute_proton_tmp | TerbinConfiguration.RUTE_PROTON_TMP | Temporary directory for Proton Wine prefix operations |
rute_farlands | TerbinConfiguration.RUTE_FARLANDS | Authoritative Farlands install path (auto-set from GetRuteSteamFarlands()) |
Manager.Configuration stores a Dictionary<string, string> in config/config.json. The Steam-related keys are optional — if they are absent, GetPredeterminated(key) returns null for them because no automatic default exists for rute_steam, rute_proton, or rute_proton_tmp: