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