Expand description
Per-session command dispatcher — where every Pack, schema, search, diagnostics and dependency operation actually runs.
Each Session spawns one task running background_loop. The loop
pulls (reply_sender, Command) pairs off the session’s mpsc channel,
handles the command synchronously against the session’s in-memory state
(open packs, dependency cache, settings cache, schema), and ships every
response back over the per-request reply_sender.
Running commands serially per session is what keeps state consistent
across many concurrent requests in the same session: a SavePack
followed by a ClosePack always sees the right Pack, even when the
WebSocket multiplexer is firing requests as fast as the client sends
them.
Telemetry: each dispatched command is recorded via
rpfm_telemetry::record_action so usage counters reflect what the
session actually did.
Constants§
- DEFAULT_
PACK_ 🔒EXT - Extension appended to
DEFAULT_PACK_STEMwhen materialising a new Pack’s filename. - DEFAULT_
PACK_ 🔒STEM - Stem used to seed names for newly created Packs (
new_pack.pack,new_pack_2.pack, …). - VANILLA_
FIXES_ NAME - Filename prefix for community-maintained vanilla loc fix TSVs in the
Total War Translation Hub repo (e.g.
vanilla_fixes_es.tsv). Each one carries fixes for vanilla loc bugs in a specific language; the suffix is the language code. - VANILLA_
LOC_ NAME - Filename of the per-game vanilla English Loc TSV bundled in the Total War Translation Hub repo. The translator compares mod loc entries against this file to detect rows that match vanilla and can be auto-translated from the official localisation.
Functions§
- background_
loop - The per-session command dispatcher.
- clipboard_
entries_ 🔒from_ paths - Expand selected paths into file path entries for the clipboard.
- command_
name 🔒 - Extracts the variant name (e.g.
"NewPack") from aCommandfor telemetry. - decode_
and_ 🔒send_ file - derive_
new_ 🔒pack_ name - Derives a unique pack name for new (unsaved) packs. Appends a numeric suffix (_2, _3, etc.) to the stem if the base name is already taken. Returns a name like “new_pack.pack”, “new_pack_2.pack”, etc.
- exe_
path 🔒 - In debug mode, this function returns the base folder of the repo. In release mode, it returns the folder where the executable of the program is.
- get_
pack 🔒 - Looks up a pack by key. If not found, sends a “Pack not found” error and returns
None. - git_
update_ 🔒check - Spawns an async task that checks for git updates for the given repository configuration,
sending the result back through
sender. - load_
schema 🔒 - Function to simplify logic for changing game selected.
- pack_
key_ 🔒from_ path - Converts a path to its string representation for use as a pack key.
- tr 🔒