ds_rom/rom/config.rs
1use std::path::PathBuf;
2
3use serde::{Deserialize, Serialize};
4
5/// Config file mainly consisting of paths to extracted files.
6#[derive(Serialize, Deserialize, Clone)]
7pub struct RomConfig {
8 /// Byte value to append between files in the file image block.
9 pub file_image_padding_value: u8,
10 /// Byte value to append between sections in the file image block.
11 pub section_padding_value: u8,
12
13 /// Path to header YAML, deserializes into [`Header`](crate::rom::Header).
14 pub header: PathBuf,
15 /// Path to header logo PNG, loaded by [`Logo::from_png`](crate::rom::Logo::from_png).
16 pub header_logo: PathBuf,
17
18 /// Path to ARM9 binary
19 pub arm9_bin: PathBuf,
20 /// Path to ARM9 YAML, deserializes into [`Arm9BuildConfig`](crate::rom::Arm9BuildConfig).
21 pub arm9_config: PathBuf,
22
23 /// Path to ARM7 binary
24 pub arm7_bin: PathBuf,
25 /// Path to ARM7 YAML, deserializes into [`Arm7Offsets`](crate::rom::Arm7Offsets).
26 pub arm7_config: PathBuf,
27
28 /// Path to ITCM files
29 pub itcm: RomConfigAutoload,
30 /// Path to DTCM files
31 pub dtcm: RomConfigAutoload,
32 /// Path to unknown autoloads
33 #[serde(skip_serializing_if = "Vec::is_empty", default = "Vec::new")]
34 pub unknown_autoloads: Vec<RomConfigUnknownAutoload>,
35
36 /// Path to ARM9 overlays YAML, deserializes into [`OverlayTableConfig`](crate::rom::OverlayTableConfig).
37 pub arm9_overlays: Option<PathBuf>,
38 /// Path to ARM7 overlays YAML, deserializes into [`OverlayTableConfig`](crate::rom::OverlayTableConfig).
39 pub arm7_overlays: Option<PathBuf>,
40
41 /// Path to banner YAML, deserializes into [`Banner`](crate::rom::Banner).
42 pub banner: PathBuf,
43
44 /// Path to asset files directory
45 pub files_dir: PathBuf,
46 /// Path to path order file
47 pub path_order: PathBuf,
48
49 /// Path to HMAC SHA1 key file for ARM9
50 pub arm9_hmac_sha1_key: Option<PathBuf>,
51
52 /// Path to multiboot signature YAML
53 pub multiboot_signature: Option<PathBuf>,
54
55 /// Alignment of ROM sections
56 pub alignment: RomConfigAlignment,
57}
58
59/// Path to autoload files
60#[derive(Serialize, Deserialize, Clone)]
61pub struct RomConfigAutoload {
62 /// Path to binary
63 pub bin: PathBuf,
64 /// Path to YAML, deserializes into [`AutoloadInfo`](crate::rom::raw::AutoloadInfo).
65 pub config: PathBuf,
66}
67
68/// Path to unknown autoload files
69#[derive(Serialize, Deserialize, Clone)]
70pub struct RomConfigUnknownAutoload {
71 /// Index of the autoload in the autoload table
72 pub index: u32,
73 /// Path to extracted files
74 #[serde(flatten)]
75 pub files: RomConfigAutoload,
76}
77
78/// Alignment of ROM sections.
79#[derive(Serialize, Deserialize, Clone)]
80pub struct RomConfigAlignment {
81 /// Alignment of the ARM9 program.
82 pub arm9: u32,
83 /// Alignment of the ARM9 overlay table.
84 pub arm9_overlay_table: u32,
85 /// Alignment of each ARM9 overlay file.
86 pub arm9_overlay: u32,
87 /// Alignment of the ARM7 program.
88 pub arm7: u32,
89 /// Alignment of the ARM7 overlay table.
90 pub arm7_overlay_table: u32,
91 /// Alignment of each ARM7 overlay file.
92 pub arm7_overlay: u32,
93 /// Alignment of the file name table.
94 pub file_name_table: u32,
95 /// Alignment of the file allocation table.
96 pub file_allocation_table: u32,
97 /// Alignment of the banner.
98 pub banner: u32,
99 /// Alignment of the file image block.
100 pub file_image_block: u32,
101 /// Alignment of each file.
102 pub file: u32,
103}