feat(star-rail): added game.voices
config
This commit is contained in:
parent
ea5a501a0f
commit
59a95e4814
1 changed files with 22 additions and 0 deletions
|
@ -26,6 +26,7 @@ use prelude::*;
|
|||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct Game {
|
||||
pub path: Paths,
|
||||
pub voices: Vec<String>,
|
||||
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),
|
||||
|
|
Loading…
Reference in a new issue