From 59a95e48145a7092320ce5a68110582bc17f228f Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Mon, 13 Nov 2023 18:02:58 +0200 Subject: [PATCH] feat(star-rail): added `game.voices` config --- src/games/star_rail/config/schema/game/mod.rs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/games/star_rail/config/schema/game/mod.rs b/src/games/star_rail/config/schema/game/mod.rs index af517e2..4385227 100644 --- a/src/games/star_rail/config/schema/game/mod.rs +++ b/src/games/star_rail/config/schema/game/mod.rs @@ -26,6 +26,7 @@ use prelude::*; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct Game { pub path: Paths, + pub voices: Vec, pub wine: Wine, pub dxvk: Dxvk, pub enhancements: Enhancements, @@ -38,6 +39,9 @@ impl Default for Game { fn default() -> Self { Self { path: Paths::default(), + voices: vec![ + String::from("en-us") + ], wine: Wine::default(), dxvk: Dxvk::default(), enhancements: Enhancements::default(), @@ -56,6 +60,24 @@ impl From<&JsonValue> for Game { .map(Paths::from) .unwrap_or(default.path), + voices: match value.get("voices") { + Some(value) => match value.as_array() { + Some(values) => { + let mut voices = Vec::new(); + + for value in values { + if let Some(voice) = value.as_str() { + voices.push(voice.to_string()); + } + } + + voices + }, + None => default.voices + }, + None => default.voices + }, + wine: value.get("wine") .map(Wine::from) .unwrap_or(default.wine),