components: added dxvk 2.1 support

This commit is contained in:
Observer KRypt0n_ 2023-01-28 00:10:17 +02:00
parent da37ea2103
commit 3f364d1676
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
9 changed files with 138 additions and 63 deletions

117
Cargo.lock generated
View file

@ -56,7 +56,7 @@ version = "1.2.4"
dependencies = [
"anime-game-core",
"anyhow",
"cached 0.41.0",
"cached 0.42.0",
"dirs",
"glib-build-tools",
"gtk4",
@ -275,10 +275,10 @@ checksum = "72b4147cd94d5fbdc2ab71b11d50a2f45493625576b3bb70257f59eedea69f3d"
dependencies = [
"async-trait",
"async_once",
"cached_proc_macro",
"cached_proc_macro 0.15.0",
"cached_proc_macro_types",
"futures",
"hashbrown",
"hashbrown 0.12.3",
"instant",
"lazy_static",
"once_cell",
@ -288,16 +288,16 @@ dependencies = [
[[package]]
name = "cached"
version = "0.41.0"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec6d20b3d24b6c74e2c5331d2d3d8d1976a9883c7da179aa851afa4c90d62e36"
checksum = "5e5877db5d1af7fae60d06b5db9430b68056a69b3582a0be8e3691e87654aeb6"
dependencies = [
"async-trait",
"async_once",
"cached_proc_macro",
"cached_proc_macro 0.16.0",
"cached_proc_macro_types",
"futures",
"hashbrown",
"hashbrown 0.13.2",
"instant",
"lazy_static",
"once_cell",
@ -312,7 +312,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "751f7f4e7a091545e7f6c65bacc404eaee7e87bfb1f9ece234a1caa173dc16f2"
dependencies = [
"cached_proc_macro_types",
"darling",
"darling 0.13.4",
"quote",
"syn",
]
[[package]]
name = "cached_proc_macro"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e10ca87c81aaa3a949dbbe2b5e6c2c45dbc94ba4897e45ea31ff9ec5087be3dc"
dependencies = [
"cached_proc_macro_types",
"darling 0.14.2",
"proc-macro2",
"quote",
"syn",
]
@ -518,8 +531,18 @@ version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c"
dependencies = [
"darling_core",
"darling_macro",
"darling_core 0.13.4",
"darling_macro 0.13.4",
]
[[package]]
name = "darling"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa"
dependencies = [
"darling_core 0.14.2",
"darling_macro 0.14.2",
]
[[package]]
@ -536,13 +559,38 @@ dependencies = [
"syn",
]
[[package]]
name = "darling_core"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f"
dependencies = [
"fnv",
"ident_case",
"proc-macro2",
"quote",
"strsim",
"syn",
]
[[package]]
name = "darling_macro"
version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835"
dependencies = [
"darling_core",
"darling_core 0.13.4",
"quote",
"syn",
]
[[package]]
name = "darling_macro"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e"
dependencies = [
"darling_core 0.14.2",
"quote",
"syn",
]
@ -558,6 +606,37 @@ dependencies = [
"syn",
]
[[package]]
name = "derive_builder"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8"
dependencies = [
"derive_builder_macro",
]
[[package]]
name = "derive_builder_core"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f"
dependencies = [
"darling 0.14.2",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "derive_builder_macro"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e"
dependencies = [
"derive_builder_core",
"syn",
]
[[package]]
name = "digest"
version = "0.10.3"
@ -1079,6 +1158,12 @@ version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hashbrown"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
[[package]]
name = "heck"
version = "0.4.0"
@ -1581,9 +1666,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.40"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7"
checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
dependencies = [
"unicode-ident",
]
@ -2324,11 +2409,11 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "wincompatlib"
version = "0.1.3"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97590075376c0862f23566ab10bdbb553bfd97bd86c0a20ce55bb24925273c82"
checksum = "8ee6c64894fe24609e0d3b47f2715bf9f5c25a754c4a5b96599c5650266d291d"
dependencies = [
"regex",
"derive_builder",
]
[[package]]

View file

@ -21,7 +21,7 @@ adw = { package = "libadwaita", version = "0.2", features = ["v1_2"] }
rfd = { version = "0.10", features = ["xdg-portal"], default-features = false }
anime-game-core = { path = "anime-game-core", features = ["all", "static", "genshin"] }
wincompatlib = { version = "0.1.3", features = ["dxvk"] }
wincompatlib = "0.2.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
@ -31,4 +31,4 @@ wait_not_await = "0.2.1"
lazy_static = "1.4.0"
anyhow = "1.0"
md5 = "0.7"
cached = { version = "0.41", features = ["proc_macro"] }
cached = { version = "0.42", features = ["proc_macro"] }

@ -1 +1 @@
Subproject commit ea02d1c482da9701f4a5517f05e3e2ad68b71295
Subproject commit bf24743bd308517dc8ac885d473f70419c3e609a

@ -1 +1 @@
Subproject commit 039d88ab45001cf799c421e58d4669a0596c4d29
Subproject commit 1df46b5a06f4310d2c4ad0b3734d34b5d4bde251

@ -1 +1 @@
Subproject commit 5580f7be0fbdfba677ec32b2fd7d11cb762edebf
Subproject commit 647a766a0b8a31454922b536444b4ac5c91b2380

View file

@ -80,11 +80,10 @@ impl Version {
folder.into().join(&self.name).exists()
}
pub fn apply<T: Into<PathBuf>>(&self, dxvks_folder: T, prefix_path: T) -> anyhow::Result<Output> {
let apply_path = dxvks_folder.into().join(&self.name).join("setup_dxvk.sh");
pub fn install<T: Into<PathBuf>>(&self, dxvks_folder: T, prefix_path: T, params: InstallParams) -> anyhow::Result<()> {
let config = config::get()?;
let (wine_path, wineserver_path, wineboot_path) = match config.try_get_selected_wine_info() {
let wine = match config.try_get_selected_wine_info() {
Some(wine) => {
let wine_folder = config.game.wine.builds.join(wine.name);
@ -92,23 +91,25 @@ impl Version {
let wineserver_path = wine_folder.join(wine.files.wineserver);
let wineboot_path = wine_folder.join(wine.files.wineboot);
(wine_path, wineserver_path, wineboot_path)
Wine::from_binary(wine_path)
.with_server(wineserver_path)
.with_boot(wineboot_path)
.with_loader(WineLoader::Current)
.with_arch(WineArch::Win64)
.with_prefix(prefix_path)
},
None => (PathBuf::from("wine64"), PathBuf::from("wineserver"), PathBuf::from("wineboot"))
None => Wine::default().with_prefix(prefix_path)
};
let result = Dxvk::install(
apply_path,
prefix_path.into(),
wine_path.clone(),
wine_path,
wineboot_path,
wineserver_path
&wine,
dxvks_folder.into().join(&self.name),
params
);
match result {
Ok(output) => Ok(output),
Err(err) => Err(err.into())
Ok(()) => Ok(()),
Err(err) => Err(anyhow::anyhow!(err))
}
}
}

View file

@ -73,11 +73,11 @@ impl DxvkRow {
}
}
pub fn apply<T: Into<PathBuf>>(&self, dxvks_folder: T, prefix_path: T) -> anyhow::Result<std::process::Output> {
pub fn apply<T: Into<PathBuf>>(&self, dxvks_folder: T, prefix_path: T) -> anyhow::Result<()> {
self.button.set_sensitive(false);
self.apply_button.set_sensitive(false);
let result = self.version.apply(dxvks_folder, prefix_path);
let result = self.version.install(dxvks_folder, prefix_path, wincompatlib::dxvk::InstallParams::default());
self.button.set_sensitive(true);
self.apply_button.set_sensitive(true);

View file

@ -386,10 +386,8 @@ impl App {
let dxvk_version = dxvk_version.clone();
std::thread::spawn(move || {
match dxvk_version.apply(&config.game.dxvk.builds, &config.game.wine.prefix) {
Ok(output) => {
println!("Applied DXVK:\n\n{}", String::from_utf8_lossy(&output.stdout));
match dxvk_version.install(&config.game.dxvk.builds, &config.game.wine.prefix, wincompatlib::dxvk::InstallParams::default()) {
Ok(_) => {
// Remove .first-run file
let launcher_dir = crate::lib::consts::launcher_dir().unwrap();

View file

@ -281,14 +281,11 @@ impl App {
component.apply_button.connect_clicked(clone!(@strong component, @weak self as this => move |_| {
std::thread::spawn(clone!(@strong component, @strong this => move || {
let config = config::get().expect("Failed to load config");
match component.apply(&config.game.dxvk.builds, &config.game.wine.prefix) {
Ok(output) => println!("{}", String::from_utf8_lossy(&output.stdout)),
Err(err) => {
this.update(Actions::Toast(Rc::new((
String::from("Failed to apply DXVK"), err.to_string()
)))).unwrap();
}
if let Err(err) = component.apply(&config.game.dxvk.builds, &config.game.wine.prefix) {
this.update(Actions::Toast(Rc::new((
String::from("Failed to apply DXVK"), err.to_string()
)))).unwrap();
}
}));
}));
@ -385,13 +382,10 @@ impl App {
else if let Ok(awaiter) = component.download(&config.game.dxvk.builds) {
awaiter.then(clone!(@strong this => move |_| {
match component.apply(&config.game.dxvk.builds, &config.game.wine.prefix) {
Ok(output) => println!("{}", String::from_utf8_lossy(&output.stdout)),
Err(err) => {
this.update(Actions::Toast(Rc::new((
String::from("Failed to apply DXVK"), err.to_string()
)))).unwrap();
}
if let Err(err) = component.apply(&config.game.dxvk.builds, &config.game.wine.prefix) {
this.update(Actions::Toast(Rc::new((
String::from("Failed to apply DXVK"), err.to_string()
)))).unwrap();
}
component.update_state(&config.game.dxvk.builds);
@ -488,13 +482,10 @@ impl App {
this.widgets.dxvk_selected.set_sensitive(false);
std::thread::spawn(clone!(@strong config, @strong this => move || {
match version.apply(&config.game.dxvk.builds, &config.game.wine.prefix) {
Ok(output) => println!("{}", String::from_utf8_lossy(&output.stdout)),
Err(err) => {
this.update(Actions::Toast(Rc::new((
String::from("Failed to apply DXVK"), err.to_string()
)))).unwrap();
}
if let Err(err) = version.install(&config.game.dxvk.builds, &config.game.wine.prefix, wincompatlib::dxvk::InstallParams::default()) {
this.update(Actions::Toast(Rc::new((
String::from("Failed to apply DXVK"), err.to_string()
)))).unwrap();
}
this.widgets.dxvk_selected.set_sensitive(true);