Expand description
Pack validation and diagnostic checking system.
This module provides comprehensive validation for Total War mod packs, detecting common errors, potential issues, and best practice violations. Diagnostics help modders identify problems before they cause crashes or unexpected behavior in-game.
§Diagnostic Types
The system checks multiple aspects of a pack:
-
Table Diagnostics (
table): DB and Loc table validation- Invalid foreign key references
- Empty required fields (keys, values)
- Duplicate rows
- Orphaned localisation entries
-
Pack Diagnostics (
pack): Pack-level checks- Files conflicting with vanilla
- Missing declared dependencies
-
Dependency Diagnostics (
dependency): Cross-pack validation- References to non-existent files
- Circular dependencies
-
Portrait Settings Diagnostics (
portrait_settings): Unit portrait validation- Invalid art set references
- Missing variant definitions
-
Animation Fragment Diagnostics (
anim_fragment_battle): Animation validation- Invalid animation references
- Malformed fragment data
-
Text Diagnostics (
text): Script validation -
Config Diagnostics (
config): Configuration file validation
§Diagnostic Levels
Each diagnostic has an associated severity level:
- Error: Critical issues that will likely cause crashes or major problems
- Warning: Issues that may cause problems or indicate mistakes
- Info: Suggestions and informational notes
§Cell Position Encoding
For table diagnostics, the affected cells are encoded as (row, column) pairs:
(-1, -1): Affects the entire table(row, -1): Affects all columns in a single row(-1, column): Affects all rows in a single column(row, column): Affects a specific cell
§Filtering
Diagnostics can be filtered by:
- Ignored folders (skip entire directory trees)
- Ignored files (skip specific files)
- Ignored fields (skip specific table columns)
- Ignored diagnostic types
§Usage Example
use rpfm_extensions::diagnostics::Diagnostics;
let mut diagnostics = Diagnostics::default();
diagnostics.check(
&mut pack,
&mut dependencies,
&schema,
&game_info,
game_path,
&[], // Check all paths
false, // Don't check AK-only references
);
for result in diagnostics.results() {
println!("{}: {}", result.path(), result.message());
}Modules§
- anim_
fragment_ battle - Module with the structs and functions specific for
AnimFragmentBattlediagnostics. - config
- Module with the structs and functions specific for
Configdiagnostics. - dependency
- Module with the structs and functions specific for
Dependencydiagnostics. - pack
- Module with the structs and functions specific for
Packdiagnostics. - portrait_
settings - Module with the structs and functions specific for
PortraitSettingsdiagnostics. - table
- Module with the structs and functions specific for
Tablediagnostics. - text
- Module with the structs and functions specific for
Textdiagnostics.
Structs§
- Diagnostics
- Container for diagnostic check results and configuration.
Enums§
- Diagnostic
Level - Severity level of a diagnostic result.
- Diagnostic
Type - Wrapper enum for all diagnostic result types.
Traits§
- Diagnostic
Report - Trait for types that can report diagnostic information.