Porytiles
Loading...
Searching...
No Matches
override_config_provider.cpp
Go to the documentation of this file.
2
3#include <string>
4#include <utility>
5
6// NOTE: DO NOT EDIT THIS FILE DIRECTLY. It is AUTO-GENERATED from config_schema.yaml.
7// To add new config values or make other changes, edit config_schema.yaml and regenerate via:
8//
9// uv run scripts/generate_config.py
10
11namespace porytiles {
12
13OverrideConfigProvider::OverrideConfigProvider(ConfigScopeType scope_type, std::string scope, std::string source_info)
14 : scope_type_{scope_type}, scope_{std::move(scope)}, source_info_{std::move(source_info)}
15{
16}
17
19{
20 return "OverrideConfigProvider(" + source_info_ + ")";
21}
22
23bool OverrideConfigProvider::scope_matches(ConfigScopeType type, const std::string &scope) const
24{
25 return type == scope_type_ && scope == scope_;
26}
27
29{
30 num_tiles_in_primary_override_ = std::move(value);
31}
32
34{
35 num_tiles_total_override_ = std::move(value);
36}
37
39{
40 num_metatiles_in_primary_override_ = std::move(value);
41}
42
44{
45 num_metatiles_total_override_ = std::move(value);
46}
47
49{
50 num_palettes_in_primary_override_ = std::move(value);
51}
52
54{
55 num_palettes_total_override_ = std::move(value);
56}
57
59{
60 max_map_data_size_override_ = std::move(value);
61}
62
64{
65 num_tiles_per_metatile_override_ = std::move(value);
66}
67
69{
70 extrinsic_transparency_override_ = std::move(value);
71}
72
74{
75 ignore_triple_layer_content_override_ = std::move(value);
76}
77
79{
80 tiles_edit_mode_override_ = std::move(value);
81}
82
84{
85 palettes_edit_mode_override_ = std::move(value);
86}
87
89{
90 palette_hints_enabled_override_ = std::move(value);
91}
92
93void OverrideConfigProvider::set_palette_hints(std::vector<PaletteHint> value)
94{
95 palette_hints_override_ = std::move(value);
96}
97
99{
100 packing_strategy_override_ = std::move(value);
101}
102
104{
105 packing_strategy_params_override_ = std::move(value);
106}
107
109{
110 tile_sharing_packing_override_ = std::move(value);
111}
112
114{
115 tile_sharing_alignment_override_ = std::move(value);
116}
117
119{
120 tiles_palette_mode_override_ = std::move(value);
121}
122
124{
125 global_anim_palette_resolution_strategy_override_ = std::move(value);
126}
127
129{
130 global_anim_key_frame_resolution_strategy_override_ = std::move(value);
131}
132
135{
136 global_anim_multi_palette_subtile_resolution_strategy_override_ = std::move(value);
137}
138
140{
141 global_frame_linking_override_ = std::move(value);
142}
143
145{
146 per_anim_overrides_override_ = std::move(value);
147}
148
150{
151 cross_tileset_anim_linking_override_ = std::move(value);
152}
153
155{
156 verify_checksums_override_ = std::move(value);
157}
158
160{
161 primary_pairing_mode_override_ = std::move(value);
162}
163
165{
166 primary_pairing_partners_override_ = std::move(value);
167}
168
170{
171 diagnostic_warnings_exclude_override_ = std::move(value);
172}
173
175{
176 diagnostic_warnings_include_override_ = std::move(value);
177}
178
180{
181 diagnostic_remarks_exclude_override_ = std::move(value);
182}
183
185{
186 diagnostic_remarks_include_override_ = std::move(value);
187}
188
190{
191 tileset_paths_primary_src_override_ = std::move(value);
192}
193
195{
196 tileset_paths_primary_bin_override_ = std::move(value);
197}
198
200{
201 tileset_paths_secondary_src_override_ = std::move(value);
202}
203
205{
206 tileset_paths_secondary_bin_override_ = std::move(value);
207}
208
209void OverrideConfigProvider::set_metatile_attribute_size(std::optional<std::size_t> value)
210{
211 metatile_attribute_size_override_ = std::move(value);
212}
213
215{
216 metatile_attribute_declaration_size_override_ = std::move(value);
217}
218
220{
221 metatile_attribute_fields_override_ = std::move(value);
222}
223
225{
226 metatile_attribute_field_overrides_override_ = std::move(value);
227}
228
230{
231 role_pins_override_ = std::move(value);
232}
233
235{
236 tileset_animations_wire_anim_code_override_ = std::move(value);
237}
238
241{
242 if (!scope_matches(type, scope) || !num_tiles_in_primary_override_.has_value()) {
244 }
245 return LayerValue<std::size_t>::valid(num_tiles_in_primary_override_.value(), "num_tiles_in_primary", source_info_);
246}
247
249{
250 if (!scope_matches(type, scope) || !num_tiles_total_override_.has_value()) {
252 }
253 return LayerValue<std::size_t>::valid(num_tiles_total_override_.value(), "num_tiles_total", source_info_);
254}
255
258{
259 if (!scope_matches(type, scope) || !num_metatiles_in_primary_override_.has_value()) {
261 }
263 num_metatiles_in_primary_override_.value(), "num_metatiles_in_primary", source_info_);
264}
265
268{
269 if (!scope_matches(type, scope) || !num_metatiles_total_override_.has_value()) {
271 }
272 return LayerValue<std::size_t>::valid(num_metatiles_total_override_.value(), "num_metatiles_total", source_info_);
273}
274
277{
278 if (!scope_matches(type, scope) || !num_palettes_in_primary_override_.has_value()) {
280 }
282 num_palettes_in_primary_override_.value(), "num_palettes_in_primary", source_info_);
283}
284
286{
287 if (!scope_matches(type, scope) || !num_palettes_total_override_.has_value()) {
289 }
290 return LayerValue<std::size_t>::valid(num_palettes_total_override_.value(), "num_palettes_total", source_info_);
291}
292
294{
295 if (!scope_matches(type, scope) || !max_map_data_size_override_.has_value()) {
297 }
298 return LayerValue<std::size_t>::valid(max_map_data_size_override_.value(), "max_map_data_size", source_info_);
299}
300
303{
304 if (!scope_matches(type, scope) || !num_tiles_per_metatile_override_.has_value()) {
306 }
308 num_tiles_per_metatile_override_.value(), "num_tiles_per_metatile", source_info_);
309}
310
312{
313 if (!scope_matches(type, scope) || !extrinsic_transparency_override_.has_value()) {
315 }
316 return LayerValue<Rgba32>::valid(extrinsic_transparency_override_.value(), "extrinsic_transparency", source_info_);
317}
318
321{
322 if (!scope_matches(type, scope) || !ignore_triple_layer_content_override_.has_value()) {
324 }
326 ignore_triple_layer_content_override_.value(), "ignore_triple_layer_content", source_info_);
327}
328
330OverrideConfigProvider::tiles_edit_mode(ConfigScopeType type, const std::string &scope) const
331{
332 if (!scope_matches(type, scope) || !tiles_edit_mode_override_.has_value()) {
334 }
335 return LayerValue<ArtifactEditMode>::valid(tiles_edit_mode_override_.value(), "tiles_edit_mode", source_info_);
336}
337
340{
341 if (!scope_matches(type, scope) || !palettes_edit_mode_override_.has_value()) {
343 }
345 palettes_edit_mode_override_.value(), "palettes_edit_mode", source_info_);
346}
347
349{
350 if (!scope_matches(type, scope) || !palette_hints_enabled_override_.has_value()) {
352 }
353 return LayerValue<bool>::valid(palette_hints_enabled_override_.value(), "palette_hints_enabled", source_info_);
354}
355
357OverrideConfigProvider::palette_hints(ConfigScopeType type, const std::string &scope) const
358{
359 if (!scope_matches(type, scope) || !palette_hints_override_.has_value()) {
361 }
362 return LayerValue<std::vector<PaletteHint>>::valid(palette_hints_override_.value(), "palette_hints", source_info_);
363}
364
367{
368 if (!scope_matches(type, scope) || !packing_strategy_override_.has_value()) {
370 }
371 return LayerValue<PackingStrategyType>::valid(packing_strategy_override_.value(), "packing_strategy", source_info_);
372}
373
376{
377 if (!scope_matches(type, scope) || !packing_strategy_params_override_.has_value()) {
379 }
381 packing_strategy_params_override_.value(), "packing_strategy_params", source_info_);
382}
383
386{
387 if (!scope_matches(type, scope) || !tile_sharing_packing_override_.has_value()) {
389 }
391 tile_sharing_packing_override_.value(), "tile_sharing_packing", source_info_);
392}
393
396{
397 if (!scope_matches(type, scope) || !tile_sharing_alignment_override_.has_value()) {
399 }
401 tile_sharing_alignment_override_.value(), "tile_sharing_alignment", source_info_);
402}
403
406{
407 if (!scope_matches(type, scope) || !tiles_palette_mode_override_.has_value()) {
409 }
411 tiles_palette_mode_override_.value(), "tiles_palette_mode", source_info_);
412}
413
416{
417 if (!scope_matches(type, scope) || !global_anim_palette_resolution_strategy_override_.has_value()) {
419 }
421 global_anim_palette_resolution_strategy_override_.value(),
422 "global_anim_palette_resolution_strategy",
423 source_info_);
424}
425
428{
429 if (!scope_matches(type, scope) || !global_anim_key_frame_resolution_strategy_override_.has_value()) {
431 }
433 global_anim_key_frame_resolution_strategy_override_.value(),
434 "global_anim_key_frame_resolution_strategy",
435 source_info_);
436}
437
440 ConfigScopeType type, const std::string &scope) const
441{
442 if (!scope_matches(type, scope) || !global_anim_multi_palette_subtile_resolution_strategy_override_.has_value()) {
444 }
446 global_anim_multi_palette_subtile_resolution_strategy_override_.value(),
447 "global_anim_multi_palette_subtile_resolution_strategy",
448 source_info_);
449}
450
453{
454 if (!scope_matches(type, scope) || !global_frame_linking_override_.has_value()) {
456 }
458 global_frame_linking_override_.value(), "global_frame_linking", source_info_);
459}
460
463{
464 if (!scope_matches(type, scope) || !per_anim_overrides_override_.has_value()) {
466 }
468 per_anim_overrides_override_.value(), "per_anim_overrides", source_info_);
469}
470
473{
474 if (!scope_matches(type, scope) || !cross_tileset_anim_linking_override_.has_value()) {
476 }
478 cross_tileset_anim_linking_override_.value(), "cross_tileset_anim_linking", source_info_);
479}
480
482{
483 if (!scope_matches(type, scope) || !verify_checksums_override_.has_value()) {
485 }
486 return LayerValue<bool>::valid(verify_checksums_override_.value(), "verify_checksums", source_info_);
487}
488
491{
492 if (!scope_matches(type, scope) || !primary_pairing_mode_override_.has_value()) {
494 }
496 primary_pairing_mode_override_.value(), "primary_pairing_mode", source_info_);
497}
498
501{
502 if (!scope_matches(type, scope) || !primary_pairing_partners_override_.has_value()) {
504 }
506 primary_pairing_partners_override_.value(), "primary_pairing_partners", source_info_);
507}
508
511{
512 if (!scope_matches(type, scope) || !diagnostic_warnings_exclude_override_.has_value()) {
514 }
516 diagnostic_warnings_exclude_override_.value(), "diagnostic_warnings_exclude", source_info_);
517}
518
521{
522 if (!scope_matches(type, scope) || !diagnostic_warnings_include_override_.has_value()) {
524 }
526 diagnostic_warnings_include_override_.value(), "diagnostic_warnings_include", source_info_);
527}
528
531{
532 if (!scope_matches(type, scope) || !diagnostic_remarks_exclude_override_.has_value()) {
534 }
536 diagnostic_remarks_exclude_override_.value(), "diagnostic_remarks_exclude", source_info_);
537}
538
541{
542 if (!scope_matches(type, scope) || !diagnostic_remarks_include_override_.has_value()) {
544 }
546 diagnostic_remarks_include_override_.value(), "diagnostic_remarks_include", source_info_);
547}
548
551{
552 if (!scope_matches(type, scope) || !tileset_paths_primary_src_override_.has_value()) {
554 }
556 tileset_paths_primary_src_override_.value(), "tileset_paths_primary_src", source_info_);
557}
558
561{
562 if (!scope_matches(type, scope) || !tileset_paths_primary_bin_override_.has_value()) {
564 }
566 tileset_paths_primary_bin_override_.value(), "tileset_paths_primary_bin", source_info_);
567}
568
571{
572 if (!scope_matches(type, scope) || !tileset_paths_secondary_src_override_.has_value()) {
574 }
576 tileset_paths_secondary_src_override_.value(), "tileset_paths_secondary_src", source_info_);
577}
578
581{
582 if (!scope_matches(type, scope) || !tileset_paths_secondary_bin_override_.has_value()) {
584 }
586 tileset_paths_secondary_bin_override_.value(), "tileset_paths_secondary_bin", source_info_);
587}
588
591{
592 if (!scope_matches(type, scope) || !metatile_attribute_size_override_.has_value()) {
594 }
596 metatile_attribute_size_override_.value(), "metatile_attribute_size", source_info_);
597}
598
601{
602 if (!scope_matches(type, scope) || !metatile_attribute_declaration_size_override_.has_value()) {
604 }
606 metatile_attribute_declaration_size_override_.value(), "metatile_attribute_declaration_size", source_info_);
607}
608
611{
612 if (!scope_matches(type, scope) || !metatile_attribute_fields_override_.has_value()) {
614 }
616 metatile_attribute_fields_override_.value(), "metatile_attribute_fields", source_info_);
617}
618
621{
622 if (!scope_matches(type, scope) || !metatile_attribute_field_overrides_override_.has_value()) {
624 }
626 metatile_attribute_field_overrides_override_.value(), "metatile_attribute_field_overrides", source_info_);
627}
628
630{
631 if (!scope_matches(type, scope) || !role_pins_override_.has_value()) {
633 }
634 return LayerValue<RolePinDefinitions>::valid(role_pins_override_.value(), "role_pins", source_info_);
635}
636
639{
640 if (!scope_matches(type, scope) || !tileset_animations_wire_anim_code_override_.has_value()) {
642 }
644 tileset_animations_wire_anim_code_override_.value(), "tileset_animations_wire_anim_code", source_info_);
645}
646
647} // namespace porytiles
LayerValue< std::string > tileset_paths_secondary_bin(ConfigScopeType type, const std::string &scope) const override
LayerValue< AnimMultiPaletteSubtileResolutionStrategy > global_anim_multi_palette_subtile_resolution_strategy(ConfigScopeType type, const std::string &scope) const override
void set_role_pins(RolePinDefinitions value)
LayerValue< PerAnimOverrides > per_anim_overrides(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::vector< std::string > > diagnostic_remarks_include(ConfigScopeType type, const std::string &scope) const override
void set_global_anim_key_frame_resolution_strategy(AnimKeyFrameResolutionStrategy value)
LayerValue< std::string > tileset_paths_primary_src(ConfigScopeType type, const std::string &scope) const override
LayerValue< RolePinDefinitions > role_pins(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::size_t > max_map_data_size(ConfigScopeType type, const std::string &scope) const override
LayerValue< FrameLinking > global_frame_linking(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::size_t > num_metatiles_in_primary(ConfigScopeType type, const std::string &scope) const override
void set_tileset_paths_secondary_src(std::string value)
LayerValue< std::size_t > num_palettes_in_primary(ConfigScopeType type, const std::string &scope) const override
void set_global_anim_palette_resolution_strategy(AnimPaletteResolutionStrategy value)
void set_metatile_attribute_fields(MetatileAttributeFieldDefinitions value)
LayerValue< bool > cross_tileset_anim_linking(ConfigScopeType type, const std::string &scope) const override
void set_palettes_edit_mode(ArtifactEditMode value)
void set_num_palettes_in_primary(std::size_t value)
LayerValue< AnimKeyFrameResolutionStrategy > global_anim_key_frame_resolution_strategy(ConfigScopeType type, const std::string &scope) const override
void set_num_metatiles_in_primary(std::size_t value)
OverrideConfigProvider(ConfigScopeType scope_type, std::string scope, std::string source_info)
Constructs an OverrideConfigProvider scoped to a single config scope.
void set_primary_pairing_mode(PrimaryPairingMode value)
void set_palette_hints(std::vector< PaletteHint > value)
LayerValue< PackingStrategyType > packing_strategy(ConfigScopeType type, const std::string &scope) const override
void set_packing_strategy(PackingStrategyType value)
LayerValue< std::vector< std::string > > diagnostic_warnings_exclude(ConfigScopeType type, const std::string &scope) const override
void set_tile_sharing_packing(TileSharingPacking value)
void set_tiles_palette_mode(TilesPaletteMode value)
void set_diagnostic_warnings_exclude(std::vector< std::string > value)
void set_metatile_attribute_field_overrides(MetatileAttributeFieldOverrides value)
LayerValue< bool > ignore_triple_layer_content(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::vector< std::string > > diagnostic_warnings_include(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::size_t > num_tiles_in_primary(ConfigScopeType type, const std::string &scope) const override
void set_tiles_edit_mode(ArtifactEditMode value)
LayerValue< std::optional< std::size_t > > metatile_attribute_declaration_size(ConfigScopeType type, const std::string &scope) const override
LayerValue< bool > tileset_animations_wire_anim_code(ConfigScopeType type, const std::string &scope) const override
void set_packing_strategy_params(PackingStrategyParams value)
LayerValue< PrimaryPairingMode > primary_pairing_mode(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::vector< std::string > > primary_pairing_partners(ConfigScopeType type, const std::string &scope) const override
void set_tileset_paths_primary_src(std::string value)
void set_metatile_attribute_size(std::optional< std::size_t > value)
void set_diagnostic_remarks_include(std::vector< std::string > value)
LayerValue< std::string > tileset_paths_secondary_src(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::size_t > num_palettes_total(ConfigScopeType type, const std::string &scope) const override
LayerValue< Rgba32 > extrinsic_transparency(ConfigScopeType type, const std::string &scope) const override
LayerValue< TilesPaletteMode > tiles_palette_mode(ConfigScopeType type, const std::string &scope) const override
void set_per_anim_overrides(PerAnimOverrides value)
void set_diagnostic_remarks_exclude(std::vector< std::string > value)
void set_tileset_paths_secondary_bin(std::string value)
LayerValue< bool > verify_checksums(ConfigScopeType type, const std::string &scope) const override
LayerValue< ArtifactEditMode > tiles_edit_mode(ConfigScopeType type, const std::string &scope) const override
std::string name() const override
Gets the name of this ConfigProvider, useful for diagnostic purposes.
void set_diagnostic_warnings_include(std::vector< std::string > value)
LayerValue< std::size_t > num_tiles_total(ConfigScopeType type, const std::string &scope) const override
void set_metatile_attribute_declaration_size(std::optional< std::size_t > value)
LayerValue< TileSharingAlignment > tile_sharing_alignment(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::vector< std::string > > diagnostic_remarks_exclude(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::vector< PaletteHint > > palette_hints(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::size_t > num_tiles_per_metatile(ConfigScopeType type, const std::string &scope) const override
LayerValue< TileSharingPacking > tile_sharing_packing(ConfigScopeType type, const std::string &scope) const override
LayerValue< PackingStrategyParams > packing_strategy_params(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::size_t > num_metatiles_total(ConfigScopeType type, const std::string &scope) const override
void set_tile_sharing_alignment(TileSharingAlignment value)
void set_primary_pairing_partners(std::vector< std::string > value)
LayerValue< AnimPaletteResolutionStrategy > global_anim_palette_resolution_strategy(ConfigScopeType type, const std::string &scope) const override
void set_tileset_paths_primary_bin(std::string value)
LayerValue< MetatileAttributeFieldOverrides > metatile_attribute_field_overrides(ConfigScopeType type, const std::string &scope) const override
LayerValue< MetatileAttributeFieldDefinitions > metatile_attribute_fields(ConfigScopeType type, const std::string &scope) const override
LayerValue< ArtifactEditMode > palettes_edit_mode(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::string > tileset_paths_primary_bin(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::optional< std::size_t > > metatile_attribute_size(ConfigScopeType type, const std::string &scope) const override
void set_global_anim_multi_palette_subtile_resolution_strategy(AnimMultiPaletteSubtileResolutionStrategy value)
LayerValue< bool > palette_hints_enabled(ConfigScopeType type, const std::string &scope) const override
Represents a 32-bit RGBA color.
Definition rgba32.hpp:21
PrimaryPairingMode
Controls how a secondary tileset finds its partner primary for compilation.
std::map< std::string, MetatileAttributeFieldOverride > MetatileAttributeFieldOverrides
A map from field name to its override; applied at schema load time.
std::vector< RolePinDefinition > RolePinDefinitions
An ordered list of role pin definitions; order is display/declaration order (also CSV column order).
TileSharingAlignment
Controls palette slot alignment strategy for tile sharing deduplication.
std::vector< MetatileAttributeFieldDefinition > MetatileAttributeFieldDefinitions
An ordered list of metatile attribute field definitions; order is display/declaration order.
TilesPaletteMode
Controls how tiles.png is rendered.
ArtifactEditMode
Specifies whether artifacts (tiles or palettes) can be modified during patch compilation.
AnimPaletteResolutionStrategy
Strategy for determining which palette to use when decompiling animation tiles.
std::unordered_map< std::string, PerAnimOverride > PerAnimOverrides
Per-animation configuration map.
TileSharingPacking
Controls whether palette packing considers tile sharing shape group membership.
@ not_provided
nothing attribute-related was found; other providers should be consulted
@ valid
one or more usable candidate sets were inferred
AnimKeyFrameResolutionStrategy
Strategy for handling duplicate key frame tiles in animation decompilation.
FrameLinking
Controls how animation frames are linked to metatile entries.
ConfigScopeType
Specifies the scope type for configuration value lookups.
AnimMultiPaletteSubtileResolutionStrategy
Strategy for handling animation subtiles referenced with multiple palettes.
PackingStrategyType
Selects the palette packing algorithm to use during tileset compilation.
A small container that holds an optional-wrapped value, validation state, and metadata about the valu...
static LayerValue valid(T val, std::string source_key, std::string source_info)
Creates a LayerValue representing a valid configuration value.
static LayerValue not_provided()
Creates a LayerValue representing that the provider does not supply this configuration.
Container for per-strategy packing parameters.