Several changes

- added DXVK applying
- added wine versions sorting in comborow
- fixed error toast displaying during wine/dxvk downloading
This commit is contained in:
Observer KRypt0n_ 2022-07-23 17:08:50 +02:00
parent 9d5b3b27ed
commit 3f4949fc26
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
8 changed files with 273 additions and 19 deletions

View file

@ -19,3 +19,5 @@ serde_json = "1.0"
dirs = "4.0.0"
tokio = { version = "1.19.2", features = ["rt", "rt-multi-thread", "macros"] }
wait_not_await = "0.2.1"
regex = "1.6.0"
lazy_static = "1.4.0"

View file

@ -126,17 +126,9 @@ Adw.PreferencesPage general_page {
Adw.PreferencesGroup {
title: "DXVK version";
Adw.ComboRow {
Adw.ComboRow dxvk_selected {
title: "Selected version";
model: Gtk.StringList {
strings [
"Vanilla 1.10.1",
"Vanilla 1.10",
"Vanilla 1.9.4",
"Async 1.10.1"
]
};
subtitle: "WIP: does nothing as for now";
}
Adw.ActionRow {

View file

@ -11,6 +11,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
@ -23,6 +24,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
@ -35,6 +37,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
@ -47,6 +50,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
@ -59,6 +63,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -71,6 +76,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
@ -83,6 +89,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
@ -95,6 +102,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -107,6 +115,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -119,6 +128,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -131,6 +141,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -143,6 +154,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -155,6 +167,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -167,6 +180,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -179,6 +193,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -197,6 +212,7 @@
"files": {
"wine": "files/bin/wine64",
"wineserver": "files/bin/wineserver",
"wineboot": "files/bin/wineboot",
"winecfg": "files/lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
@ -209,6 +225,7 @@
"files": {
"wine": "files/bin/wine64",
"wineserver": "files/bin/wineserver",
"wineboot": "files/bin/wineboot",
"winecfg": "files/lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -221,6 +238,7 @@
"files": {
"wine": "files/bin/wine64",
"wineserver": "files/bin/wineserver",
"wineboot": "files/bin/wineboot",
"winecfg": "files/lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
@ -233,6 +251,7 @@
"files": {
"wine": "files/bin/wine64",
"wineserver": "files/bin/wineserver",
"wineboot": "files/bin/wineboot",
"winecfg": "files/lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -245,6 +264,7 @@
"files": {
"wine": "files/bin/wine64",
"wineserver": "files/bin/wineserver",
"wineboot": "files/bin/wineboot",
"winecfg": "files/lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
@ -257,6 +277,7 @@
"files": {
"wine": "files/bin/wine64",
"wineserver": "files/bin/wineserver",
"wineboot": "files/bin/wineboot",
"winecfg": "files/lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
@ -269,6 +290,7 @@
"files": {
"wine": "files/bin/wine64",
"wineserver": "files/bin/wineserver",
"wineboot": "files/bin/wineboot",
"winecfg": "files/lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
@ -281,6 +303,7 @@
"files": {
"wine": "files/bin/wine64",
"wineserver": "files/bin/wineserver",
"wineboot": "files/bin/wineboot",
"winecfg": "files/lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
@ -293,6 +316,7 @@
"files": {
"wine": "files/bin/wine64",
"wineserver": "files/bin/wineserver",
"wineboot": "files/bin/wineboot",
"winecfg": "files/lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -305,6 +329,7 @@
"files": {
"wine": "files/bin/wine64",
"wineserver": "files/bin/wineserver",
"wineboot": "files/bin/wineboot",
"winecfg": "files/lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -317,6 +342,7 @@
"files": {
"wine": "files/bin/wine64",
"wineserver": "files/bin/wineserver",
"wineboot": "files/bin/wineboot",
"winecfg": "files/lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -329,6 +355,7 @@
"files": {
"wine": "files/bin/wine64",
"wineserver": "files/bin/wineserver",
"wineboot": "files/bin/wineboot",
"winecfg": "files/lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -341,6 +368,7 @@
"files": {
"wine": "files/bin/wine64",
"wineserver": "files/bin/wineserver",
"wineboot": "files/bin/wineboot",
"winecfg": "files/lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -353,6 +381,7 @@
"files": {
"wine": "files/bin/wine64",
"wineserver": "files/bin/wineserver",
"wineboot": "files/bin/wineboot",
"winecfg": "files/lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -365,6 +394,7 @@
"files": {
"wine": "files/bin/wine64",
"wineserver": "files/bin/wineserver",
"wineboot": "files/bin/wineboot",
"winecfg": "files/lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -377,6 +407,7 @@
"files": {
"wine": "dist/bin/wine64",
"wineserver": "dist/bin/wineserver",
"wineboot": "files/bin/wineboot",
"winecfg": "dist/lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -389,6 +420,7 @@
"files": {
"wine": "dist/bin/wine64",
"wineserver": "dist/bin/wineserver",
"wineboot": "files/bin/wineboot",
"winecfg": "dist/lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -407,6 +439,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
@ -419,6 +452,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
@ -431,6 +465,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
@ -443,6 +478,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
@ -455,6 +491,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -467,6 +504,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -479,6 +517,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -491,6 +530,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -503,6 +543,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
@ -515,6 +556,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
@ -527,6 +569,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -539,6 +582,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -551,6 +595,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -563,6 +608,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false
@ -575,6 +621,7 @@
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib64/wine/x86_64-windows/winecfg.exe"
},
"recommended": false

View file

@ -6,6 +6,10 @@ use std::io::{Error, ErrorKind, Write};
use serde::{Serialize, Deserialize};
use super::consts::*;
use super::wine::{
Version as WineVersion,
List as WineList
};
mod hud;
mod wine_sync;
@ -92,6 +96,28 @@ impl Config {
None => None
}
}
pub fn try_get_selected_wine_info(&self) -> Option<WineVersion> {
match &self.game.wine.selected {
Some(selected) => {
match WineList::get() {
Ok(list) => {
for group in list {
for version in group.versions {
if &version.name == selected {
return Some(version.clone());
}
}
}
None
},
Err(err) => None
}
},
None => None
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]

View file

@ -1,5 +1,12 @@
use serde::{Serialize, Deserialize};
use std::io::{Error, ErrorKind};
use lazy_static::lazy_static;
use regex::Regex;
use crate::lib::config;
const LIST: &str = include_str!("../../assets/dxvk.json");
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -57,4 +64,50 @@ impl Version {
pub fn is_downloaded_in<T: ToString>(&self, folder: T) -> bool {
std::path::Path::new(&format!("{}/{}", folder.to_string(), self.name)).exists()
}
pub fn apply<T: ToString>(&self, dxvks_folder: T, prefix_path: T) -> std::io::Result<()> {
let apply_path = format!("{}/{}/setup_dxvk.sh", dxvks_folder.to_string(), self.name);
let config = config::get()?;
match config.try_get_selected_wine_info() {
Some(wine) => {
let wine_path = format!("{}/{}/{}", &config.game.wine.builds, wine.name, wine.files.wine);
let wineserver_path = format!("{}/{}/{}", &config.game.wine.builds, wine.name, wine.files.wineserver);
let wineboot_path = format!("{}/{}/{}", &config.game.wine.builds, wine.name, wine.files.wineboot);
let mut apply_script = std::fs::read_to_string(&apply_path)?;
lazy_static! {
static ref WINE: Regex = Regex::new("wine=\".*\"").unwrap();
static ref WINE64: Regex = Regex::new("wine64=\".*\"").unwrap();
static ref WINEBOOT: Regex = Regex::new("wineboot=\".*\"").unwrap();
}
// Update wine paths
apply_script = WINE.replace_all(&apply_script, &format!("wine=\"{}\"", &wine_path)).to_string();
apply_script = WINE64.replace_all(&apply_script, &format!("wine64=\"{}\"", &wine_path)).to_string();
apply_script = WINEBOOT.replace_all(&apply_script, &format!("wineboot=\"{}\"", &wineboot_path)).to_string();
// Old GE builds return specific --version output which can break
// DXVK installation script
apply_script = apply_script.replace("grep wine", "grep \"wine\\|GE\"");
std::fs::write(&apply_path, apply_script)?;
let output = std::process::Command::new("bash")
.arg(&apply_path)
.arg("install")
.env("WINE", wine_path)
.env("WINESERVER", wineserver_path)
.env("WINEPREFIX", prefix_path.to_string())
.output()?;
match output.status.success() {
true => Ok(()),
false => Err(Error::new(ErrorKind::Other, String::from_utf8_lossy(&output.stderr)))
}
},
None => Err(Error::new(ErrorKind::Other, "Wine is not selected"))
}
}
}

View file

@ -29,6 +29,8 @@ impl List {
}
}
downloaded.sort_by(|a, b| b.name.partial_cmp(&a.name).unwrap());
Ok(downloaded)
}
}
@ -60,5 +62,6 @@ impl Version {
pub struct Files {
pub wine: String,
pub wineserver: String,
pub wineboot: String,
pub winecfg: String
}

View file

@ -12,6 +12,7 @@ pub struct DxvkRow {
pub row: adw::ActionRow,
pub button: gtk::Button,
pub apply_button: gtk::Button,
pub progress_bar: gtk::ProgressBar
}
@ -19,10 +20,19 @@ impl DxvkRow {
pub fn new(version: Version) -> Self {
let row = adw::ActionRow::new();
let button = gtk::Button::new();
let apply_button = gtk::Button::new();
row.set_title(&version.version);
row.set_visible(version.recommended);
apply_button.set_icon_name("view-refresh-symbolic");
apply_button.set_valign(gtk::Align::Center);
apply_button.add_css_class("flat");
apply_button.set_tooltip_text(Some("Apply"));
apply_button.hide();
row.add_suffix(&apply_button);
button.set_icon_name("document-save-symbolic");
button.set_valign(gtk::Align::Center);
button.add_css_class("flat");
@ -36,7 +46,7 @@ impl DxvkRow {
progress_bar.set_width_request(200);
progress_bar.set_valign(Align::Center);
progress_bar.set_visible(false);
progress_bar.hide();
row.add_suffix(&progress_bar);
@ -44,6 +54,7 @@ impl DxvkRow {
version,
row,
button,
apply_button,
progress_bar
}
}
@ -51,12 +62,28 @@ impl DxvkRow {
pub fn update_state<T: ToString>(&self, dxvks_folder: T) {
if self.is_downloaded(dxvks_folder) {
self.button.set_icon_name("user-trash-symbolic");
self.apply_button.show();
}
else {
self.button.set_icon_name("document-save-symbolic");
self.apply_button.hide();
}
}
pub fn apply<T: ToString>(&self, dxvks_folder: T, prefix_path: T) -> std::io::Result<()> {
self.button.set_sensitive(false);
self.apply_button.set_sensitive(false);
let result = self.version.apply(dxvks_folder, prefix_path);
self.button.set_sensitive(true);
self.apply_button.set_sensitive(true);
result
}
}
impl DownloadComponent for DxvkRow {

View file

@ -41,6 +41,8 @@ pub struct AppWidgets {
pub wine_components: Rc<Vec<WineGroup>>,
pub dxvk_selected: adw::ComboRow,
pub dxvk_recommended_only: gtk::Switch,
pub dxvk_vanilla: adw::ExpanderRow,
pub dxvk_async: adw::ExpanderRow,
@ -49,7 +51,7 @@ pub struct AppWidgets {
}
impl AppWidgets {
fn try_get(window: adw::ApplicationWindow, toast_overlay: adw::ToastOverlay) -> Result<Self, String> {
pub fn try_get(window: adw::ApplicationWindow, toast_overlay: adw::ToastOverlay) -> Result<Self, String> {
let builder = gtk::Builder::from_string(include_str!("../../../assets/ui/.dist/preferences_general.ui"));
let mut result = Self {
@ -68,6 +70,8 @@ impl AppWidgets {
wine_components: Default::default(),
dxvk_selected: get_object(&builder, "dxvk_selected")?,
dxvk_recommended_only: get_object(&builder, "dxvk_recommended_only")?,
dxvk_vanilla: get_object(&builder, "dxvk_vanilla")?,
dxvk_async: get_object(&builder, "dxvk_async")?,
@ -137,8 +141,11 @@ impl AppWidgets {
pub enum Actions {
DxvkPerformAction(Rc<usize>),
WinePerformAction(Rc<(usize, usize)>),
UpdateDxvkComboRow,
SelectDxvkVersion(Rc<usize>),
UpdateWineComboRow,
SelectWineVersion(Rc<usize>)
SelectWineVersion(Rc<usize>),
ToastError(Rc<(String, Error)>)
}
impl Actions {
@ -156,7 +163,8 @@ impl Actions {
/// This must implement `Default` trait
#[derive(Debug, Default, glib::Downgrade)]
pub struct Values {
downloaded_wine_versions: Rc<Option<Vec<wine::Version>>>
downloaded_wine_versions: Rc<Option<Vec<wine::Version>>>,
downloaded_dxvk_versions: Rc<Option<Vec<dxvk::Version>>>
}
/// The main application structure
@ -199,6 +207,14 @@ impl App {
}
}));
self.widgets.dxvk_selected.connect_selected_notify(clone!(@strong self as this => move |combo_row| {
if let Some(model) = combo_row.model() {
if model.n_items() > 0 {
this.update(Actions::SelectDxvkVersion(Rc::new(combo_row.selected() as usize)));
}
}
}));
// Set wine recommended only switcher event
self.widgets.wine_recommended_only.connect_state_notify(clone!(@strong self as this => move |switcher| {
for group in &*this.widgets.wine_components {
@ -232,11 +248,19 @@ impl App {
}
}));
// DXVK install/remove buttons
// DXVK install/remove/apply buttons
let components = &*self.widgets.dxvk_components;
for (i, component) in components.into_iter().enumerate() {
component.button.connect_clicked(Actions::DxvkPerformAction(Rc::new(i)).into_fn(&self));
component.apply_button.connect_clicked(clone!(@strong component.version as version, @strong self as this => move |_| {
let config = config::get().expect("Failed to load config");
if let Err(err) = version.apply(config.game.dxvk.builds, config.game.wine.prefix) {
this.toast_error("Failed to apply DXVK", err);
}
}));
}
self
@ -263,17 +287,29 @@ impl App {
if component.is_downloaded(&config.game.dxvk.builds) {
if let Err(err) = component.delete(&config.game.dxvk.builds) {
this.toast_error("Failed to delete dxvk", err);
this.update(Actions::ToastError(Rc::new((
String::from("Failed to delete DXVK"), err
))));
}
component.update_state(&config.game.dxvk.builds);
this.update(Actions::UpdateDxvkComboRow);
}
else {
if let Ok(awaiter) = component.download(&config.game.dxvk.builds) {
awaiter.then(move |_| {
awaiter.then(clone!(@strong this => move |_| {
if let Err(err) = component.apply(&config.game.dxvk.builds, &config.game.wine.prefix) {
this.update(Actions::ToastError(Rc::new((
String::from("Failed to apply DXVK"), err
))));
}
component.update_state(&config.game.dxvk.builds);
});
this.update(Actions::UpdateDxvkComboRow);
}));
}
}
}
@ -285,7 +321,9 @@ impl App {
if component.is_downloaded(&config.game.wine.builds) {
if let Err(err) = component.delete(&config.game.wine.builds) {
this.toast_error("Failed to delete wine", err);
this.update(Actions::ToastError(Rc::new((
String::from("Failed to delete wine"), err
))));
}
component.update_state(&config.game.wine.builds);
@ -304,6 +342,63 @@ impl App {
}
}
Actions::UpdateDxvkComboRow => {
let model = gtk::StringList::new(&[]);
let list = dxvk::List::list_downloaded(config.game.dxvk.builds)
.expect("Failed to list downloaded DXVK versions");
let mut raw_list = Vec::new();
let mut selected = 0;
for (i, group) in [list.vanilla, list.r#async].into_iter().enumerate() {
for version in group {
model.append(format!("{} {}", if i == 0 { "Vanilla" } else { "Async" }, version.version).as_str());
if let Some(curr) = &config.game.dxvk.selected {
if &version.name == curr {
selected = raw_list.len() as u32;
}
}
raw_list.push(version);
}
}
let mut values = this.values.take();
values.downloaded_dxvk_versions = Rc::new(Some(raw_list));
this.values.set(values);
// We need to return app values before we call these methods
// because they'll invoke SelectWineVersion action so access
// downloaded_wine_versions value
this.widgets.dxvk_selected.set_model(Some(&model));
this.widgets.dxvk_selected.set_selected(selected);
}
Actions::SelectDxvkVersion(i) => {
let values = this.values.take();
if let Some(dxvk_versions) = &*values.downloaded_dxvk_versions {
let version = dxvk_versions[*i].clone();
config.game.dxvk.selected = Some(version.name.clone());
// FIXME: this calls every time we update dxvks comborow
/*if let Err(err) = version.apply(&config.game.dxvk.builds, &config.game.wine.prefix) {
this.update(Actions::ToastError(Rc::new((
String::from("Failed to apply DXVK"), err
))));
}*/
}
this.values.set(values);
config::update(config).expect("Failed to update config");
}
Actions::UpdateWineComboRow => {
let model = gtk::StringList::new(&["System"]);
@ -349,6 +444,12 @@ impl App {
config::update(config).expect("Failed to update config");
}
Actions::ToastError(toast) => {
let (msg, err) = (toast.0.clone(), toast.1.to_string());
this.toast_error(msg, err);
}
}
glib::Continue(true)
@ -451,6 +552,9 @@ impl App {
// Update downloaded wine versions
self.update(Actions::UpdateWineComboRow);
// Update downloaded DXVK versions
self.update(Actions::UpdateDxvkComboRow);
Ok(())
}
}