0.5.2
- updated `wincompatlib` version - made `LauncherState::get_from_config` use proper prefix path
This commit is contained in:
parent
977ba14056
commit
c5ca8d533c
3 changed files with 32 additions and 9 deletions
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "anime-launcher-sdk"
|
name = "anime-launcher-sdk"
|
||||||
version = "0.5.1"
|
version = "0.5.2"
|
||||||
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"
|
||||||
|
@ -18,7 +18,7 @@ serde = { version = "1.0", features = ["derive"], optional = true }
|
||||||
serde_json = { version = "1.0", optional = true }
|
serde_json = { version = "1.0", optional = true }
|
||||||
enum-ordinalize = { version = "3.1", optional = true }
|
enum-ordinalize = { version = "3.1", optional = true }
|
||||||
|
|
||||||
wincompatlib = { version = "0.3", features = ["all"], optional = true }
|
wincompatlib = { version = "0.4", features = ["all"], optional = true }
|
||||||
lazy_static = { version = "1.4", optional = true }
|
lazy_static = { version = "1.4", optional = true }
|
||||||
md-5 = { version = "0.10", features = ["asm"], optional = true }
|
md-5 = { version = "0.10", features = ["asm"], optional = true }
|
||||||
discord-rich-presence = { version = "0.2.3", optional = true }
|
discord-rich-presence = { version = "0.2.3", optional = true }
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::process::Output;
|
||||||
|
use std::io::Result;
|
||||||
|
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
use serde_json::Value as JsonValue;
|
use serde_json::Value as JsonValue;
|
||||||
|
@ -327,35 +329,35 @@ impl WineBootExt for WincompatlibWine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_prefix<T: Into<PathBuf>>(&self, path: T) -> std::io::Result<std::process::Output> {
|
fn update_prefix<T: Into<PathBuf>>(&self, path: Option<T>) -> Result<Output> {
|
||||||
match self {
|
match self {
|
||||||
Self::Default(wine) => wine.update_prefix(path),
|
Self::Default(wine) => wine.update_prefix(path),
|
||||||
Self::Proton(proton) => proton.update_prefix(path)
|
Self::Proton(proton) => proton.update_prefix(path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stop_processes(&self, force: bool) -> std::io::Result<std::process::Output> {
|
fn stop_processes(&self, force: bool) -> Result<Output> {
|
||||||
match self {
|
match self {
|
||||||
Self::Default(wine) => wine.stop_processes(force),
|
Self::Default(wine) => wine.stop_processes(force),
|
||||||
Self::Proton(proton) => proton.stop_processes(force)
|
Self::Proton(proton) => proton.stop_processes(force)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn restart(&self) -> std::io::Result<std::process::Output> {
|
fn restart(&self) -> Result<Output> {
|
||||||
match self {
|
match self {
|
||||||
Self::Default(wine) => wine.restart(),
|
Self::Default(wine) => wine.restart(),
|
||||||
Self::Proton(proton) => proton.restart()
|
Self::Proton(proton) => proton.restart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn shutdown(&self) -> std::io::Result<std::process::Output> {
|
fn shutdown(&self) -> Result<Output> {
|
||||||
match self {
|
match self {
|
||||||
Self::Default(wine) => wine.shutdown(),
|
Self::Default(wine) => wine.shutdown(),
|
||||||
Self::Proton(proton) => proton.shutdown()
|
Self::Proton(proton) => proton.shutdown()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn end_session(&self) -> std::io::Result<std::process::Output> {
|
fn end_session(&self) -> Result<Output> {
|
||||||
match self {
|
match self {
|
||||||
Self::Default(wine) => wine.end_session(),
|
Self::Default(wine) => wine.end_session(),
|
||||||
Self::Proton(proton) => proton.end_session()
|
Self::Proton(proton) => proton.end_session()
|
||||||
|
|
|
@ -3,9 +3,12 @@ use std::path::PathBuf;
|
||||||
use anime_game_core::prelude::*;
|
use anime_game_core::prelude::*;
|
||||||
use anime_game_core::genshin::prelude::*;
|
use anime_game_core::genshin::prelude::*;
|
||||||
|
|
||||||
|
use wincompatlib::prelude::*;
|
||||||
|
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
|
|
||||||
use crate::consts;
|
use crate::consts;
|
||||||
|
use super::components::wine::WincompatlibWine;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub enum LauncherState {
|
pub enum LauncherState {
|
||||||
|
@ -145,10 +148,28 @@ impl LauncherState {
|
||||||
|
|
||||||
let config = crate::config::get()?;
|
let config = crate::config::get()?;
|
||||||
|
|
||||||
|
let mut wine_prefix = config.game.wine.prefix.clone();
|
||||||
|
|
||||||
// Check wine existence
|
// Check wine existence
|
||||||
#[cfg(feature = "components")]
|
#[cfg(feature = "components")]
|
||||||
{
|
{
|
||||||
if config.get_selected_wine()?.is_none() {
|
if let Some(wine) = config.get_selected_wine()? {
|
||||||
|
let wine = wine
|
||||||
|
.to_wine(&config.components.path, Some(&config.game.wine.builds.join(&wine.name)))
|
||||||
|
.with_prefix(&config.game.wine.prefix);
|
||||||
|
|
||||||
|
match wine {
|
||||||
|
WincompatlibWine::Default(wine) => if let Some(prefix) = wine.prefix {
|
||||||
|
wine_prefix = prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
WincompatlibWine::Proton(proton) => if let Some(prefix) = proton.wine().prefix.clone() {
|
||||||
|
wine_prefix = prefix;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
return Ok(Self::WineNotInstalled);
|
return Ok(Self::WineNotInstalled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,6 +183,6 @@ impl LauncherState {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Self::get(config.game.wine.prefix, config.game.path, voices, config.patch.servers, status)
|
Self::get(wine_prefix, config.game.path, voices, config.patch.servers, status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue