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, schema) and the process-wide
crate::settings::SETTINGS store, 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.
Enums§
- Delta
Merge 🔒Outcome - Outcome of a delta merge attempt: either a finished file ready to insert, or the conflicts blocking it.
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.
Functions§
- background_
loop - The per-session command dispatcher.
- cached_
lua_ 🔒api - This function returns the Lua scripting API of a game, rebuilding the cached one if it’s outdated.
- change_
encryption_ 🔒flag - Sets or clears one of the encryption flags of a pack, sending the result back.
- 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. - container_
path_ 🔒from_ disk_ path - Rebuilds the in-pack container path of a file extracted under
base_folder. - decode_
and_ 🔒send_ file - delta_
merge_ 🔒files - Delta-merges the decoded DB or Loc
sources(same type/table) against the vanilla/parent baseline, applying any already-knownresolutions. Seerpfm_extensions::mergefor the merge rules. - 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 🔒 - pack_
key_ 🔒from_ path - Converts a path to its string representation for use as a pack key.
- plugin_
script_ 🔒interpreter - Returns the interpreter command for a plugin script, based on its extension.
- tr 🔒
- unique_
pack_ 🔒key - Generate an unique pack key that does not conflict with any existing open packs.
Type Aliases§
- LuaApi
Cache 🔒 - Function to simplify logic for changing game selected. Cached Lua scripting API: the docs path and dependencies build date it was built from, and the API itself.