1use serde::{Deserialize, Serialize};
2use serde_with::skip_serializing_none;
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
5#[serde(default)]
6pub struct DisplayConfig {
7 pub api_name: String,
8 pub width: u32,
9 pub height: u32,
10 pub depth: u32,
11 pub card_id: u32,
12 pub fullscreen: u32,
13}
14
15impl Default for DisplayConfig {
16 fn default() -> Self {
17 Self {
18 api_name: "OpenGL".to_string(),
19 width: 1024,
20 height: 768,
21 depth: 32,
22 card_id: 0,
23 fullscreen: 0,
24 }
25 }
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
29#[serde(default)]
30pub struct LanguageConfig {
31 pub language: String,
32}
33
34impl Default for LanguageConfig {
35 fn default() -> Self {
36 Self {
37 language: "English".to_string(),
38 }
39 }
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize)]
43#[serde(default)]
44pub struct DetailConfig {
45 pub language: String,
46 pub volumetric_shadows: u32,
47 pub snowflakes_lit: u32,
48 pub snowflakes_cast_shadow: u32,
49 pub ai_lit: u32,
50 pub ai_trail: u32,
51 pub ai_shadow: u32,
52 pub ai_particles: u32,
53 pub player_lit: u32,
54 pub player_trail: u32,
55 pub player_shadow: u32,
56 pub player_snow_particles: u32,
57 pub enable_joystick: u32,
58 pub amount_of_snowflakes: u32,
59 pub playable: u32,
60 pub editable: u32,
61 pub enable_net_game: u32,
62 pub benchmark_mode: u32,
63 pub objects_draw_mode: u32,
64 pub enable_texturing: u32,
65 pub disable_pmf_saving: u32,
66 pub force_hx_reload: u32,
67 pub enable_fog: u32,
68 pub visibility_cube_width: u32,
69 pub texture_resolution: String,
70 pub texture_type: String,
71 pub object_location_offset_x: i32,
72 pub object_location_offset_z: i32,
73 pub override_trimesh_name: String,
74 pub override_material_name: String,
75 pub ground_detail: u32,
76 pub video_width: u32,
77 pub video_height: u32,
78}
79
80impl Default for DetailConfig {
81 fn default() -> Self {
82 Self {
83 language: "English".to_string(),
84 volumetric_shadows: 1,
85 snowflakes_lit: 1,
86 snowflakes_cast_shadow: 1,
87 ai_lit: 1,
88 ai_trail: 1,
89 ai_shadow: 1,
90 ai_particles: 1,
91 player_lit: 1,
92 player_trail: 1,
93 player_shadow: 1,
94 player_snow_particles: 1,
95 enable_joystick: 1,
96 amount_of_snowflakes: 1,
97 playable: 1,
98 editable: 1,
99 enable_net_game: 1,
100 benchmark_mode: 0,
101 objects_draw_mode: 1,
102 enable_texturing: 1,
103 disable_pmf_saving: 1,
104 force_hx_reload: 1,
105 enable_fog: 0,
106 visibility_cube_width: 450,
107 texture_resolution: "Very high".to_string(),
108 texture_type: "24 Bit".to_string(),
109 object_location_offset_x: 0,
110 object_location_offset_z: 0,
111 override_trimesh_name: String::new(),
112 override_material_name: String::new(),
113 ground_detail: 3,
114 video_width: 1024,
115 video_height: 768,
116 }
117 }
118}
119
120#[derive(Debug, Clone, Serialize, Deserialize)]
121#[serde(default)]
122pub struct SoundConfig {
123 pub enable_sound_system: u32,
124 pub enable_music: u32,
125 pub enable_16bit: u32,
126 pub enable_stereo: u32,
127 pub mix_rate: u32,
128 pub mix_buff_len_ms: u32,
129 pub poll_rate: u32,
130 pub amplification_percent: u32,
131 pub sample_channel_num: u32,
132 pub stream_channel_num: u32,
133}
134
135impl Default for SoundConfig {
136 fn default() -> Self {
137 Self {
138 enable_sound_system: 1,
139 enable_music: 1,
140 enable_16bit: 1,
141 enable_stereo: 1,
142 mix_rate: 22050,
143 mix_buff_len_ms: 250,
144 poll_rate: 20,
145 amplification_percent: 1000,
146 sample_channel_num: 16,
147 stream_channel_num: 2,
148 }
149 }
150}
151
152#[derive(Debug, Clone, Serialize, Deserialize)]
153pub struct GameDefaults {
154 pub control_device: String,
155 pub qualification_mode: String,
156 pub guide: u32,
157 pub attack_players: u32,
158 pub attack_plrs_locked: u32,
159 pub available_tracks: u32,
160 pub default_gfx_quality: String,
161 pub default_environment: String,
162 pub default_level: String,
163 pub default_daytime: String,
164 pub default_character: String,
165 pub default_board: String,
166 pub default_stance: String,
167 pub default_graphics_detail: String,
168 pub default_hall_of_fame_track: String,
169 pub music_volume: String,
170 pub effects_volume: String,
171}
172
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(rename_all = "camelCase", default)]
175pub struct TrainerConfig {
176 pub use4x_fonts: bool,
177 pub change_fov: bool,
178 pub fov_width: u32,
179 pub fov_height: u32,
180 pub make_ghosts_opaque: bool,
181 pub match_ghost_sounds_to_character: bool,
182 pub enable_logging: bool,
183 pub disable_direct_input: bool,
184 pub enable_custom_controls: bool,
185 pub hide_blinking_r: bool,
186 pub show_replay_speed: bool,
187}
188
189impl Default for TrainerConfig {
190 fn default() -> Self {
191 TrainerConfig {
192 use4x_fonts: true,
193 change_fov: true,
194 fov_width: 4,
195 fov_height: 3,
196 make_ghosts_opaque: false,
197 match_ghost_sounds_to_character: true,
198 enable_logging: false,
199 disable_direct_input: true,
200 enable_custom_controls: true,
201 hide_blinking_r: false,
202 show_replay_speed: true,
203 }
204 }
205}
206
207#[skip_serializing_none]
208#[derive(Debug, Clone, Serialize, Deserialize, Default)]
209#[serde(default)]
210pub struct MaterialConfig {
211 pub material_name: Option<String>,
212 pub friction_factor: Option<f32>,
213 pub fluid_friction_factor: Option<f32>,
214 pub direction_friction_factor: Option<f32>,
215 pub snow_depth_player: Option<f32>,
216 pub snow_depth: Option<f32>,
217 pub snow_solidity: Option<f32>,
218 pub snow_trail_width: Option<f32>,
219 pub player_fall: Option<f32>,
220 pub dust_amount: Option<f32>,
221 pub stream_amount: Option<f32>,
222 pub ice_amount: Option<f32>,
223 pub grass_amount: Option<f32>,
224 pub sparcle_amount: Option<f32>,
225 pub sound_riding: Option<String>,
226 pub sound_riding_volume: Option<f32>,
227 pub sound_riding_frequency: Option<f32>,
228 pub sound_riding_effect: Option<f32>,
229 pub sound_canting: Option<String>,
230 pub sound_canting_volume: Option<f32>,
231 pub sound_canting_frequency: Option<f32>,
232 pub sound_canting_effect: Option<f32>,
233 pub sound_jump: Option<String>,
234 pub sound_jump_volume: Option<f32>,
235 pub sound_jump_frequency: Option<f32>,
236 pub sound_jump_effect: Option<f32>,
237 pub sound_landing: Option<String>,
238 pub sound_landing_volume: Option<f32>,
239 pub sound_landing_frequency: Option<f32>,
240 pub sound_landing_effect: Option<f32>,
241 pub texture_file: Option<String>,
242 pub texture_u: Option<f32>,
243 pub texture_v: Option<f32>,
244 pub texture_u_offset: Option<f32>,
245 pub texture_v_offset: Option<f32>,
246 pub texture_u_offset_delta: Option<f32>,
247 pub texture_v_offset_delta: Option<f32>,
248}