0.5.11
This commit is contained in:
parent
4fb8cf3ce8
commit
46547a886f
4 changed files with 37 additions and 17 deletions
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "anime-launcher-sdk"
|
name = "anime-launcher-sdk"
|
||||||
version = "0.5.10"
|
version = "0.5.11"
|
||||||
authors = ["Nikita Podvirnyy <suimin.tu.mu.ga.mi@gmail.com>"]
|
authors = ["Nikita Podvirnyy <suimin.tu.mu.ga.mi@gmail.com>"]
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
|
@ -11,7 +11,7 @@ use super::loader::ComponentsLoader;
|
||||||
pub struct Group {
|
pub struct Group {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub title: String,
|
pub title: String,
|
||||||
pub features: Features,
|
pub features: Option<Features>,
|
||||||
pub versions: Vec<Version>
|
pub versions: Vec<Version>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,6 +129,39 @@ impl Version {
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
/// Return this version's features
|
||||||
|
pub fn version_features(&self) -> Option<Features> {
|
||||||
|
self.features.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Return this version's features if they persist, or
|
||||||
|
/// return group's features otherwise
|
||||||
|
pub fn features_in(&self, group: &Group) -> Option<Features> {
|
||||||
|
if self.features.is_some() {
|
||||||
|
self.features.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
group.features.clone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Return this version's features if they persist, or
|
||||||
|
/// try to return group's features otherwise
|
||||||
|
pub fn features<T: Into<PathBuf>>(&self, components: T) -> anyhow::Result<Option<Features>> {
|
||||||
|
if self.features.is_some() {
|
||||||
|
Ok(self.features.clone())
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
match self.find_group(components)? {
|
||||||
|
Some(group) => Ok(group.features),
|
||||||
|
None => Ok(None)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
/// Check is current dxvk downloaded in specified folder
|
/// Check is current dxvk downloaded in specified folder
|
||||||
pub fn is_downloaded_in<T: Into<PathBuf>>(&self, folder: T) -> bool {
|
pub fn is_downloaded_in<T: Into<PathBuf>>(&self, folder: T) -> bool {
|
||||||
|
|
|
@ -127,15 +127,10 @@ pub fn get_dxvk_versions(index: &Path) -> anyhow::Result<Vec<dxvk::Group>> {
|
||||||
None => anyhow::bail!("Wrong components index structure: wine versions must be a list")
|
None => anyhow::bail!("Wrong components index structure: wine versions must be a list")
|
||||||
}
|
}
|
||||||
|
|
||||||
let features = match group.get("features") {
|
|
||||||
Some(features) => features.into(),
|
|
||||||
None => dxvk::Features::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
dxvk_groups.push(dxvk::Group {
|
dxvk_groups.push(dxvk::Group {
|
||||||
name,
|
name,
|
||||||
title,
|
title,
|
||||||
features,
|
features: group.get("features").map(|v| v.into()),
|
||||||
versions: dxvk_versions
|
versions: dxvk_versions
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
10
src/game.rs
10
src/game.rs
|
@ -176,20 +176,12 @@ pub fn run() -> anyhow::Result<()> {
|
||||||
|
|
||||||
// Add environment flags for selected dxvk
|
// Add environment flags for selected dxvk
|
||||||
if let Ok(Some(dxvk )) = config.get_selected_dxvk() {
|
if let Ok(Some(dxvk )) = config.get_selected_dxvk() {
|
||||||
if let Some(features) = &dxvk.features {
|
if let Ok(Some(features)) = dxvk.features(&config.components.path) {
|
||||||
for (key, value) in features.env.iter() {
|
for (key, value) in features.env.iter() {
|
||||||
command.env(key, replace_keywords(value, &config));
|
command.env(key, replace_keywords(value, &config));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if let Ok(Some(group)) = dxvk.find_group(&config.components.path) {
|
|
||||||
for (key, value) in group.features.env.into_iter() {
|
|
||||||
command.env(key, replace_keywords(value, &config));
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: fix mangohud
|
|
||||||
|
|
||||||
command.envs(config.game.wine.sync.get_env_vars());
|
command.envs(config.game.wine.sync.get_env_vars());
|
||||||
command.envs(config.game.enhancements.hud.get_env_vars(&config));
|
command.envs(config.game.enhancements.hud.get_env_vars(&config));
|
||||||
|
|
Loading…
Reference in a new issue