Expand description
Dependencies management system for Total War modding.
This module provides a comprehensive system for managing and querying dependencies between mods and vanilla game files. It serves as a central cache for all reference data needed when editing DB tables, running diagnostics, or performing other operations that require knowledge of game data.
§Overview
The Dependencies struct is the core of this module. It manages three categories
of data:
-
Vanilla Files: Data from the game’s official PackFiles, cached on disk for fast loading. This includes all DB tables, Loc files, and other resources.
-
Vanilla Loose Files: Files in the game’s
/datafolder that aren’t packed, such as user-placed mods or extracted files. -
Parent Mod Files: Files from mods that the current pack depends on, loaded recursively based on the pack’s dependency list.
§Cache Structure
The dependencies cache is stored on disk in three .pak files for efficient
parallel loading:
.pak1: Build metadata and half of the vanilla files.pak2: Other half of vanilla files.pak3: Table/Loc indices, folder structure, and Assembly Kit tables
The cache is versioned and includes a build date to automatically invalidate when game files change or RPFM is updated.
§Reference Data
A key feature is building reference data for DB table foreign key relationships.
When a column references another table (e.g., unit_key referencing main_units),
the dependencies system provides:
- All valid values for the referenced column
- Lookup data for displaying human-readable names
- Detection of Assembly Kit-only tables
- Localised column value resolution
§Assembly Kit Integration
Some tables exist only in the Assembly Kit and not in game files. These are processed separately and stored in the cache as “asskit-only” tables. They’re useful for reference lookups but shouldn’t be used as templates for new tables.
§Usage Example
use rpfm_extensions::dependencies::Dependencies;
use rpfm_lib::schema::Schema;
// Load or generate dependencies cache
let mut deps = Dependencies::default();
deps.rebuild(
&Some(schema),
&["parent_mod.pack".to_string()],
Some(cache_path),
&game_info,
game_path,
secondary_path,
)?;
// Query a specific file
let file = deps.file("db/units_tables/data__", true, true, false)?;
// Get all DB tables of a specific type
let units = deps.db_data("units_tables", true, true)?;§Startpos Generation
This module provides functions to build startpos files for campaign mods:
build_starpos_pre: Prepares and launches the game with a user script that triggers startpos generation for the specified campaignbuild_starpos_post: Called after the game closes to import the generated startpos file back into the pack
The process handles game-specific quirks like different output paths, victory objectives extraction, and HLP/SPD data generation.
Structs§
- Dependencies
- Central dependencies manager for all reference data relevant to a Pack.
- Table
References - Reference data for a single column in a DB table.
Constants§
- GAMES_
NEEDING_ VICTORY_ OBJECTIVES - List of games that require victory objectives file handling.
- KEY_
DELETES_ TABLE_ NAME - Table name for the key deletes table used in datacoring.
- USER_
SCRIPT_ FILE_ NAME - Filename for the user script file used in startpos generation.
- VICTORY_
OBJECTIVES_ EXTRACTED_ FILE_ NAME - Extracted filename for victory objectives.
- VICTORY_
OBJECTIVES_ FILE_ NAME - Path to the victory objectives file within a pack.