Skip to main content

Documentation 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.

ServiceConfiguration is a static handler class that provides IPC access to Terbin’s persistent key-value configuration store. The store is backed by a Dictionary<string, string> serialized to config/config.json and managed by Manager.Configuration. Every other service in TerbinService reads configuration paths through this manager at runtime, so routes updated here take effect immediately on the next call.
UpdateRute (CodeServices.Create) is present in the source but its [TerbinExecutable] attribute is commented out in the current codebase. The attribute line reads //[TerbinExecutable((byte)CodeServices.Create, (byte)CodeServicesSection.Rute)]. Only ReadRute is actively registered and callable over IPC.

Configuration Keys

The following keys are defined as constants in TerbinConfiguration and are recognized by Manager.Configuration:
Key constantString valueDescriptionAuto-detected?
TerbinConfiguration.RUTE_FARLANDSrute_farlandsAbsolute path to the Farlands game installation directory.Yes — via ManagerFarlands.GetRuteSteamFarlands()
TerbinConfiguration.RUTE_INSTANCESrute_instancesDirectory where Terbin stores all game instance subdirectories.Yes — defaults to ~/Documents/TerbinInstances
TerbinConfiguration.RUTE_STORAGE_PLUGINSrute_pluginsDirectory where downloaded plugin archives are stored.Yes — defaults to ~/Documents/TerbinStorage
TerbinConfiguration.RUTE_STEAMrute_steamAbsolute path to the Steam installation.No — must be set manually
TerbinConfiguration.RUTE_PROTONrute_protonAbsolute path to the Proton installation used to run the game on Linux.No — must be set manually
TerbinConfiguration.RUTE_PROTON_TMPrute_proton_tmpTemporary directory used by Proton at runtime.No — must be set manually
On first startup, Manager.Configuration calls setPredeterminatedConfig() which auto-detects and persists rute_farlands, rute_instances, and rute_plugins. The Steam and Proton keys have no automatic defaults. Until they are explicitly set via UpdateRute, calling ReadRute for those keys will cause Manager.Configuration.GetConfg to throw an unhandled exception (the predeterminated lookup returns null, and GetConfg throws rather than returning null). The source also notes a TODO to manage Steam/Proton installation state and to move instances when their path changes.

Operations

Reads the configured path value for a given configuration key. Internally calls Manager.Configuration.GetConfg(keyRute). If the key is not in the stored dictionary, the manager attempts getPredeterminatedAndSave to fill in a default for the three auto-detected keys.Action bytes: (byte)CodeServices.Read, (byte)CodeServicesSection.Rute = 50

Request Payload

keyRute
char[]
required
The configuration key to read, encoded as a length-prefixed UTF-16 char array using Serialineitor.SerializeArray<char>. Use one of the string constants from the table above (e.g., "rute_farlands").

Response Payload

The response Status field indicates the result:
CodeStatusMeaning
SuccesKey found. The payload is a length-prefixed UTF-16 char array of the configured path.
AccesNullOrNotExistThe key was present in the dictionary but resolved to null. In practice this is not reached for the three auto-detected keys (they always have a default), and for the Steam/Proton keys GetConfg throws rather than returning null — so avoid calling ReadRute for rute_steam, rute_proton, or rute_proton_tmp before they have been set via UpdateRute.
ErrorNotPayloadThe request payload was empty or the deserialized key string was empty.
value
char[]
Present only when Status == Succes. The configured path value as a length-prefixed UTF-16 char array. Reconstruct the string with new string(Serialineitor.DeserializeArray<char>(ref bytes)).

Example

// Read rute_farlands
byte[] keyBytes = Serialineitor.SerializeArray<char>("rute_farlands".ToCharArray());

var response = await client.Communicate(
    (byte)CodeServices.Read,
    (byte)CodeServicesSection.Rute,
    keyBytes
);

if (response.Status == CodeStatus.Succes)
{
    byte[] pld = response.Payload;
    string path = new string(Serialineitor.DeserializeArray<char>(ref pld));
    Console.WriteLine($"Farlands path: {path}");
}
else if (response.Status == CodeStatus.AccesNullOrNotExist)
{
    Console.WriteLine("Key is not configured.");
}
Updates or inserts a configuration key-value pair. Internally calls Manager.Configuration.SetConfig(keyRute, newRute), which reads the current dictionary, sets data[keyRute] = newRute, and saves it back with JSonUtil.Save. After saving, OnChangeConfig is fired on a background task (100 ms delay) so other internal components can react to the change.
The [TerbinExecutable] attribute for this operation is currently commented out in ServiceConfiguration.cs. This means the endpoint is not registered in the IPC router and cannot be called over IPC in the current build. The method body is fully implemented and the attribute line can be uncommented to enable it.
Action bytes (when enabled): (byte)CodeServices.Create, (byte)CodeServicesSection.Rute = 50

Request Payload

keyRute
char[]
required
The configuration key to write, encoded as a length-prefixed UTF-16 char array.
newRute
char[]
required
The new path value, encoded as a length-prefixed UTF-16 char array.

Response

The response carries only a CodeStatus field (no payload body):
CodeStatusMeaning
SuccesKey updated and persisted successfully (CodeAcessJSonSave.Succes).
SerializeErrorThe config dictionary could not be serialized to JSON (CodeAcessJSonSave.ErrorSerialize).
AccesNullOrNotExistAny other failure result from SetConfig.
ErrorNotPayloadThe request payload was empty or newRute deserialized to null.

Example

Serialineitor s = new();
s.AddArray<char>("rute_steam".ToCharArray());
s.AddArray<char>("/home/user/.steam/steam".ToCharArray());

var response = await client.Communicate(
    (byte)CodeServices.Create,
    (byte)CodeServicesSection.Rute,
    s.Serialize()
);

if (response.Status == CodeStatus.Succes)
    Console.WriteLine("Steam path updated.");

Reading All Known Keys

Because there is no ReadAll operation for configuration, clients that need to display the full configuration state must issue one ReadRute request per key. The complete set of known keys is:
1

Read rute_farlands

await ReadRute("rute_farlands");
2

Read rute_instances

await ReadRute("rute_instances");
3

Read rute_plugins

await ReadRute("rute_plugins");
4

Read rute_steam

await ReadRute("rute_steam");
5

Read rute_proton

await ReadRute("rute_proton");
6

Read rute_proton_tmp

await ReadRute("rute_proton_tmp");

Build docs developers (and LLMs) love