rpfm_lib/files/detection.rs
1//---------------------------------------------------------------------------//
2// Copyright (c) 2017-2026 Ismael Gutiérrez González. All rights reserved.
3//
4// This file is part of the Rusted PackFile Manager (RPFM) project,
5// which can be found here: https://github.com/Frodo45127/rpfm.
6//
7// This file is licensed under the MIT license, which can be found here:
8// https://github.com/Frodo45127/rpfm/blob/master/LICENSE.
9//---------------------------------------------------------------------------//
10
11//! Paths and extensions used to detect the [`FileType`] of formats that can be disabled through cargo features.
12//!
13//! They live outside their format's module so [`RFile::guess_file_type`] detects these files even
14//! when their format is disabled. Each format's module re-exports its own.
15//!
16//! [`FileType`]: super::FileType
17//! [`RFile::guess_file_type`]: super::RFile::guess_file_type
18
19/// Detection data of Anim files.
20pub mod anim {
21
22 /// Extension for animation files.
23 pub const EXTENSION: &str = ".anim";
24}
25
26/// Detection data of AnimPack files.
27pub mod animpack {
28
29 /// File extension for AnimPack files.
30 ///
31 /// AnimPacks use the `.animpack` extension to distinguish them from other
32 /// container formats like PackFiles (`.pack`).
33 pub const EXTENSION: &str = ".animpack";
34}
35
36/// Detection data of AnimsTable files.
37pub mod anims_table {
38
39 /// Base directory path for animation files.
40 pub const BASE_PATH: &str = "animations/";
41
42 /// File extension pattern for animation table files.
43 ///
44 /// To differentiate animation tables from other `.bin` files, RPFM only recognizes
45 /// files ending in `_tables.bin` as AnimsTable files.
46 ///
47 /// **Note**: This is a library-specific requirement for disambiguation, not a game
48 /// limitation. The game itself doesn't require this specific naming pattern.
49 pub const EXTENSION: &str = "_tables.bin";
50}
51
52/// Detection data of AnimFragmentBattle files.
53pub mod anim_fragment_battle {
54
55 /// Base directory path for animation files.
56 pub const BASE_PATH: &str = "animations/";
57
58 /// Middle path component for battle animations.
59 pub const MID_PATH: &str = "/battle/";
60
61 /// Modern file extension for animation fragment files.
62 pub const EXTENSION_NEW: &str = ".bin";
63
64 /// Legacy file extension for animation fragment files.
65 pub const EXTENSION_OLD: &str = ".frg";
66}
67
68/// Detection data of MatchedCombat files.
69pub mod matched_combat {
70
71 /// Matched combat files go under these folders.
72 pub const BASE_PATHS: [&str; 3] = ["animations/matched_combat", "animations/database/matched", "animations/database/trigger"];
73
74 /// Extension of MatchedCombat files.
75 pub const EXTENSION: &str = ".bin";
76}
77
78/// Detection data of GroupFormations files.
79pub mod group_formations {
80
81 /// Fixed path to the Group Formations file.
82 pub const PATH: &str = "groupformations.bin";
83}
84
85/// Detection data of SoundBank files.
86pub mod sound_bank {
87
88 /// Extension used by SoundBank files.
89 pub const EXTENSION: &str = ".bnk";
90}
91
92/// Detection data of Audio files.
93pub mod audio {
94
95 /// Extension used by audio files.
96 pub const EXTENSIONS: [&str; 3] = [".mp3", ".wem", ".wav"];
97}
98
99/// Detection data of UIC files.
100pub mod uic {
101
102 /// Path where all uics are in.
103 pub const BASE_PATH: &str = "ui";
104
105 /// Extension of UIC files in some games (they don't have extensions in some games).
106 pub const EXTENSIONS: [&str; 2] = [".cml", ".xml"];
107}
108
109/// Detection data of PortraitSettings files.
110pub mod portrait_settings {
111
112 /// Extension used by portrait settings files.
113 pub const EXTENSION: &str = ".bin";
114}
115
116/// Detection data of Font files.
117pub mod font {
118
119 /// File extension for CUF font files.
120 pub const EXTENSION: &str = ".cuf";
121}
122
123/// Detection data of Atlas files.
124pub mod atlas {
125
126 /// File extension for atlas files.
127 pub const EXTENSION: &str = ".atlas";
128}
129
130/// Detection data of Dat files.
131pub mod dat {
132
133 /// File extension for DAT audio configuration files.
134 pub const EXTENSION: &str = ".dat";
135}
136
137/// Detection data of TradeRoutes files.
138pub mod trade_routes {
139
140 /// File extension of trade routes files.
141 pub const EXTENSION: &str = ".ptd";
142}
143
144/// Detection data of UnitVariant files.
145pub mod unit_variant {
146
147 /// Extension used by UnitVariants.
148 pub const EXTENSION: &str = ".unit_variant";
149}
150
151/// Detection data of HlslCompiled files.
152pub mod hlsl_compiled {
153
154 /// File extension for HLSL compiled shader files.
155 pub const EXTENSION: &str = ".hlsl_compiled";
156}
157
158/// Detection data of Image files.
159pub mod image {
160
161 /// Extensions used by Images.
162 pub const EXTENSIONS: [&str; 6] = [
163 ".jpg",
164 ".jpeg",
165 ".tga",
166 ".dds",
167 ".png",
168 ".gif"
169 ];
170}