From c09b990cf9b53544a1fed7b1b692ae459f7ba185 Mon Sep 17 00:00:00 2001 From: Cecilia Sanare Date: Sun, 3 Mar 2024 12:31:50 -0600 Subject: [PATCH] fix: migrate to the new schema --- build.rs | 2 +- src/tweaks/mod.rs | 35 ++++++++++++++++++----------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/build.rs b/build.rs index b004b40..4e400fc 100644 --- a/build.rs +++ b/build.rs @@ -1,4 +1,4 @@ -use std::{error::Error, process::Command}; +use std::error::Error; fn main() -> Result<(), Box> { // let git_output = Command::new("git") diff --git a/src/tweaks/mod.rs b/src/tweaks/mod.rs index 19d54cb..1687ff2 100644 --- a/src/tweaks/mod.rs +++ b/src/tweaks/mod.rs @@ -1,3 +1,5 @@ +use std::collections::HashMap; + use reqwest::Url; use serde::Deserialize; @@ -15,9 +17,15 @@ pub struct App { #[derive(Debug, Deserialize)] pub struct Tweaks { - pub dlls: Vec, - pub fonts: Vec, - pub settings: Vec, + pub tricks: Vec, + pub env: HashMap, + pub settings: TweakSettings, +} + +#[derive(Debug, Deserialize)] +pub struct TweakSettings { + pub esync: Option, + pub fsync: Option, } #[derive(Debug, Deserialize)] @@ -66,22 +74,15 @@ pub fn get(app_id: &str) -> App { pub fn apply(app: &App) -> Result<(u32, u32), String> { trace!("App ID: {}; Name: {}", app.id, app.name); - let mut components: Vec = vec![]; - - trace!("DLLs: {}", app.tweaks.dlls.len()); - components.append(&mut app.tweaks.dlls.clone()); - - trace!("Fonts: {}", app.tweaks.fonts.len()); - components.append(&mut app.tweaks.fonts.clone()); - - trace!("Settings: {}", app.tweaks.settings.len()); - components.append(&mut app.tweaks.settings.clone()); - if components.len() == 0 { - warn!("No components were found for {} -> {}", app.id, app.name); + if app.tweaks.tricks.len() == 0 { + warn!("No tricks were found for {} -> {}", app.id, app.name); return Ok((0, 0)); } - trace!("Installing components for {} -> {}", app.id, app.name); - return Ok(protontricks::install::components(&app.id, &components)?); + trace!("Installing tricks for {} -> {}", app.id, app.name); + return Ok(protontricks::install::components( + &app.id, + &app.tweaks.tricks, + )?); }