From e27a719609242ee7b067c0110ff92092097e861c Mon Sep 17 00:00:00 2001 From: PancakeTAS Date: Sat, 26 Jul 2025 01:21:16 +0200 Subject: [PATCH] ui: deploy default configuration fixes #132 --- ui/src/config.rs | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/ui/src/config.rs b/ui/src/config.rs index 2222007..3c8ba67 100644 --- a/ui/src/config.rs +++ b/ui/src/config.rs @@ -25,6 +25,41 @@ fn find_config_file() -> String { static CONFIG: OnceLock>> = OnceLock::new(); static CONFIG_WRITER: OnceLock> = OnceLock::new(); +pub fn default_config() -> TomlConfig { + TomlConfig { + version: 1, + global: TomlGlobal { + dll: None, + }, + game: vec![ + TomlGame { + exe: String::from("vkcube"), + multiplier: Multiplier::from(4), + flow_scale: FlowScale::from(0.7), + performance_mode: true, + hdr_mode: false, + experimental_present_mode: PresentMode::Vsync, + }, + TomlGame { + exe: String::from("benchmark"), + multiplier: Multiplier::from(4), + flow_scale: FlowScale::from(1.0), + performance_mode: true, + hdr_mode: false, + experimental_present_mode: PresentMode::Vsync, + }, + TomlGame { + exe: String::from("Genshin"), + multiplier: Multiplier::from(3), + flow_scale: FlowScale::from(1.0), + performance_mode: false, + hdr_mode: false, + experimental_present_mode: PresentMode::Vsync, + }, + ] + } +} + /// /// Load the configuration from the file and create a writer. /// @@ -32,8 +67,8 @@ pub fn load_config() -> Result<(), anyhow::Error> { // load the configuration file let path = find_config_file(); if !std::path::Path::new(&path).exists() { - let default_config = TomlConfig::default(); - save_config(&default_config) + let conf = default_config(); + save_config(&conf) .context("Failed to create default configuration")?; } let data = std::fs::read(path)