luminol_config/
project.rs1use serde::{Deserialize, Serialize};
25
26use super::{command_db, DataFormat, RGSSVer, RMVer, VolumeScale};
27
28#[derive(Debug, Clone)]
29#[allow(clippy::large_enum_variant)]
30pub struct Config {
31 pub project: Project,
32 pub command_db: command_db::CommandDB,
33 pub game_ini: ini::Ini,
34}
35
36#[derive(Serialize, Deserialize, Debug, Clone)]
37#[serde(default)]
38#[allow(missing_docs)]
40pub struct Project {
41 pub project_name: String,
42 pub scripts_path: String,
43 pub data_format: DataFormat,
44 pub rgss_ver: RGSSVer,
45 pub editor_ver: RMVer,
46 pub volume_scale: VolumeScale,
47 pub playtest_exe: String,
48 pub prefer_rgssad: bool,
49 pub persistence_id: u64,
50}
51
52impl Default for Project {
53 fn default() -> Self {
54 Self {
55 project_name: String::new(),
56 scripts_path: "Scripts".to_string(),
57 data_format: DataFormat::Marshal,
58 rgss_ver: RGSSVer::RGSS1,
59 editor_ver: RMVer::XP,
60 volume_scale: VolumeScale::Db35,
61 playtest_exe: "game".to_string(),
62 prefer_rgssad: false,
63 persistence_id: 0,
64 }
65 }
66}
67
68impl Config {
69 pub fn from_project(project: Project) -> Self {
70 let mut game_ini = ini::Ini::new();
71 game_ini
72 .with_section(Some("Game"))
73 .set("Library", "RGSS104E.dll")
74 .set("Scripts", format!("Data/{}", project.scripts_path))
75 .set("Title", &project.project_name)
76 .set("RTP1", "")
77 .set("RTP2", "")
78 .set("RTP3", "");
79
80 let command_db = command_db::CommandDB::new(project.editor_ver);
81
82 Self {
83 project,
84 command_db,
85 game_ini,
86 }
87 }
88}